How to Trigger a Downstream Job With the build Step in Jenkins
The build step starts another job by name, optionally passing parameters and waiting for its result.
Call build job: 'name' to trigger a downstream job. Pass parameters:, set wait: to block on it, and propagate: to decide whether its failure fails this build.
Steps
- Call
build job: 'downstream-name'. - Pass
parameters: [string(name: ..., value: ...)]as needed. - Set
waitandpropagateto control blocking and failure handling.
Jenkinsfile
Jenkinsfile
pipeline {
agent any
stages {
stage('Deploy') {
steps {
build job: 'deploy-service',
parameters: [
string(name: 'ENV', value: 'staging'),
booleanParam(name: 'DRY_RUN', value: false)
],
wait: true,
propagate: true
}
}
}
}Gotchas
- With
propagate: false, capture the returned object and inspect.resultyourself. - Parameter types must match the downstream job definition or the call is rejected.
Related guides
How to Pin a Node.js Version With the tools Block in JenkinsSelect a configured Node.js, JDK, or Maven install for a Jenkins pipeline with the tools block, so the build…
How to Use an SSH Key With sshagent in JenkinsLoad an SSH private-key credential into the agent for a block of steps with sshagent from the SSH Agent plugi…