【问题标题】:Jenkins build only one branch that has been pushedJenkins 只构建了一个已推送的分支
【发布时间】:2017-03-13 06:53:19
【问题描述】:

我想配置只构建一个分支的 Jenkins 已推送到 github。我试过with leave blank at Branch Specifier

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

【问题讨论】:

标签: git github jenkins webhooks


【解决方案1】:

你考虑过外部钩子触发的pipelines吗?如果 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-02
    • 1970-01-01
    • 2017-09-16
    • 1970-01-01
    • 2011-12-24
    • 1970-01-01
    • 2013-03-30
    • 2011-06-20
    相关资源
    最近更新 更多