Conditional environment variables in Jenkins Declarative Pipeline
问题 I'm trying to get a declarative pipeline that looks like this: pipeline { environment { ENV1 = 'default' ENV2 = 'default also' } } The catch is, I'd like to be able to override the values of ENV1 or ENV2 based on an arbitrary condition. My current need is just to base it off the branch but I could imagine more complicated conditions. Is there any sane way to implement this? I've seen some examples online that do something like: stages { stage('Set environment') { steps { script { ENV1 = 'new1