I have a Jenkinsfile
I would like to trigger certain steps based on env.JOB_NAME
. As a test I have done this;
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('Get ID') {
when {
"${env.JOB_NAME}" == 'Notification Sender (dev)'
}
steps {
echo "${env.JOB_NAME}"
}
}
}
}
However I get the error;
WorkflowScript: 6: Expected a when condition @ line 6, column 11.
when {
^
WorkflowScript: 6: Empty when closure, remove the property or add some content. @ line 6, column 11.
when {
^
Can I make the stage run based on the env.JOB_NAME
using the when
condition?