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

Base build name off the source branch #58

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

jrbriggs
Copy link
Member

@jrbriggs jrbriggs commented Aug 14, 2019

Resolves #59

@jrbriggs jrbriggs force-pushed the versions branch 7 times, most recently from f7bcc5d to ef6c987 Compare August 14, 2019 19:44
@derrickstolee
Copy link
Contributor

Maybe this will help?

UpdateBuildNumber: Override the automatically generated build number

##vso[build.updatebuildnumber]build number

Usage

You 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

##vso[build.updatebuildnumber]my-new-build-number

(I'm not sure if there is a way to add something programmatic in place of "my-new-build-number".)

@jrbriggs
Copy link
Member Author

@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?

@jrbriggs jrbriggs force-pushed the versions branch 2 times, most recently from 8e5cda1 to 768e88e Compare August 15, 2019 14:05
@jrbriggs jrbriggs marked this pull request as ready for review August 15, 2019 14:16
@jrbriggs jrbriggs requested review from wilbaker and derrickstolee and removed request for wilbaker August 15, 2019 14:25
Copy link
Contributor

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

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

I like this approach. Easier to update a powershell script than YAML.

Here is the artifact from this PR:
image

and here is the command-line:
image

@@ -44,6 +42,8 @@ jobs:
pool:
name: 'Hosted macOS'
steps:
- powershell: $(Build.Repository.LocalPath)/Scripts/CI/Set-Version.ps1 -SourceBranchCounter $(branchCounter)
Copy link
Member

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?

Copy link
Member Author

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"
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

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

Cool thanks!

Copy link
Member Author

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.

Copy link
Member

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.

@jrbriggs jrbriggs merged commit 58987f9 into microsoft:master Aug 15, 2019
@jrbriggs jrbriggs deleted the versions branch August 15, 2019 16:47
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.

Use a derivative of calver for scalar
3 participants