我已经配置了jenkins作业,希望当我对该特定分支的Github进行一些更改时,应该触发该作业.
I have configured a jenkins job and I wish it should be triggered when I make some changes to the Github for that particular branch.
我使用Github插件并启用了将更改推送到github时构建". 但是,如果其他人创建了一个单独的分支并将其推送到该分支,则此选项将触发我的工作.
I use the Github plugin and has enabled "build when a change is pushed to github". But this option is triggering my Job if someone else create a separate branch and push to that branch.
下面让我解释一下:
Change pushed to branch "release" Jenkins notified and job executes - Expected behavior Another change is now pushed to branch "xyz" but I don't intend this to cause execution of my Jenkins job. The Job "xyz" is created out of the same repo though.如何防止推送到其他分支的更改触发我的工作?
How can I prevent changes pushed to other branches triggering my job?
启用将更改推送到github时构建"是不正确的吗?
Is enabling "build when a change is pushed to github" is not correct?
推荐答案在作业配置的git部分中,有一个字段"Branches to build".您可以在此处指定将新的提交推送到它们时哪些分支将触发构建.
In the git section of the job configuration is a field 'Branches to build'. You can specify here which branches will trigger a build when new commits are pushed to them.
例如对于我的一项工作,我拥有**/BARE- *,因此只有以BARE-开头的分支才会触发构建.
e.g. for one of my jobs I have **/BARE-* , so only branches which start with BARE- will trigger a build.
更多推荐
仅在特定分支发生更改时才触发Jenkins Job
发布评论