I am trying to set up build with parameter, this parameter using in few build steps, it describes Jira ticket number, and comes from Jira.
Now the problem is I need to improve this build to checkout branch with this ticket number or if I don't have branch with such name - run build on master branch.
I can't use Changes tab as its fully automated process.
Also I can't use git commands in build step.
Is it possible to take in build step the list of all branches from VCS and setup checkout branch in build step's script ?
used TeamCity version 9.1.1. Thank you and have a nice day.
Solution using git:
- Set up in dependent job checkout rules to checkout on agent
Add build step in dependent build:
#!/usr/bin/env bash test_branch=`git branch -a | tr -d "remotes/origin/" | grep %default_branch%` if [ -z "$test_branch" ]; then test_branch="master" echo "Switching to branch: " $test_branch ruby -e "puts \"##teamcity[setParameter name='default_branch' value='$test_branch']\"" else echo "Switching to branch: " $test_branch ruby -e "puts \"##teamcity[setParameter name='default_branch' value='%default_branch%']\"" fi
I'm looking for TC functionality which allow me to avoid using git. Just to check do we have such branch in +:refs/heads/*
.