3

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.

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 :)

user3555181
  • 117
  • 4
  • 11

1 Answers1

3

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.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Slav
  • 27,057
  • 11
  • 80
  • 104