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?
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:
Add a Script task that will evaluate the variable and call Gradle:
#!/bin/bashif [ -n "${bamboo_GRADLE_HOME}" ] ; then export GRADLE_HOME=${bamboo_GRADLE_HOME}fi${GRADLE_HOME}/bin/gradle build
More information:
Cheers,
Eduardo AlvarengaAtlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
Thanks Eduardo. Your input certainly helped!
It looks like you're new here. Sign in or register to get started.