Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (55.6k points)

Can Jenkins pipeline invoke other pipeline?

1 Answer

0 votes
by (119k points)

Yes, a Jenkins pipeline invokes another pipeline. Suppose if you have two Jenkins pipelines named pipeline-A and pipeline-B and want to invoke pipeline-A in pipeline-B (pipeline-A is a subset of pipeline-B).  Here is how you can invoke pipeline-A in pipeline-B:

pipeline {

    agent

    {

        node {

                label 'master'

                customWorkspace "${env.JobPath}"

              }

    }

   stages

    {

        stage('Start') {

            steps {

                sh 'ls'

            }

        }

        stage ('Invoke_pipeline') {

            steps {

                build job: 'pipeline1', parameters: [

                string(name: 'param1', value: "value1")

                ]

            }

        }

        stage('End') {

            steps {

                sh 'ls'

            }

        }

    }

}

If you want to learn Jenkins, check out this Jenkins Certification course by Intellipaat.

Also, watch this video on Jenkins Pipeline:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...