Create a temporay file via groovy

15 views
Skip to first unread message

Niksan

unread,
May 23, 2016, 8:15:56 AM5/23/16
to Jenkins Users
I'm wanting to create a temporary batchfile on a Jenkins slave via groovy similar to the way Jenkins itself does when invoking a Windows batch file.

cmd /c call C:\Windows\TEMP\hudson6180922768700485046.bat

How do I go about doing that via groovy in Jenkins?

Maciej Jaros

unread,
May 26, 2016, 11:25:38 AM5/26/16
to jenkins...@googlegroups.com
'Niksan' via Jenkins Users (2016-05-23 14:15):
I'm wanting to create a temporary batchfile on a Jenkins slave via groovy similar to the way Jenkins itself does when invoking a Windows batch file.

cmd /c call C:\Windows\TEMP\hudson6180922768700485046.bat

How do I go about doing that via groovy in Jenkins?

You can use build variables (e.g. BUILD_TAG or even just BUILD_NUMBER) to create a unique file name for a build. Depends on your use case.

See this for a list of all variables.
https://[your.jenkins.domain]/env-vars.html/

Regards,
Nux.
Reply all
Reply to author
Forward
0 new messages