pipeline {
agent any
options {
gitlabBuilds(builds: ['Install Dependencies', 'Eslint'])
}
stages {
stage('SCM checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: "origin/${env.gitlabSourceBranch}"]],
userRemoteConfigs: [[
credentialsId: '',
url: ''
]]
])
}
}
stage('Install Dependencies') {
steps {
gitlabCommitStatus("Install Dependencies") {
sh '''
npm ci
'''
}
}
}
stage('Run Tests') {
parallel {
stage('Eslint') {
steps {
gitlabCommitStatus("Eslint") {
script {
env.ESLINT_OUTPUT = sh(
returnStdout: true,
script: 'npm run lint -- --format html'
)
}
}
}
}
post {
always {
addGitLabMRComment comment: "${env.ESLINT_OUTPUT}"
}
}
}
}
}
the value for env.ESLINT_OUTPUT is coming as null
what am i doing wrong ? can someone help me make this work. btw new to jenkins
note: i might have messed up some curly braces here, please ignore that