-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins LTS
Using boolean parameters to set environment variables doesn't work for some crazy reason.
pipeline {
agent none
options {
ansiColor('xterm')
skipDefaultCheckout()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
parameters {
booleanParam(
name: 'lazyBuild',
defaultValue: true,
description: 'Skip build'
)
}
stages {
stage('WTF') {
agent {
label 'master'
}
environment {
IS_LAZY = "${(params.lazyBuild) ? 't' : 'f'}"
IS_NOT_LAZY = "${(!params.lazyBuild) ? 't' : 'f'}"
}
steps {
sh 'echo IS_LAZY: $IS_LAZY'
sh 'echo IS_NOT_LAZY: $IS_NOT_LAZY'
}
}
}
}
Output:
[00-build] Running shell script + echo IS_LAZY: t IS_LAZY: t [Pipeline] sh [00-build] Running shell script + echo IS_NOT_LAZY: t IS_NOT_LAZY: t
- links to