Share java spec commit id with generated build plan

Erwin K_ August 1, 2022

I have a configuration of a repository with a java build spec and multiple other repositories with source code. The build specs generate similar build plans for each repo.

I want to have traceability between the build results of each repo and the version (e.g. the commit id) of the build spec used to create the build plan.
How to realize this traceability?

I was thinking of setting a plan property when the buildspec is run, but how to retrieve its commit id?

Another starting point would be to somehow add a build step, querying the last successful build of the java spec.

1 answer

1 accepted

1 vote
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2022

Hello @Erwin K_, welcome to Atlassian Community!

You can use the bamboo.planRepository.<position>.revision variable to retrieve the revision id for that commit. The <position> starts on 0 and depends on how your Specs repository is ordered on the Plan.

To automate that, you can script something that would scan all environment variables named bamboo.planRepository.<position>.<name>, where <name> is your Specs repository, then strip the <position> from it and reuse it as the <position> on bamboo.planRepository.<position>.<revision>.

Optional: Once you have the revision you can create a text file with the variable=value format and reuse it across multiple Jobs if required:

 

Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

Erwin K_ August 2, 2022

Thanks this has been useful!
Previously I only had the code repo linked to the plan. By adding the specs repo to the plan as well, it can be accessed to retrieve the last commit.

Like Eduardo Alvarenga likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events