bamboo.buildTimeStamp format

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

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

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.

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

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Agile

What is ChatOps? A guide to its evolution, adoption, and significance

I am the product of AIM. I can hear that door swinging open and closed in my mind with absolute fidelity. I’d recognize that ding anywhere. At 15, as I typed away into AOL IM, I never imagined that ...

26 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you