从以前的Jenkins版本获得Subversion修订版 [英] Obtain Subversion Revision from Previous Jenkins Build

查看:168
本文介绍了从以前的Jenkins版本获得Subversion修订版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个詹金斯工作(Jenkins Job),它会定期轮询颠覆活动. 当构建启动时,我希望Jenkins工作从上一个Jenkins构建中获取文件X"的SVN版本号.

I have a Jenkins Job that polls subversion periodically. When the build kicks off I would like the Jenkins job to obtain the SVN Rev # for "file X" from the PREVIOUS Jenkins Build.

我想要此修订号的原因是,我可以实现一个脚本,该脚本在先前的Jenkins Build文件X"和工作副本文件X"之间执行"svn diff".如果存在差异,则需要执行文件X".如果没有差异,则可以跳至文件Y".

The reason I want this revision number is so I can implement a script that does an "svn diff" between previous Jenkins Build "file X" and the working copy "file X". If there are differences, then "file X" needs to execute. If there are no differences then it can skip to "file Y".

这些文件需要很长时间才能运行:)

These files take a long time to run :)

推荐答案

运行作业时,您可以作为环境变量访问SVN_REVISION_1(对于第一个SVN URL).您需要将其另存为工件

When a job runs for, you have access to SVN_REVISION_1 (for the first SVN URL) as environmental variable. You need to save that as an artifact

在Windows上:
echo %SVN_REVISION_1% > myrevfile

On Windows:
echo %SVN_REVISION_1% > myrevfile

在Linux上:
echo $SVN_REVISION_1 > myrevfile

On Linux:
echo $SVN_REVISION_1 > myrevfile

在构建结束时,存档此文件(您也可以拥有其他存档的工件).

At the end of the build, archive this file (you can have other archived artifacts too).

在您的下一个版本中,您将运行步骤" 复制工件 ".在该步骤中,选择与当前项目相同的项目(您可以为其变量),选择最新成功构建",然后选择要复制的工件和位置.

In your next build, you will run a step "Copy Artifacts". In that step, select the same project as current project (can you variables for that), select "latest successful build", and select the artifact you want to copy and the location.

您不能通过此步骤重命名工件,但可以将其复制到某个临时位置,并在以后根据需要使用脚本重命名.

You can't rename the artifact with this step, but you can copy it to some temp location, and rename later with scripts if needed.

这篇关于从以前的Jenkins版本获得Subversion修订版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆