-
Notifications
You must be signed in to change notification settings - Fork 654
Enable use of GitVersion variables in the VSO BuildNumber #689
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
Conversation
@@ -37,6 +37,12 @@ The VSO build step updates the build number automatically to the GitVersion numb | |||
GitVersion passes variables in the form of `GitVersion.*` (Eg: `GitVersion.Major`) to TFS Build and also writes `GITVERSION_*` (Eg: `GITVERSION_MAJOR`) environment variables that are available for any subsequent build step. | |||
See [Variables](/more-info/variables/) for an overview of available variables. | |||
|
|||
|
|||
#### Using GitVersion variables in build build name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo: build build
|
||
#### Using GitVersion variables in build build name | ||
To use GitVersion's variables in the build name, just add them in the form `$(GITVERSION_FullSemVer)` into the Build definition's build number string. Then just ensure GitVersion is called with | ||
`/output buildserver` and it will replace those variables with the calculated version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mentioning that the TFS Build task takes care of that (/output buildserver) might be helpful
[Test] | ||
public void Develop_branch() | ||
{ | ||
SetEnvironmentVariableForTest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to call SetEnvironmentVariableForTest in a Setup method (since they are also around all the time in the build server)?
To use GitVersion's variables in the build name, just add them in the form `$(GITVERSION_FullSemVer)` into the Build definition's build number string. Then just ensure GitVersion is called with | ||
`/output buildserver` and it will replace those variables with the calculated version. | ||
The TFS GitVersion Build Step (above) handles this too, so if you're already using that, there's nothing extra to configure. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note about how the $(rev:r) variable behaves might be useful, since it most probably wont to what the user expects. It increases every time as long as the version number expanded at build start is the same. Which is always true for the $(GITVERSION_*) variables.
@pascalberger i will leave this one to you |
merge when happy |
Enable use of GitVersion variables in the VSO BuildNumber
Thanks again @onovotny. Nice stuff. |
@JakeGinnivan What do you think where would be the best place to mention this change in behavior of the TFS task? Somewhere in the release notes or the breaking changes document? Should we also do for 3.2 |
Thank! Any chance of getting a 3.2.1 release out today with this? It'd also help narrow the gap of ppl discovering/using the 3.2.0 behavior. |
+1 for a quick release. #687 might also be ready for merging and be included in this release. @JakeGinnivan What do you think? |
Will do it this morning, was busy yesterday and was out last night. Sent from my Windows Phone From: Pascal Bergermailto:[email protected] +1 for a quick release. #687#687 might also be ready for merging and be included in this release. @JakeGinnivanhttps://github.com/JakeGinnivan What do you think? — |
@JakeGinnivan how's this looking for a build? :) |
Today, had a busy week :) Sent from my Windows Phone From: Oren Novotnymailto:[email protected] @JakeGinnivanhttps://github.com/JakeGinnivan how's this looking for a build? :) — |
🍻 |
I'm finding some inconsistent behavior with this functionality today. In almost every other instance, the use of the underscore in VSO-PowerShell variable syntax ( Over and above this issue of platform consistency (ie: dot vs underscore syntax), |
As discussed in #663, this lets the VSO BuildNumber control placement and use of the GitVersion variables in the build number.
Just put $(GitVersion_Foo) wherever you want in the VSO build number and the agent task will replace that with the actual version.