Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
Jenkins LTS
Description
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
Attachments
Issue Links
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Labels | pipeline |
Component/s | pipeline-model-definition-plugin [ 21706 ] | |
Component/s | pipeline [ 21692 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Andrew Bayer [ abayer ] |
Status | In Progress [ 3 ] | In Review [ 10005 ] |
Remote Link | This issue links to "PR #290 (Web Link)" [ 21921 ] |
Resolution | Fixed [ 1 ] | |
Status | In Review [ 10005 ] | Resolved [ 5 ] |
Status | Resolved [ 5 ] | Closed [ 6 ] |
I'm not quite sure what's going on here, but I was able to reproduce it. Looks like someone in
JENKINS-47881also mentioned a similar issues using the ternary operator for an environment variable. CC abayer, are we all missing something obvious here?