Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Embed a Date into a Build Artifact

Cory Mohling January 19, 2018

I have a build plan that produces a zip file as an artifact. Right now, it is called build.zip. I was wondering if it possible to name it based off the Date or Rev of the build such as build_01_19_18_rev12345.zip. I wanted to try to help avoid people mixing up builds, since currently their download folder will just have a series of generic build.zip files.

1 answer

0 votes
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2018

You can achieve this by facilitating Bamboo variables in the build step that produces the artifact, in particular you likely want to use ${bamboo.buildTimeStamp} and/or ${bambooBuildNumber}.

The specifics depend on the build step you are using to produce the artifact, but all Bamboo tasks including the Script task should support the required variable substitution at build time just fine - the examples for Maven ant Ant illustrate the general concept.

Cory Mohling January 22, 2018

Thanks for the response. Is there any way to set the value of a bamboo variable from within a script? Or do some string manipulation of other bamboo variables? Example, could I just get the date without the time.

Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2018

Yes, but only with an indirection - you can manipulate the variable values in a script, write them to a file, and then inject them again as new variables by means of one of the following tasks:

You can then refer to the newly injected variables from subsequent tasks.

Cory Mohling January 23, 2018

Awesome thank you very much.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events