如何将 svn_revision 参数传递给 Jenkins 中的下游构建?

发布于 2024-12-15 23:12:51 字数 80 浏览 2 评论 0原文

我想让启动父构建的 svn 修订号可供下游作业使用。这可能吗?

我正在使用 Build Pipline 插件手动触发一些下游作业。

I want to have the svn revision number that kicked off the parent build available to downstream jobs. Is this possible?

I'm using the Build Pipline plugin to manually trigger some downstream jobs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悟红尘 2024-12-22 23:12:51

我发现执行此操作的唯一方法如下:

在第一个作业触发的 build.xml 中,我可以访问 env.SVN_REVISION 参数,然后将其写入 pipeline.properties 文件并存档。

    <propertyfile file="pipeline.properties" >
      <entry key="svn.revision" value="${env.SVN_REVISION}"/>
    </propertyfile>

然后,在复制工件插件的帮助下,每个下游作业只需从触发它们的上游构建的存档 pipeline.properties 文件中读取属性。

The only way I've found to do this is like so:

In my build.xml which is fired by the first job I have access to the env.SVN_REVISION parameter, I then write this to a pipeline.properties file and archive this.

    <propertyfile file="pipeline.properties" >
      <entry key="svn.revision" value="${env.SVN_REVISION}"/>
    </propertyfile>

Each downstream job then just reads the property from the archived pipeline.properties file from the upstream build that triggered them, with the help of the copy artifact plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文