I am searching a way to define pipeline options
based on JOB_NAME in declarative pipeline
pipeline {
agent any
options {
when { expression { return env.JOB_NAME.equals('test_job') } } <----------
disableConcurrentBuilds()
}
and I am getting the error
11:23:15 WorkflowScript: 39: Options definitions cannot have blocks @ line 39, column 9.
11:23:15 when { expression { return env.JOB_NAME.equals('test_job') } }
Any workaround to achieve this?
Thank you
question from:
https://stackoverflow.com/questions/65670779/jenkinsfile-pipeline-option-when-equivalent 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…