D.J.
D.J.

Reputation: 4034

VSTS-Build (git): tag source code at the end of the build

I have the following problem:

a builddefinition requires that the sourcecode in the repository is tagged, the tag that should be used looks like this: "$(build.major).$(build.minor).$(build.ticker)"

the first 2 variables can are variables that are set when queuing, the third one is calculated during the buildprocess. Because of it beeing calculated during the build, i can not use the configurable option from VSTS to tag my build. VSTS won't resolve this variable and i end up with tags like "1.2.$(build.ticker)"

Is there any other way to tag my source code at the end of the build ?

Upvotes: 0

Views: 431

Answers (2)

D.J.
D.J.

Reputation: 4034

The timeout is a popup authentication prompt. You can't just call "git push origin --tags", you'll additionally need to provide authentication. The solution will be dependent on where you are getting your sources from. If you are "git push" in a poweshell script try this (Also you'll need to enable the option "Allow scripts to access OAuth token") git -c http.extraheader="AUTHORIZATION: bearer $Env:SYSTEM_ACCESSTOKEN" push origin --tags

Answer by @raterus, he didn't post it as answer so i am going to post it and mark this as accepted.

Upvotes: 0

raterus
raterus

Reputation: 2089

Since you are using Git, I would recommend using the GitVersion task , it will do semantic versioning of your builds automatically. There is no reason to roll out your own solution.

You may want to look at Mainline mode (a newer feature), this will increment the "build ticker" for you on each commit.

Upvotes: 1

Related Questions