Is it possible to specify a repository without it being checked out?

My environment:

I have a build with multiple stages. Only the first stage requires the source repository (it does the build). After that artifacts are used to share the build output with the other stages.

My assumptions/understanding:

1. If a source repository is specified (i.e. Use Plan's Repository) then it will check out all the source.

2. Without a source repository the revision number variable isn't set (${bamboo.repository.revision.number})

My problem:

In my final stage I want to copy the artifact files to a folder that has the revision number in its name. However to use the revision number I seem to need to have the repository set, which then checks out the source, even though I don't need it.

My thoughts/questions:

Is there some way the revision is accessible across the whole plan?

Is it possible to specify a repository without it being checked out?

4 answers

1 accepted

I took the approach suggested by Renjith V [NSN], and after a bit of tinkering with powershell was able to use the contents of a file from stage 1 as arguments in stage 3.

I only need repository checked out for the first stage, but these tasks are in the third stage where they use the artifact generated by the first stage.

But without getting the repository checked out how are you able to get the artifact files, are they not dependent on the files coming from the source files?

You should be able to artifact in the first stage itself using the version number also and then in the third stage copy the artifact from 1st stage to 3rd stage. Feasible?

Oh! Guess that may not be directly possible, but I am not sure. A simple workaround will be to touch a file with the version number in stage 1, make that an artifact and pass that artifact to stage 3, and it will contain the version number.

This is what I am doing and it is working as far as making the artifacts available in stage 3.

However what I want to do in stage 3 is use the version number as a variable in a command task, and at the moment doing so results in dummyVcsKey. The reason I do this in stage 3 is I only want to run the command if the tests (stage 2) have succeeded.

You can't put it into a variable. But, if you use a script task instead of a command task, you can pretty easily read the artifact content into a script variable (well, at least on Unix) and pass it to a command you want to run.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,317 views 0 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you