-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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!)