Hi,

We have the same requirements and we have a big pipeline that runs 
different things depending of the trigger and we have nightly CI builds.

 

We use the conditional “when” to identify the trigger and run some portion 
of the pipeline depending of where it comes from:

 

stage('Deploys') {
    when {
        beforeAgent 
*true *        anyOf {
            triggeredBy 'UpstreamCause'
            triggeredBy 'BuildUpstreamCause'
            triggeredBy 'UserIdCause'
        }
    }

 

The above is a portion of the pipeline we only want to build when triggered 
by an upstream job or someone manually run it.

This exclude all webhooks related to push code to our repository, just to 
mention one.

 
stage('Setup') {
    when {
        beforeAgent 
*true *        anyOf {
            triggeredBy 'GitHubPullRequestCommentCause'
        }
    } 

 

The above is a part of the pipeline we want to run only when someone 
commented on GitHub and not on other webhooks.

 

And finally:

 
triggers {
    cron(branch.isMaster() ? 'H 0 * * *' : '')
} 

 

We use the triggers option to setup nightly builds for the master branch 
only.

 

Hope that this is what you are looking for,

Cheers,

Gianluca.

On Friday, 25 February 2022 at 16:42:58 UTC rsap...@gmail.com wrote:

> We have a huge pipeline that is currently set with a webhook trigger 
> defined in a pipelineTriggers section in the properties section.  However, 
> sometimes we would like some of these jobs to ONLY run nightly CI builds.  
> I'm trying to avoid having a second version of this huge pipeline script 
> where the only difference is the piplineTrigger section.
>     In a perfect world I'd have a Boolean parm for CI that when checked, 
> the job used a cron type trigger and when unchecked, it used the web hook 
> trigger... but I have seen anything like that.
>
> any help would be appreciated.
>
> Thanks,
>
> Rusty
>

-- 
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/44867921-e7a8-4202-a596-6a1c6d77cc94n%40googlegroups.com.

Reply via email to