Pipeline - How to write a declarative pipeline to invoke another job

Article ID:360019828412
1 minute readKnowledge base


  • I want a sample code of Declarative Pipeline which invokes another job


pipeline {				//indicate the job is written in Declarative Pipeline
    agent any				//agent specifies where the pipeline will execute.
    stages {
        stage ("build") {		//an arbitrary stage name
            steps {
                build 'Pipeline_B'	//this is where we specify which job to invoke.

You can use the Snippet Generator from Jenkins to generate the pipeline code. Snippet Generator can be accessed from ${JENKINS_HOME}/pipeline-syntax/


  • The build step can be used to call any project. The job which will be triggered does not have to be a pipeline.

  • You can pass additional build parameters as documented in Pipeline Build Step

Tested product/plugin versions