Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added gitversion4 (beta) support as well as MR which sets TeamCity build counter as build number #132

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vyruz1986
Copy link

The existing MR for GitVersion will set the FullSemVer variable as build number in Teamcity, this variable is purely based on the repository and does not take into account the build counter kept by Teamcity.
While in some situations (as described by @RobSmyth in GitTools/GitVersion#1367) this information is considered important or even critical.

At the moment Chocolately does not seem to offer a good way to say 'I want version 4.x, included beta- or pre-releases', so I've just had to pass the --pre parameter to the choco install call in these runners, this will result in the next beta release being installed (5.x?) as soon as GitVersion 4.0 is released in production.

…e latest 4.0 beta built (this probably will need to be changed in the future).
…ons json output and manually echo ##teamcity[setparameter messages back to stdout.

This allows this runner to disable the built-in and not-configurable setting of build.number by GitVersion. The MR then outputs ##teamcity[buildnumer '<SemVer>+build%build.counter%'] to stdout which will set the build number in Teamcity to the SemVer + buildNN where nn is the build counter kept by Teamcity
@vyruz1986
Copy link
Author

vyruz1986 commented Oct 23, 2018

Just an update on this, I made this MR so that the build metadata is passed as +buildNN where NN is Teamcity's internal build counter. This is in line with SemVer 2.0.0 (item 10). However, due to a bug in teamcity, the plus sign in the artifact path, is causing the download of such artifacts to fail. I've temporarily replaced the plus with an underscore (thus deviating from the SemVer spec), but I didn't want to update my sources for this pull request since it's really the TC bug which should be fixed.

$semVer variable was not correctly escaped
Since v4 is released we don't need to pass --pre anymore
Copy link

@dampee dampee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one small change needed.

}

Write-Host "##teamcity[progressMessage 'Running: $gitversion $safeArgs']"
$gvOutput = Invoke-Expression "gitversion $arguments" | Out-String
Copy link

@dampee dampee Apr 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gitversion here should be $gitversion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, thanks for noticing!
I've corrected it with another commit.

Previously gitversion was invoked reliant on it being in the PATH. This is now changed to the path
constructed by the previous part of this script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants