Teamcity executes GIT Checkout

The agent of the city team, which is currently building, does not have git, has installed its Linux module. I can not install git there.

Is there a built-in method in teamcity that can support below in the build step:

git checkout -b %dynamicversion% 
+6
source share
2 answers

In RoC VCS settings you can set the specification of the branch. The Branch specification allows you to run a specific branch (for example: +:feature/* )

Then, a combo box will appear at the top of your project to select your project.

If the build branch depends on something in your code, you can perform several configurations, with dependencies, and run using the API.

Line 1

Set to <default> where you will run the branch. API A call to the teamcity command, which will call Build 2 with the branch parameter 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 run this script like: RunSpecificBranch.ps1 -branchName: feature/ME/AwesomeFeature -buildToRun: Project_SubProject_SpecificBuildOnBranch inside your build step.

Verification of the branch will be performed by the server before starting the assembly configuration Project_SubProject_SpecificBuildOnBranch

Line 2

Specified to work in several branches, as indicated below, you will make your own logic here.

+1
source

Answer your question. You must make sure the git package is installed in the linux field, to do this, you can do the following.

I assume that you are using tracks in the City agent of the city to run Linux.

If you use a makefile or script, you can add a target, which is a call to prepare-dev or "anymeanfulful_name", in which you can try installing the git package as necessary.

 git checkout -b %dynamicversion% 

As I understand it, you want to check the last branch with the buildversion tag.

You can create the ts.native.ini file by adding the dependecy package,

 suite: precise mirror: http://xx.archive.ubuntu.com/ubuntu components: main restricted universe packages: mtools devscripts gcc make git libgnutls28-dev libboost-test-dev sudo e2fsprogs prepare: make prepare-dev preparefiles: Makefile 

After that you can add a target. You can use it in your script.

 #!/bin/sh set -e if [ "$(whoami)" != "root" ]; then echo "Please run as root" exit 1 fi git clean -xfd trap "$TRACKS -u" EXIT _mkdebs() { export TRACKS_INIFILE=ts.trusty(native).ini $TRACKS -b -- make mkdebs CCACHE_DIR=$CCACHE_DIR } 

You can add the ts.native.ini track file to your teamcity agent so that it installs all the necessary prerequisites.

0
source

Source: https://habr.com/ru/post/1015379/


All Articles