Dmitry R
Dmitry R

Reputation: 3186

Setting custom build in Jenkins

I'm trying to create custom build format in Jenkins. My build ideally would have the ${GIT_TAG}.${BUILD_NUMBER}

I've installed the buildnamesetter plugin, https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin.

However I can't figure out how can I access the build parameters, there is a way to access the environment parameters but not the build ones.

Eventually all I get with ${GIT_TAG}.${BUILD_NUMBER} is the running number of the build such as: #24 and error in the execution log:

Unrecognized macro 'GIT_TAG' in '${GIT_TAG}.${BUILD_NUMBER}'

I might be looking in the wrong direction and different plugin can be used, any help will be appreciated.

Jenkins config of the plugin

I'm still stuck since I have a requirement to have additional parameter as in the build number string and this one is selected by the user from Choice Parameter and Choice Parameter can't be converted to be environment AFAIK. Any ideas would be very appreciated.

Upvotes: 1

Views: 1588

Answers (1)

Dmitry R
Dmitry R

Reputation: 3186

Ok, finally after struggling for few hours seems that solution was found I'll post it here in case it might help to someone else:

  • Need the following plugins:
    1. build-name-setter
  • Create your run time parameter that set by the user
  • Use the following built in Jenkins functionality to prepare the environment before the run:

enter image description here

  • Set the Properties Content to have any parameter that your user/script supplies and you would like it to be ENV parameter

How I used it:

enter image description here

  • When referring the env parameter in the build-name-setter plugin use the following example as reference on how to access the environment parameters ${ENV,var="SELECTED_DEVICE"}

How I used it:

enter image description here

Upvotes: 1

Related Questions