hey, all!
Here's what I would like to do:
1. in the pipeline itself, create an environment variable.
2. pass that environment variable to a job
3. that job will overwrite the environment variable's value at the top level
4. a later job will use this new value within its execution.
something like:
pipeline {
agent {
label 'Computer'
}
environment {
1. pipelineVariable = "15" 3. (after the changeVariableValue job, variable value is now 7)
}
stages {
stage('change variable value') {
steps {
script {
2 build job: changeVariableValue
parameter: [[$class: 'StringParameterValue', name: 'PipelineVariable', """${pipelineVariable}"""]]
}
}
}
stage('new variable value') {
steps {
script {
4 build job: newVariableValue parameter: [[$class: 'StringParameterValue', name: 'PipelineVariable', """${pipelineVariable}"""]]
}
}
}
}
}
The jobs are written in Powershell.
Is there a way to do this?