Jenkins pipeline git branch push trigger

23 views
Skip to first unread message

Jerome Godbout

unread,
Nov 11, 2019, 5:28:41 PM11/11/19
to Jenkins Users
Hi,
I'm using my Jenkins file pipeline to checkout and build, I have a pipeline project I would like to get triggered only when a push to a specific branch occur. The Git repos is host on bitbucket cloud services. I cannot make a webhook, since the Jenkins run on an intranet and cannot be access from the web.

Is there a way to trigger on a push on release/test and not on master or any other branch for example? how can I do this?

my pipeline checkout look like this so far:
checkout([$class: 'GitSCM'
                , branches: [[name: repos['branch']]]
                , browser: [$class: 'BitbucketWeb', repoUrl: repos['url']]
                , doGenerateSubmoduleConfigurations: false
                , extensions: [[$class: 'CloneOption', noTags: false], [$class: 'LocalBranch', localBranch: "**"], [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false], [$class: 'CleanCheckout'], [$class: 'CleanBeforeCheckout']]
                , submoduleCfg: []
                , userRemoteConfigs: [[credentialsId: 'BitBucketAmotus', url: repos['url']]]
            ]);

Thanks,



Ramanathan Muthaiah

unread,
Feb 23, 2020, 10:34:49 PM2/23/20
to Jenkins Users
 Maybe, you could add a check (prior to the checkout stage) for the incoming branch, if it's per the requirements, then move on to build other stages.

/Ram
Reply all
Reply to author
Forward
0 new messages