You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I can't find a way in the yaml spec reference to checkout a specific branch of a (linked) repository. Creating an extra linked repository for each branch isn't a clean solution in my opinion.
Does anyone know about this?
We ran into a similar problem, where we wanted to checkout specific tags or branches of dependencies, depending on the versions used in the main project that is being tested.
I did find a solution, but it is not exactly "clean" - in fact it is really complicated given the simplicity of what I wanted to achieve.
At the start of the build I defined a task, which parses the version of the dependency from the main build and exposes it as a "result variable". In our case they are all maven projects, so we use the Maven Pom Value Extractor plugin for this part.
Then I have defined stages to build each of dependencies. The first task in each of these stages uses a Script task to manually checkout the correct tag / branch of the dependency.
We use java specs so I don't have yaml version to hand, but the basic format is like this:
Stage 1 : Check dependency versions
Stage 2: Build dependency x
...More stages for other dependencies
Final Stage:
- Build main product we want to test.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, forgot to actually answer the question:
First we have a checkout task, which checks out the dependencies master branch.
Then, we have a script task with contents similar to below:
#!/bin/bash -x
EXPECTED="${bamboo_variable_for_target_branch}"
git branch -a
git checkout $EXPECTED
CURRENT=`git rev-parse --abbrev-ref HEAD`
if [ "$CURRENT" == "$EXPECTED"];
then
echo "Now on branch $CURRENT"
exit 0
fi
echo "On branch $CURRENT, either $EXPECTED does not exist or repo cache outdated
Notes:
- We had to select the option: "Fetch Whole Repository" on each linked repo
- We had to make sure to checkout each dependency into it's own working directory (and set the script task's working directory to match the dependency in question
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try sth. like this (requires Bamboo 6.10 or later)
version: 2
plan:
project-key: PRJ
key: PLAN
name: Plan name
master-branch: branchX
stages:
- Default stage:
- Default job
Default job:
tasks: []
triggers: []
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i need it for another repository which will be checked out, not the main repository.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm happy to announce that Bamboo 7.2 has been released and it’s overflowing with awesome new features. This will be the last major Server release before the launch of Bamboo DC. Bamboo logs We...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.