【问题标题】:How to add shell script to all jenkins jobs?如何将 shell 脚本添加到所有 jenkins 作业?
【发布时间】:2016-12-08 18:12:16
【问题描述】:

我想将“git tag”脚本添加到所有 jenkins 作业中,并且我知道如何将脚本添加到一项特定作业中。但是有没有办法为每个作业全局添加这个脚本?

cd ${WORKSPACE}/${project}
prefix="btag"
if [[ "$buildtype" = "Release" || "$buildtype" = "FirstPublish" ]];then
    prefix="rtag"
fi
tag=`date "+$prefix-%Y%m%d-%H%M%S-${BUILD_USER}"`
git tag $tag
git push origin $tag

【问题讨论】:

    标签: jenkins


    【解决方案1】:

    有几篇文章描述了如何一次更新多个作业。 Jenkins 的 Groovy 脚本控制台 API 分别为您提供帮助。

    你“只是”必须迭代Hudson.instance.items,它代表你的工作。

    示例文章为Mastering Jenkins: Making Bulk Updates to Jobsin the Jenkins Wiki

    其他选项包括批量编辑作业的 XML 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-26
      • 2019-02-08
      • 1970-01-01
      • 1970-01-01
      • 2017-07-01
      • 2011-10-31
      • 2020-07-04
      相关资源
      最近更新 更多