Thanks, that really helped. 
I managed to easily trigger another job from the main one using 
build([job...
 
But, somehow I cannot get GitHub to trigger the repo_main... the webhook is 
sent, but not received by the repo_main.
I tried triggeredBy 'GitHubPushTrigger' but still nothing. 

What am I doing wrong? 
Thanks. 



On Friday, 19 March 2021 at 15:05:15 UTC+1 Gianluca wrote:

> 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:* [email protected] <[email protected]> *On 
> Behalf Of *Danijel DOMAZET
> *Sent:* 19 March 2021 10:40
> *To:* Jenkins Users <[email protected]>
> *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 [email protected].
> 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>
> .
>

-- 
- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/722dd75a-cb56-4beb-99ba-c080be0935d1n%40googlegroups.com.

Reply via email to