Jenkins只构建了一个被推送的分支

Cha*_*HAM 7 git github webhooks jenkins

我想配置Jenkins只构建一个分支已被推送到github.我尝试在Branch Specifier留空

但在我提交/推动后,所有分支都将建成.我只需要一个刚刚提交/推送的分支.我怎样才能做到这一点?谢谢.

h__*_*h__ 0

您是否考虑过外部钩子触发的管道?如果 github 支持钩子(我不知道),你可以在 post-receive 钩子中执行如下操作。仅当代码被推送到开发分支时,这才会运行作业。

while read oldrev newrev ref
do
    if [[ $ref =~ .*/development$ ]];
    then
            curl -s http://jenkins:8080/job/stage/build
            echo Jenkins pipeline triggered by calling the webservice
    fi
done
Run Code Online (Sandbox Code Playgroud)