Obtain Subversion Revision from Previous Jenkins Build

后端 未结 1 890
误落风尘
误落风尘 2021-01-14 10:57

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 Jenki

相关标签:
1条回答
  • 2021-01-14 11:24

    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

    On Windows:
    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.

    0 讨论(0)
提交回复
热议问题