Home > Net >  Triggering a Jenkins job from another Jenkins job, without remote URL Curl
Triggering a Jenkins job from another Jenkins job, without remote URL Curl

Time:10-22

I'm working on building a Jenkins job that will trigger a pipeline to build a new AMI in one group, when a Golden AMI in another group becomes available. I need a way for a Jenkins job to initiate another Jenkins job without using the remote build URL method, because in the environment I'm working in it's not feasible to keep them all updated.

I've seen some things about plug-ins, but I'm a little fuzzy about which should be used here. Is there one that's recommended? Or is there a way to script this without the remote URL?

CodePudding user response:

You can use build job to start an existing pipeline in Jenkins. It's part of the Build Step plugin.

A simple example:


pipeline {
    agent {
        node { label 'nuc3' }
    }
    stages {
        stage('Run External Jobs') {
            steps {
                build job: 'FOLDER_TEST_JOBS/test_job1_located_under_folder', wait: false
                sleep(60)
                build job: 'test_job_without_folder_path', wait: false
            }
        }
    }
}
  • Related