how to get pipeline svn revision number

1,523 views
Skip to first unread message

Ioannis Cherouvim

unread,
Mar 10, 2017, 9:48:26 AM3/10/17
to Jenkins Users
Inside a jenkins 2 pipeline I do the following to checkout some code:

> svn 'svn://example.com/project'

On the console output I see:
> Updating svn://example.com/project at revision '2017-03-10T16:43:00.322 +0200'
> At revision 817

How can I get the revision number (in this case "817") in a variable?

thanks

thomas tressieres

unread,
Mar 10, 2017, 11:30:13 AM3/10/17
to Jenkins Users
Hi,

On Stack overflow, I found a trick that works for me

      svn 'svn://example.com/project'
      bat(script: "svn info --show-item last-changed-revision . > tmp_svn")
      def svnRevision = readFile('tmp_svn').trim()

Regards,
Reply all
Reply to author
Forward
0 new messages