Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,029
Community Members
 
Community Events
168
Community Groups

Does bamboo allow a plan variable to point to another variable referencing a system property?

In my build script I am referencing a system variable gradle_home. I want to substitute this with a bamboo variable so that I can override this value for a specific branch. However the build runs on different systems and the only way to reliably get the gradle_home for the system is via the system.gradle_home. So I am trying to get the bamboo variable to point to the system variable in normal case and to the new path in the overridden case. Is this possible?

1 answer

1 accepted

0 votes
Answer accepted

Hello @Robins John

Welcome to Atlassian Community!

Choosing which variable to use is up to the application, not Bamboo. What you can do is set a script task that would evaluate if the custom variable is set and then overwrite the system.GRADLE_HOME if needed. You can do something like this:

Assuming:

  • ${system.GRADLE_HOME} (the one inherited from your OS)
  • ${bamboo.GRADLE_HOME} (the one declared on the Plan)

Add a Script task that will evaluate the variable and call Gradle:

#!/bin/bash

if [ -n "${bamboo_GRADLE_HOME}" ] ; then
export GRADLE_HOME=${bamboo_GRADLE_HOME}
fi

${GRADLE_HOME}/bin/gradle build

More information:

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Thanks Eduardo. Your input certainly helped!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events