Pass job name and build number to cloudbees application

215 Views Asked by At

I want to be able to use the job and build number within my cloudbees application (i.e access it as an environment variable). In the application description, I can use "${JOB_NAME} #${BUILD_NUMBER}", but is this also possible somehow within the environment override fields?

I want to be able to set something like:

Name: runningversion
Value: ${JOB_NAME} #${BUILD_NUMBER}
1

There are 1 best solutions below

2
On BEST ANSWER

I am assuming you are using the CloudBees Deployer plugin to deploy your application to our RUN@cloud service.

If that is the case then you can achieve exactly what you want with the Override Environment section. You just need to do something like this:

Screenshot of how to configure

The in-line help for the Value field even indicates that it

Supports ${} style token macro expansion

As a hint to let you know that you can do what you are trying to do... so if it doesn't work then there is a bug!

Those Override Environment name-value pairs should be available, at least, as OS level environment variables and for the Java based ClickStacks (e.g. Tomcat, JBoss, Glassfish, Play, etc) they should also be available as Java System Properties but that can require that the ClickStack is written to provide that support (the well known ones produced by CloudBees should)