-
Notifications
You must be signed in to change notification settings - Fork 63
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
Base build name off the source branch #58
Conversation
f7bcc5d
to
ef6c987
Compare
UpdateBuildNumber: Override the automatically generated build number
UsageYou can automatically generate a build number from tokens you specify in the pipeline options. However, if you want to use your own logic to set the build number, then you can use this logging command. Example
(I'm not sure if there is a way to add something programmatic in place of "my-new-build-number".) |
@derrickstolee thanks! I talked that over with a couple of pipelines PMs and that seems to be the way to go. But before I go hacking a bunch of stuff up, can you take a look at the proposal in #59 and let me know your thoughts on the versioning? |
8e5cda1
to
768e88e
Compare
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.
@@ -44,6 +42,8 @@ jobs: | |||
pool: | |||
name: 'Hosted macOS' | |||
steps: | |||
- powershell: $(Build.Repository.LocalPath)/Scripts/CI/Set-Version.ps1 -SourceBranchCounter $(branchCounter) |
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.
For my own understanding, how are we able to run powershell scripts in the Hosted macOS pool?
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.
powershell core! :)
$Major = $Matches["Year"] | ||
$Minor = $Matches["Month"] | ||
$Revision = $Matches["Milestone"] | ||
Set-BuildNumber "Release-$Major.$Minor.$Revision.$SourceBranchCounter" |
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.
Related to my question in #59, if someone kicks off a manual build what's the scenario where we could get duplicate versions? If they are using the CI pipeline would $SourceBranchCounter have a new value for the manual build?
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.
[command]/usr/local/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/Users/vsts/agent/2.155.1/work/_temp/0f87ef36-c4d0-4107-91ce-7e65799aa4c4.ps1'
Looks like we have PowerShell Core on the build agents.
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.
Cool thanks!
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.
@wilbaker The scenario for duplicate versions is related to how I'm using counter
to generate the patch version. counter
produces monotonically increasing integers for each seed. Because I'm using the branch name as the seed, each branch name will start at zero. master
starts at zero and every master CI is incremented by one. Same with features/foo
So the scenario for a dupe build number is, on a single day, two manually-run CIs are kicked off for two different new-ish branches, we can collide.
I think it's not terribly important but I held the merge to get extra feedback on that quirk of the numbering scheme and to try to break it.
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.
for two different new-ish branches, we can collide.
Ahh that makes sense, thanks!
I think it's not terribly important but I held the merge to get extra feedback on that quirk of the numbering scheme and to try to break it.
Yeah I don't think it's a big deal either, we should never be shipping any builds with colliding version numbers. Our local dev builds always collide and we've not had problems from that in the past.
Resolves #59