It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script task to list the repositories and their revision during build

D K Feb 14, 2017

I want to write a script task that will output a file with all the Git repositories used by the build and the revision/commit it is building.

Basically, I'd like to write the Bamboo Build result summary page to a file and store this file in the build artifact zip.

1 answer

0 votes
Rafael Sperafico Atlassian Team Feb 14, 2017

Hello D K,

If you are running the Source Code Checkout task, Bamboo will have information about your repository. That said, you can make use of Bamboo Variables in a Script task, sending them to a file:

echo ${bamboo.repository.svn.repositoryUrl} >> file.txt
echo ${bamboo.repository.revision.number} >> file.txt
...

You can list all environment variables available to the build by running the following on a Script task:

# Windows
set
 
# Linux/MacOS
env

Please, refer to https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables for more information.

Kind regards,

Rafael

D K Feb 16, 2017

Hi,

In my case it is a Bamboo Plan made up of 30+ Git repos with 30+ Jobs. A Job to build each repo.

There doesn't seem to be any Bamboo variable to get the Jobs Git repo and Git commit.

I know there is the property ${bamboo.planRepository.<position>.revision} but what happens if a repo is added/removed. Won't the position change?

Is there anything like ${bamboo.jobTaskRepository.name} and  ${bamboo.jobTaskRepository.revision}  and ${bamboo.jobTaskRepository.branchName}

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Opsgenie

Handling Opsgenie Alerts

Hi everyone, welcome to the kb articles for Opsgenie FAQs. I'm one of the Technical Support Engineers for Opsgenie who will be providing weekly posts on FAQs from customers.   All alerts are ...

66 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you