Hi,

You can do it from Jenkins itself.

 

For example, in our case we want the exact opposite, so we have in our pipeline:

 

stage('Setup') {
    when {
        beforeAgent true
        anyOf {
            triggeredBy 'UpstreamCause'
            triggeredBy 'UserIdCause'
        }
    }
    steps {

 

The above tells Jenkins to run the steps only if the build has been triggered 
by an upstream job or by a user.

 

To get what you want, you need a similar thing in repo_a, repo_b and repo_c 
that triggers the repo_main when webhook arrives:

 

stage('Setup') {
    when {
        beforeAgent true
        anyOf {
            triggeredBy 'SomethingGitHubTrigger' // look on internet for the 
exact name, I don’t know
            triggeredBy 'UserIdCause'
        }
    }
    steps {
build([
    job:
        "Your repo_main job",
    wait: false,
    propagate: false
])

 

And then everytime someone pushed on repo_a/b/c then the repo_main build is 
triggered on cascade.

 

I hope that helps.

Cheers,

Gianluca.

 

 

From: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> On 
Behalf Of Danijel DOMAZET
Sent: 19 March 2021 10:40
To: Jenkins Users <jenkinsci-users@googlegroups.com>
Subject: Is it possible to trigger a GitHub webhooks build - from another repo?

 

Hi, 

My repo_main "depends" on several other repos. It internally uses a script to 
git clone repo_a, repo_b and repo_c into subdirs. 

 

This poses a problem when using webhooks to trigger Jenkins builds from GitHub. 

 

The question is: is there a way to trigger a build in repo_main when there has 
been a push in either repo_a, repo_b, or repo_c? 

 

Any help most appreciated... 

Thanks, Danijel.

 

- Confidential -

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com 
<mailto:jenkinsci-users+unsubscr...@googlegroups.com> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ac0642e3-13e3-4945-86b9-6fa93bbc0e9cn%40googlegroups.com
 
<https://groups.google.com/d/msgid/jenkinsci-users/ac0642e3-13e3-4945-86b9-6fa93bbc0e9cn%40googlegroups.com?utm_medium=email&utm_source=footer>
 .

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/024501d71cc8%24d429dff0%247c7d9fd0%24%40gmail.com.

Reply via email to