Peter PitLock
Peter PitLock

Reputation: 1873

Pass variables to "Execute Windows Batch Command" in Jenkins

I need to pass the ${BUILD_NUMBER} to both nuget and to octo during a build in jenkins.

I do not want to use a specific batch file

nuget pack -Version 1.1.${BUILD_NUMBER} 

octo.exe push --package "C:\Jenkins\workspace\MyWorkspace\MyProject.1.1.${BUILD_NUMBER}.nupkg" 

How would I be able to parameterize the above commands to include the correct build number?

Solution :

nuget pack -Version 1.1.%BUILD_NUMBER%

octo.exe push --package "C:\Jenkins\workspace\MyWorkspace\MyProject.1.1.%BUILD_NUMBER%.nupkg" 

enter image description here

Upvotes: 0

Views: 9352

Answers (1)

ReneA
ReneA

Reputation: 526

Use the default windows technique %...% for passing your variables along.

In your example you'd get

nuget pack -Version 1.1.%BUILD_NUMBER%

Upvotes: 7

Related Questions