bamboo.buildTimeStamp format

Jason Wandel May 24, 2012

Hi all,

We're rolling some projects across from Hudson into Bamboo and have hit a problem with one of them.

This project builds with Ant and uses some of the Hudson timestamp variables to set the build time into an environment variable. The environment variable is in turn used to create a specific build folder.

I tried to do the same thing using Bamboo's buildTimeStamp variable, but unfortunately for me it is listed as "ISO8601" which means that it gives a full dump in the full format specified in that standard - including some characters that the OS doesn't like as part of directory names.

I can't find anything to suggest that alternate formatting which are also part of that standard are supported, or how to specify them.

I'd like the timestamp in DDMMYYYY format, so is anyone able to help with able to get that output from this variable?

In the meantime, I'm just going to set it to use the build number so the project can at least execute.

TIA,

Jason [SolveIT Software]

3 answers

1 accepted

1 vote
Answer accepted
James Dumay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 27, 2012

Hi Jason,

There isn't any way to change the bamboo.buildTimeStamp format, however I've opened up an improvement request to add a similar variable that outputs to a simpler date format that is more file system friendly.

Thanks

James

Jason Wandel May 27, 2012

Thanks for that James, I'll watch for the enhancement in some future Bamboo release... but as I said we'll just use the build ID for the moment, and that's successful.

Tim Pokorny March 14, 2013

I'm having the same issue. All I really want is "yyyyMMdd"

2 votes
chad larkin November 17, 2014

You can actually set a plan variable to the system date if this is building on a linux machine by setting the value of the plan variable to something like

$(date +"%m-%d-%y-%l-%M-%S")

This will return as mm-dd-yy-hh-mm-ss.  You could change the format to that of your liking.  However this will not transfer to a deployment plan as the deployment plan picks up the string and not the value returned by it.

1 vote
Magnus Heino January 23, 2014

Workaround for now:

Create a script task in bamboo:

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > timestamp.pom
echo "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">" >> timestamp.pom
echo -n "<version>" >> timestamp.pom
echo -n `date +'%Y%m%d%H%M%S'` >> timestamp.pom
echo "</version>" >> timestamp.pom
echo "</project>" >> timestamp.pom

Use the "Maven POM Value Extractor" plugin. Override the project file in this task to read from timestamp.pom

Now the custom timestamp is available in ${bamboo.maven.version}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events