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

Build frequently fails on second build for PR (clean up build-numbering strategy) #56

Open
reisenberger opened this issue Dec 3, 2019 · 1 comment
Labels

Comments

@reisenberger
Copy link
Member

A PR typically builds twice - for the branch and then the PR. The second build often fails with:

========================================
__UpdateAppVeyorBuildNumber
========================================
Executing task: __UpdateAppVeyorBuildNumber
Build with specified version already exists.

The cake build script intends to set the build number from the git metadata FullSemVer and clearly this repeats for the second build.

The following range of git metadata is typically available via the GitVersion tool used by the build (obtained by running GitVersion.exe in the repository root):

{
  "Major":0,
  "Minor":2,
  "Patch":1,
  "PreReleaseTag":"reisenberger-optionsSyntaxNamespace.1",
  "PreReleaseTagWithDash":"-reisenberger-optionsSyntaxNamespace.1",
  "PreReleaseLabel":"reisenberger-optionsSyntaxNamespace",
  "PreReleaseNumber":1,
  "BuildMetaData":14,
  "BuildMetaDataPadded":"0014",
  "FullBuildMetaData":"14.Branch.reisenberger-optionsSyntaxNamespace.Sha.7741373763fbb2a63c08229c6ccb5db99257e2b0",
  "MajorMinorPatch":"0.2.1",
  "SemVer":"0.2.1-reisenberger-optionsSyntaxNamespace.1",
  "LegacySemVer":"0.2.1-reisenberger-option1",
  "LegacySemVerPadded":"0.2.1-reisenberger-opt0001",
  "AssemblySemVer":"0.2.1.0",
  "AssemblySemFileVer":"0.2.1.0",
  "FullSemVer":"0.2.1-reisenberger-optionsSyntaxNamespace.1+14",
  "InformationalVersion":"0.2.1-reisenberger-optionsSyntaxNamespace.1+14.Branch.reisenberger-optionsSyntaxNamespace.Sha.7741373763fbb2a63c08229c6ccb5db99257e2b0",
  "BranchName":"reisenberger-optionsSyntaxNamespace",
  "Sha":"7741373763fbb2a63c08229c6ccb5db99257e2b0",
  "ShortSha":7741373,
  "NuGetVersionV2":"0.2.1-reisenberger-opt0001",
  "NuGetVersion":"0.2.1-reisenberger-opt0001",
  "NuGetPreReleaseTagV2":"reisenberger-opt0001",
  "NuGetPreReleaseTag":"reisenberger-opt0001",
  "CommitsSinceVersionSource":14,
  "CommitsSinceVersionSourcePadded":"0014",
  "CommitDate":"2019-11-30"
}

Suggested resolution

Change that line in the build script to use a more specific metadata like InformationalVersion (if not too long for AppVeyor)

  • The two builds of the PR do have different SHAs - one for the head-of-the-branch commit, one for the merge-commit; confirmed by the event metadata in AppVeyor. So this should provide distinct build numbers.

However, when we deploy releases directly out of AppVeyor, that "Appveyor build number" may also be tagged to the commit and be used as the release number (think that's the case). And InformationalVersion seems overkill for releases ...

So we possibly want something like:

appveyorBuildNumber = gitVersionOutput["BranchName"].ToString() == "master" ? gitVersionOutput["FullSemVer"].ToString() : gitVersionOutput["InformationalVersion"].ToString();

(A suggestion ... open to anyone refining this!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant