Team city agent which is currently performing the build does not have 'git' installed its a linux box. I cannot have git installed there.
Is there a native method in teamcity which can support the below in build step :
git checkout -b %dynamicversion%
Inside the VCS Root settings, you can set the Branch Specification.
The Branch Specification will allow you to run a specific branch (ie: +:feature/*
)
Then a combo box will appear on the top of your project, in order to select your project.
If the branch to build depends of something in your code, you can do multiple configurations, with dependencies, and triggering using API.
Build 1
Build on <default>
where you get the branch to run.
API Call on teamcity which will call Build 2 with the parameter branch
set to the specified value:
# RunSpecificBranch.ps1
# PowerShell: Run Build Configuration on a specific branch
Param(
[Parameter(Mandatory=$true)][string]$branchName,
[Parameter(Mandatory=$true)][string]$BuildToRun
)
Begin
{
$TCUrl = "http://<teamcityURL>/httpAuth/app/rest/buildQueue"
Execute-HTTPPostCommand $TCUrl "<build branchName=""$branchName""><buildType id=""$buildToRun""/></build>"
}
And Execute this script like: RunSpecificBranch.ps1 -branchName: feature/ME/AwesomeFeature -buildToRun: Project_SubProject_SpecificBuildOnBranch
inside your build Step.
The checkout of the branch will be done by the server before running the build configuration Project_SubProject_SpecificBuildOnBranch
Build 2
Specified to run on multiple branches as specified bellow, you will do here your custom logic that you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With