Reputation: 41
I created two jenkins pipeline jobs and both are dependency jobs. Here I want to pass parameters value from one job to another. I am new to pipeline job creation. Please give reply for this question with examples.
Upvotes: 0
Views: 2500
Reputation: 71
you can use below method too
stages {
stage('job') {
steps {
echo "${params}"
script {
def myparams = currentBuild.rawBuild.getAction(ParametersAction).getParameters()
build job: 'downstream-pipeline-with-params', parameters: myparams
}
}
}
}
Upvotes: 0
Reputation: 13712
You can use pipeline step: build
// NEXT_JOB is the job path of the next job.
build (job: "${NEXT_JOB}", parameters: [
[
$class: 'StringParameterValue',
name: 'DOWN_PARAM_1',
value: "${env.UP_PARAM_1}"
],
[
$class: 'StringParameterValue',
name: 'DOWN_PARAM_2',
value: "${env.UP_PARAM_2}"
]
],
wait: true)
Upvotes: 1