siri
siri

Reputation: 109

trigger build for git repo B for a commit/pull request done on Git repo A using jenkins pipeline

My objective is to trigger a build on Git repo A whenever there is commit/Pull request done on Git Repo B. Git repo has all the pipeline code as separate groovy code and Git Repo b has the application Code done by dev team. I would like to test the case where a commit done in pipeline code is triggering the build in application code. How can I acheive this using Jenkins 2 with pipeline? Any thoughts or approach how it is done is greatly appreciated.

Here is my jenkinsfile in Git repo A.

branches {
    masterBranch = 'master'

}

integration {

pullRequest {
    version = gradle {    
        goals = 'clean build'
        gradlePath = '/gradle-4.1/bin/gradle'
    }

}

master {
    version = gradle {
        goals = 'clean build'
        gradlePath = '/gradle-4.1/bin/gradle'
    }


}

}

Upvotes: 0

Views: 327

Answers (1)

sanath meti
sanath meti

Reputation: 6519

So you need to create 2 jobs

  • git repo a : with development code
  • git repo b : with option "Build when a change is pushed to GitHub" in build triggers job config.

then use "Parameterized Trigger Plugin" to build required job( repo A ) based on the previous build status.

Upvotes: 0

Related Questions