Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teamcity perform GIT Checkout

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%
like image 459
Sudheej Avatar asked Nov 08 '22 01:11

Sudheej


1 Answers

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://&lt;teamcityURL&gt;/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.

like image 165
Didier Aupest Avatar answered Nov 15 '22 04:11

Didier Aupest