Post

2 followers Follow
1
Avatar

HOW TO: Change hardcoded application version Bamboo plugin without entering the Bamboo GUI

Hi,

I'm working on a research project where we are using Bamboo to deploy a web application to a server running Apache.

I got it working but ran in to a problem with the hardcoded version field in the XL Deploy Bamboo plugin. For each deployment the version had to be updated before a deployment could start.

I found a "solution" in this threat:
https://support.xebialabs.com/hc/en-us/community/posts/201995465-Let-Bamboo-plugin-resolve-application-version-from-found-DAR?input_string=HOW%20TO%3A%20Change%20hardcoded%20application%20version%20Bamboo%20plugin

You need an extra plugin called: Maven POM Value Extractor
Link: https://marketplace.atlassian.com/plugins/com.davidehringer.atlassian.bamboo.maven.maven-pom-parser-plugin/server/overview

After that, you need to create a pom.xml file in the project root. It took me some time to figure it out but got it running, eventually. This is the content of the file:

<?xml version="1.0" encoding="UTF-8"?>
<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">

            <modelVersion>4.0.0</modelVersion>
            <version>APPVERSION</version>

</project>

Where "APPVERSION" needs to be replaced with the actual version. I made a script that replaced "APPVERSION" with the current date/time. This way the version number is always unique. 

After this you need to replace the version number in the XL Deploy plugin with: ${bamboo.maven.version}. 



I included a screenshot with the Maven POM Value Extractor plugin settings. 

Both screenshots also show the task order. Maybe this comes in handy for some of you.

If you have any questions or suggestions, leave it in the comments. Hopefully this tutorial comes in handy to fasten up your deployment.

Joeri

Joeri Voet

Please sign in to leave a comment.

1 comment

0
Avatar

Great Tutorial.

We do kind of the same, but use the XML variable Extractor plugin to fetch the actual DAR version from manifest file. 

We also label builds automaticly with the DAR version

Making the build a little more informative

 

Bjarte Nilsen 0 votes