gittools / gitversion Goto Github PK
View Code? Open in Web Editor NEWFrom git log to SemVer in no time
Home Page: https://gitversion.net/docs/
License: MIT License
From git log to SemVer in no time
Home Page: https://gitversion.net/docs/
License: MIT License
If we are releasing an assembly as beta for the first time ever, the assembly version should not be v1.0.0.0.
So we want to be able to support creating a branch called release-0.2.0
with a tag of 1.0.0-Beta2
.
and this should produce:
@SimonCropp @andreasohlund,
I think we need this fixed for SC release.
At the moment we can't figure out the branchname (name of the pull) from the git info so we have to add a build param to each build:
https://github.com/Particular/GitFlowVersion/blob/master/GitFlowVersion/TeamCity.cs#L20
This is a maintenance pain!
@nulltoken any ideas on how we can solve this? (doesn't seem like the git directory on the buildagent contains this info even though TC seems to capture it ok)
This is the ex from LibGit2Sharp we get
[src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj] UpdateAssemblyInfo
[08:23:27][UpdateAssemblyInfo] GitFlowVersionTask.UpdateAssemblyInfo
[08:23:27][GitFlowVersionTask.UpdateAssemblyInfo] Version not in cache. Calculating version.
[08:23:27]
[GitFlowVersionTask.UpdateAssemblyInfo] Error occurred: LibGit2Sharp.InvalidSpecificationException: An error was raised by libgit2. Category = Reference (InvalidSpecification).
The given reference name '(no branch)' is not valid
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_reference_lookup(RepositorySafeHandle repo, String name, Boolean shouldThrowIfNotFound)
at LibGit2Sharp.ReflogCollection.GetEnumerator()
at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
at GitFlowVersion.FeatureVersionFinder.FindFirstCommitOnBranch() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\FeatureVersionFinder.cs:line 61
at GitFlowVersion.FeatureVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\FeatureVersionFinder.cs:line 21
at GitFlowVersion.GitFlowVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\GitFlowVersionFinder.cs:line 69
at GitFlowVersion.VersionForRepositoryFinder.GetVersion(Repository repository) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionForDirectoryFinder.cs:line 18
at GitFlowVersion.VersionCache.GetVersion(String gitDirectory) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionCache.cs:line 39
at GitFlowVersionTask.UpdateAssemblyInfo.Execute() in c:\Code\Particular\GitFlowVersion\GitFlowVersionTask\UpdateAssemblyInfo.cs:line 57
[08:23:27][src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj] Project src\NServiceBus.RabbitMQ\NServiceBus.Transports.RabbitMQ.csproj failed.
[08:23:27][src\NServiceBus.RabbitMQ.sln] Project src\NServiceBus.RabbitMQ.sln failed.
[08:23:27][src\NServiceBus.RabbitMQ.sln.teamcity] Project src\NServiceBus.RabbitMQ.sln.teamcity failed.
Full build log:
The following scenario
We have
[master] 1.1
[develop] 1.2 unstable-XX
[release-1.2]
if we do a commit on the release branch the commit number is successfully incremented. If we merge the release branch into develop to get that commit the release counter is resetted to 0000.
But the gitflow states that merging is allowed. Current workaround is to cherry pick the commit from the release branch.
Here the reprop picture for the successful cherry pick:
This produces:
{
"Major":1,
"Minor":2,
"Patch":0,
"PreReleasePartOne":0,
"PreReleasePartTwo":4,
"Stability":"Beta",
"Suffix":"",
"LongVersion":"1.2.0-beta0.4 Branch:'release-1.2' Sha:'0068b55c96617d54beddcd4
0c9bfae0d0ce1d5a7'",
"NugetVersion":"1.2.0-Beta0000-0004",
"ShortVersion":"1.2.0-beta0.4",
"BranchName":"release-1.2",
"BranchType":"Release",
"Sha":"0068b55c96617d54beddcd40c9bfae0d0ce1d5a7"
}
Here the flow which should work but doesn't
Produces:
{
"Major":1,
"Minor":2,
"Patch":0,
"PreReleasePartOne":0,
"Stability":"Beta",
"Suffix":"",
"LongVersion":"1.2.0-beta0 Branch:'release-1.2' Sha:'0068b55c96617d54beddcd40c
9bfae0d0ce1d5a7'",
"NugetVersion":"1.2.0-Beta0000",
"ShortVersion":"1.2.0-beta0",
"BranchName":"release-1.2",
"BranchType":"Release",
"Sha":"0068b55c96617d54beddcd40c9bfae0d0ce1d5a7"
}
[Test]
public void Does_not_consider_version_of_unstable_tags_with_a_non_parsable_merge_comit_message()
{
var finder = new VersionOnMasterFinder();
var commit = new MockMergeCommit
{
MessageEx = "A merge commit without a branch name",
CommitterEx = 1.Seconds().Ago().ToSignature()
};
var version = finder.Execute(new GitVersionContext
{
Repository = new MockRepository
{
Branches = new MockBranchCollection
{
new MockBranch("master")
{
commit,
new MockMergeCommit
{
MessageEx = "Merge branch 'hotfix-0.2.0'",
CommitterEx = 2.Seconds().Ago().ToSignature()
},
},
},
Tags = new MockTagCollection
{
new MockTag
{
NameEx = "0.3.0-alpha1",
TargetEx = commit
}
}
}
}, 1.Seconds().Ago());
Assert.AreEqual(0, version.Major);
Assert.AreEqual(2, version.Minor);
}
[Test]
public void Does_not_consider_commit_pointed_at_by_a_tag_with_an_unstable_version()
{
var finder = new VersionOnMasterFinder();
var commit = new MockMergeCommit
{
MessageEx = "Merge branch 'hotfix-0.3.0'",
CommitterEx = 1.Seconds().Ago().ToSignature()
};
var version = finder.Execute(new GitVersionContext
{
Repository = new MockRepository
{
Branches = new MockBranchCollection
{
new MockBranch("master")
{
commit,
new MockMergeCommit
{
MessageEx = "Merge branch 'hotfix-0.2.0'",
CommitterEx = 2.Seconds().Ago().ToSignature()
},
},
},
Tags = new MockTagCollection
{
new MockTag
{
NameEx = "0.3.0-alpha1",
TargetEx = commit
}
}
}
}, 1.Seconds().Ago());
Assert.AreEqual(0, version.Major);
Assert.AreEqual(2, version.Minor);
}
[Test]
public void Does_not_consider_merge_messages_with_unstable_part()
{
var finder = new VersionOnMasterFinder();
var version = finder.Execute(new GitVersionContext
{
Repository = new MockRepository
{
Branches = new MockBranchCollection
{
new MockBranch("master")
{
new MockMergeCommit
{
MessageEx = "Merge branch 'hotfix-0.3.0-alpha1'",
CommitterEx = 1.Seconds().Ago().ToSignature()
},
new MockMergeCommit
{
MessageEx = "Merge branch 'hotfix-0.2.0'",
CommitterEx = 2.Seconds().Ago().ToSignature()
},
},
},
}
}, 1.Seconds().Ago());
Assert.AreEqual(0, version.Major);
Assert.AreEqual(2, version.Minor);
}
Current output:
Test 'VersionOnMasterFinderTests.Does_not_consider_merge_messages_with_unstable_part' failed:
Expected: 2
But was: 3
VersionOnMasterFinderTests.cs(155,0): at VersionOnMasterFinderTests.Does_not_consider_merge_messages_with_unstable_part()
Test 'VersionOnMasterFinderTests.Does_not_consider_version_of_unstable_tags_with_a_non_parsable_merge_comit_message' failed:
Expected: 2
But was: 3
VersionOnMasterFinderTests.cs(83,0): at VersionOnMasterFinderTests.Does_not_consider_version_of_unstable_tags_with_a_non_parsable_merge_comit_message()
Test 'VersionOnMasterFinderTests.Does_not_consider_version_of_unstable_tags_with_a_parsable_merge_comit_message' failed:
Expected: 2
But was: 3
VersionOnMasterFinderTests.cs(124,0): at VersionOnMasterFinderTests.Does_not_consider_version_of_unstable_tags_with_a_parsable_merge_comit_message()
no need to do it on every build of every project
This is the pull that caused the failure:
I suspect either the "-" in the branch name or the [WIP] in the pull name
Error:
[GitFlowVersionTask.UpdateAssemblyInfo] Couldn't find any remote tips from remote 'https://github.com/Particular/ServiceControl.git' pointing at the commit 'd547e6ec599300e99db21c03529b8a756b95beea'.
Full log:
http://builds.particular.net/viewLog.html?buildId=36543&buildTypeId=bt31&tab=buildLog
Version 3.7 is not recognized as a good major version. If 3.7 is used as a tag, default to 3.7.0.
Currently, when GitFlowVersionFinder.FindVersion() hasn't been able to detect which kind of branch the HEAD points to, it defaults to FeatureVersionFinder.FindVersion().
We should throw an exception instead
It is more an information/question type issue. I'm not sure what the default behavior should be. I ran into troubles that the master wasn't checked out by GFV automatically when I didn't build the solution but each csproj with msbuild. I'm maintaining an open source project which had the following in the scripts:
*/.csproj -> msbuild
I then had to add the following script to get it working properly;
rm * -recurse -force
. git clone https://github.com/repo.git .
write-host %teamcity.build.branch%
. git fetch --all
$remoteBranches = . git branch -r
foreach ($remoteBranch in $remoteBranches) {
. git checkout $remoteBranch.Trim().Replace("origin/", "") 2>&1 | write-host
}
write-host $env:teamcity.build.branch
. git checkout %teamcity.build.branch% 2>&1 | write-host
exit 0
I know switched to solution based building so the issue is no longer relevant for me.
I use Continua CI instead of teamcity. I don't want to have arguments about the "best" system, just want to verify:
will it be possible to support other systems than TC or is this mainly focused on TC?
When using multiple build agents the master branch will either not exist or not be up to date. This causes version numbers to be wrong.
instead of TreeWalkForGitDir
thanks @nulltoken
In https://github.com/Particular/GitFlowVersion#release-branches (pasted below for convenience) it states that the beta numbering is done by counting the # of commits.
pre-release: beta{n} where n = 1 + the number of commits on branch. The +1 is so that when the branch is initially created (with 0 commits) the pre-release string will be beta1
I'm not sure I totally agree with this convention.
The problem I see is that, we put fixes (while stabilising the release) into the release branch and this causes that number to go up.
What this means is that by the time we are actually ready to release to the public a Beta release our release branch could be v4.1.0-Beta20 (if 20 commits have been added to it as part of stabilising the release), even thought we haven;t publicly release any Beta yet!
Thoughts?
When I follow this sequence I noticed that the version was showing a short version of beta:
New-Item VersionTest -ItemType Directory
Set-Location C:\Projects\VersionTest
git init
GitFlowVersion.exe
No Tip found. Has repo been initialize?
Add-Content Readme.txt "Initial Commit"
git add .
git commit -m "Initial commit"
GitFlowVersion.exe
This repository doesn't contain a branch named 'develop'. Please create one. Existing branches: 'refs/heads/master'
git flow init -d
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable1 Branch:'develop' Sha:'c6eeb686f75bd7581b302d40f88ea54b157dde47'",
"NugetVersion":"0.2.0-Unstable0001",
"ShortVersion":"0.2.0-unstable1",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"c6eeb686f75bd7581b302d40f88ea54b157dde47"
}
git flow feature start 1
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable.feature-c6eeb686 Branch:'feature/1' Sha:'c6eeb686f75bd7581b302d40f88ea54b157dde47'",
"NugetVersion":"0.2.0-Feature-feature/1-c6eeb686f75bd7581b302d40f88ea54b157dde47",
"ShortVersion":"0.2.0-unstable.feature-c6eeb686",
"BranchName":"feature/1",
"BranchType":"Feature",
"Sha":"c6eeb686f75bd7581b302d40f88ea54b157dde47"
}
Add-Content .\Readme.txt "Feature 1"
git commit -a -m "Feature 1 work"
git flow feature start 2
Add-Content .\Readme.txt "Feature 2"
git commit -a -m "Feature 2 work"
C:\Chocolatey\lib\GitFlowVersion.0.14.0\Tools\GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"c6eeb686",
"LongVersion":"0.2.0-unstable.feature-cbf98521 Branch:'feature/2' Sha:'cbf98521d19692f65bc925ac09cbfd6fdb1766e2'",
"NugetVersion":"0.2.0-Feature-feature/2-cbf98521d19692f65bc925ac09cbfd6fdb1766e2",
"ShortVersion":"0.2.0-unstable.feature-cbf98521",
"BranchName":"feature/2",
"BranchType":"Feature",
"Sha":"cbf98521d19692f65bc925ac09cbfd6fdb1766e2"
}
git checkout feature/1
git flow feature finish
C:\Chocolatey\lib\GitFlowVersion.0.14.0\Tools\GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable2 Branch:'develop' Sha:'241a399362e737e8a490f6c86f9bcb66fd5b4c6d'",
"NugetVersion":"0.2.0-Unstable0002",
"ShortVersion":"0.2.0-unstable2",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"241a399362e737e8a490f6c86f9bcb66fd5b4c6d"
}
git checkout feature/1
git merge develop
git commit -a -m "Merged up develop"
git flow feature finish
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable5 Branch:'develop' Sha:'10f163add698dd6baaa867e9d9f775cbb22e5a15'",
"NugetVersion":"0.2.0-Unstable0005",
"ShortVersion":"0.2.0-unstable5",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"10f163add698dd6baaa867e9d9f775cbb22e5a15"
}
git flow release start 1.0.0
git tag "1.0.0-alpha1"
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"Stability":"Alpha",
"Suffix":"",
"LongVersion":"1.0.0-alpha1 Branch:'release/1.0.0' Sha:'10f163add698dd6baaa867e9d9f775cbb22e5a15'",
"NugetVersion":"1.0.0-Alpha0001",
"ShortVersion":"1.0.0-beta1",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"10f163add698dd6baaa867e9d9f775cbb22e5a15"
}
Add-Content .\readme.txt "Alpha fixes"
git commit -a -m "Checking in alpha fixes"
git tag "1.0.0-beta1"
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"PreReleasePartOne":1,
"PreReleasePartTwo":1,
"Stability":"Beta",
"Suffix":"",
"LongVersion":"1.0.0-beta1.1 Branch:'release/1.0.0' Sha:'d8b57e7e6dd7d7314ef627dbfe928f6cee74fe4b'",
"NugetVersion":"1.0.0-Beta0001-0001",
"ShortVersion":"1.0.0-beta1.1",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"d8b57e7e6dd7d7314ef627dbfe928f6cee74fe4b"
}
The docs explain perfectly what problem this tool needs to solve. However, it does not explain how to actually use this tool.
Do I need to use it in every project, or just on a single project?
Another aspect is that stamping the assemblies is a single step. We also use the versioning as a display besides the assembly info. I saw that an exe is available, but the Program was empty. It would be very cool if one could use a command line tool to determine the version (though I am not sure how one would return the string value back from a console app).
In TeamCity nuget gives my package the wrong version 1.1.0-Unstable2
it should have been 1.1.0-Unstable0002
TeamCity build log output
[12:46:26]Checking for changes
[12:46:27]Publishing internal artifacts
[12:46:27][Publishing internal artifacts] Sending build.start.properties.gz file
[12:46:27]Clearing temporary directory: D:\BuildAgent3\temp\buildTmp
[12:46:27]Checkout directory: D:\BuildAgent3\work\81eeb890988465a3
[12:46:27]Updating sources: agent side checkout (5s)
[12:46:28][Updating sources] VCS Root: [email protected]:comperio/git-flow-test.git#refs/heads/master (5s)
[12:46:28][VCS Root: [email protected]:comperio/git-flow-test.git#refs/heads/master] revision: ff24a615e76ebe05b38cd015e3f6bb79f2bd6e13
[12:46:30][VCS Root: [email protected]:comperio/git-flow-test.git#refs/heads/master] Commit 'ff24a615e76ebe05b38cd015e3f6bb79f2bd6e13' is not found in repository. Running 'git fetch'...
[12:46:33][VCS Root: [email protected]:comperio/git-flow-test.git#refs/heads/master] Checking out branch refs/heads/develop in [email protected]:comperio/git-flow-test.git#refs/heads/master in D:\BuildAgent3\work\81eeb890988465a3 with revision ff24a615e76ebe05b38cd015e3f6bb79f2bd6e13
[12:46:33][VCS Root: [email protected]:comperio/git-flow-test.git#refs/heads/master] Cleaning [email protected]:comperio/git-flow-test.git#refs/heads/master in D:\BuildAgent3\work\81eeb890988465a3 the file set ALL_UNTRACKED
[12:46:33]Step 1/3: NuGet Installer
[12:46:33][Step 1/3] scan: Searching for nuget.config files
[12:46:33][scan] Found packages folder: D:\BuildAgent3\work\81eeb890988465a3\packages
[12:46:33][scan] Found list of packages.config files: D:\BuildAgent3\work\81eeb890988465a3\packages\repositories.config
[12:46:33][scan] Scanning projects in solution file: D:\BuildAgent3\work\81eeb890988465a3\git-flow-test.sln
[12:46:33][scan] Found project D:\BuildAgent3\work\81eeb890988465a3\git-flow-test\git-flow-test.csproj
[12:46:33][Step 1/3] install: Installing NuGet packages for git-flow-test\packages.config
[12:46:33][install] NuGet command: D:\BuildAgent3\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe install D:\BuildAgent3\work\81eeb890988465a3\git-flow-test\packages.config -OutputDirectory D:\BuildAgent3\work\81eeb890988465a3\packages -Source https://nuget.org/api/v2/ -Source https://comperio.myget.org/F/comperio/
[12:46:33][install] Starting: D:\BuildAgent3\temp\agentTmp\custom_script1691327164113908670.cmd
[12:46:33][install] in directory: D:\BuildAgent3\work\81eeb890988465a3\git-flow-test
[12:46:34][install] Restoring NuGet packages...
[12:46:34][install] To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
[12:46:34][install] Installing 'GitFlowVersionTask 0.4.0'.
[12:46:34][install] Successfully installed 'GitFlowVersionTask 0.4.0'.
[12:46:34][install] Process exited with code 0
[12:46:34]Step 2/3: Visual Studio (sln) (1s)
[12:46:34][Step 2/3] Starting: D:\BuildAgent3\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:D:\BuildAgent3\work\81eeb890988465a3 /msbuildPath:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
[12:46:34][Step 2/3] in directory: D:\BuildAgent3\work\81eeb890988465a3
[12:46:35][Step 2/3] git-flow-test\git-flow-test.csproj.teamcity: Build target: Rebuild
[12:46:35][git-flow-test\git-flow-test.csproj.teamcity] CoreClean
[12:46:35][CoreClean] MakeDir
[12:46:35][MakeDir] Creating directory "obj\Debug\".
[12:46:35][git-flow-test\git-flow-test.csproj.teamcity] PrepareForBuild
[12:46:35][PrepareForBuild] MakeDir
[12:46:35][MakeDir] Creating directory "bin\Debug\".
[12:46:35][git-flow-test\git-flow-test.csproj.teamcity] UpdateAssemblyInfo
[12:46:35][UpdateAssemblyInfo] GitFlowVersionTask.UpdateAssemblyInfo
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] Version not in cache. Calculating version.
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] Executing inside a TeamCity build agent
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[buildNumber '1.1.0-Unstable2']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.Major' value='1']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.Minor' value='1']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.Patch' value='0']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.Stability' value='Unstable']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.PreReleaseNumber' value='2']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.Version' value='1.1.0-Unstable2']
[12:46:36][GitFlowVersionTask.UpdateAssemblyInfo] ##teamcity[setParameter name='GitFlowVersion.NugetVersion' value='1.1.0-Unstable0002']
[12:46:36][UpdateAssemblyInfo] D:\BuildAgent3\temp\buildTmp\GitFlowVersionTask\AssemblyInfo_git-flow-test.csproj_zl3lniz5.aa3.cs
[12:46:36][UpdateAssemblyInfo] BeforeInjection Class1.cs;Properties\AssemblyInfo.cs;D:\BuildAgent3\temp\buildTmp\.NETFramework,Version=v4.5.AssemblyAttributes.cs
[12:46:36][UpdateAssemblyInfo] AfterInjection Class1.cs;Properties\AssemblyInfo.cs;D:\BuildAgent3\temp\buildTmp\.NETFramework,Version=v4.5.AssemblyAttributes.cs;D:\BuildAgent3\temp\buildTmp\GitFlowVersionTask\AssemblyInfo_git-flow-test.csproj_zl3lniz5.aa3.cs
[12:46:36][git-flow-test\git-flow-test.csproj.teamcity] CoreCompile
[12:46:36][CoreCompile] Csc
[12:46:36][Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\git-flow-test.dll /subsystemversion:6.00 /target:library /utf8output Class1.cs Properties\AssemblyInfo.cs "D:\BuildAgent3\temp\buildTmp\.NETFramework,Version=v4.5.AssemblyAttributes.cs" D:\BuildAgent3\temp\buildTmp\GitFlowVersionTask\AssemblyInfo_git-flow-test.csproj_zl3lniz5.aa3.cs
[12:46:36][git-flow-test\git-flow-test.csproj.teamcity] CopyFilesToOutputDirectory
[12:46:36][CopyFilesToOutputDirectory] Copy
[12:46:36][Copy] Copying file from "obj\Debug\git-flow-test.dll" to "bin\Debug\git-flow-test.dll".
[12:46:36][CopyFilesToOutputDirectory] git-flow-test.csproj -> D:\BuildAgent3\work\81eeb890988465a3\git-flow-test\bin\Debug\git-flow-test.dll
[12:46:36][CopyFilesToOutputDirectory] Copy
[12:46:36][Copy] Copying file from "obj\Debug\git-flow-test.pdb" to "bin\Debug\git-flow-test.pdb".
[12:46:36][Step 2/3] Process exited with code 0
[12:46:36]Step 3/3: NuGet Pack
[12:46:36][Step 3/3] Cleaning D:\BuildAgent3\work\81eeb890988465a3\nuget
[12:46:36][Step 3/3] pack: Create NuGet package from git-flow-test\git-flow-test.csproj
[12:46:36][pack] NuGet command: D:\BuildAgent3\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe pack D:\BuildAgent3\work\81eeb890988465a3\git-flow-test\git-flow-test.csproj -OutputDirectory D:\BuildAgent3\work\81eeb890988465a3\nuget -Verbose -Version 1.1.0-Unstable2 -Properties Configuration=Debug
[12:46:36][pack] Starting: D:\BuildAgent3\temp\agentTmp\custom_script3961411118637342281.cmd
[12:46:36][pack] in directory: D:\BuildAgent3\work\81eeb890988465a3\git-flow-test
[12:46:36][pack] WARNING: Option 'Verbose' has been deprecated. Use 'Verbosity' instead.
[12:46:36][pack] Attempting to build package from 'git-flow-test.csproj'.
[12:46:36][pack] Packing files from 'D:\BuildAgent3\work\81eeb890988465a3\git-flow-test\bin\Debug'.
[12:46:36][pack] Found packages.config. Using packages listed as dependencies
[12:46:36][pack] WARNING: Description was not specified. Using 'Description'.
[12:46:36][pack] WARNING: Author was not specified. Using 'tcadmin'.
[12:46:37][pack]
[12:46:37][pack] Id: git-flow-test
[12:46:37][pack] Version: 1.1.0-Unstable2
[12:46:37][pack] Authors: tcadmin
[12:46:37][pack] Description: Description
[12:46:37][pack] Dependencies: GitFlowVersionTask (= 0.4.0)
[12:46:37][pack]
[12:46:37][pack] Added file 'lib\net45\git-flow-test.dll'.
[12:46:37][pack]
[12:46:37][pack] Successfully created package 'D:\BuildAgent3\work\81eeb890988465a3\nuget\git-flow-test.1.1.0-Unstable2.nupkg'.
[12:46:37][pack] Process exited with code 0
[12:46:37]Publishing artifacts
[12:46:37][Publishing artifacts] Collecting files to publish: [D:\BuildAgent3\temp\buildTmp\nuget6917621943974049810packages\nuget.xml => .teamcity/nuget]
[12:46:37][Publishing artifacts] Sending D:/BuildAgent3/temp/buildTmp/nuget6917621943974049810packages/nuget.xml
[12:46:37]Publishing internal artifacts
[12:46:37][Publishing internal artifacts] Sending build.finish.properties.gz file
[12:46:37]Build finished
Can we get detection and output of TC data in the executable? PSAKE works well for us as a build script and it would be great to have it detect in the same way xunit console does. Today I use the following workaround
Properties {
$VersionCalculator = (Get-ChildItem -Path Packages -File "GitFlowVersion.exe" -Recurse).FullName
}
Task CalculateVersion -Description "Calculates the version information based on current location in source control repository" {
$RawVersionInfo = Exec { [string](& $VersionCalculator) }
$VersionInfo = ConvertFrom-Json $RawVersionInfo
TeamCity-SetBuildNumber $VersionInfo.ShortVersion
}
Steps:
Do a git clone using SSH to a brand new folder.
git clone [email protected]:Particular/NServiceBus.git
Then build the solution, either in Visual Studio or in powershell using the build script.
Notice these errors:
>------ Rebuild All started: Project: NServiceBus (NServiceBus\NServiceBus), Configuration: Debug Any CPU ------
2>------ Rebuild All started: Project: NServiceBus.PowerShell, Configuration: Debug Any CPU ------
3>------ Rebuild All started: Project: LicenseInstaller, Configuration: Debug Any CPU ------
3> Pepita (version 1.15.7.2) Executing
3> Cache path is C:\Users\Indu Alagarsamy\AppData\Local\NuGet\Cache
3> Using PackagesPath: C:\Users\Indu Alagarsamy\Projects\NServiceBus\Packages
3> Already exists so skipped C:\Users\Indu Alagarsamy\Projects\NServiceBus\Packages\Fody.1.16.2.0
3> Already exists so skipped C:\Users\Indu Alagarsamy\Projects\NServiceBus\Packages\GitFlowVersion.Fody.0.1.7
3> Finished (1ms)
3> Fody (version 1.16.2.0) Executing
3>MSBUILD : error : Fody: An unhandled exception occurred:
3>MSBUILD : error : Exception:
3>MSBUILD : error : An error was raised by libgit2. Category = Net (Error).
3>MSBUILD : error : This transport isn't implemented. Sorry
3>MSBUILD : error : Data :System.Collections.DictionaryEntry
3>MSBUILD : error : Data :System.Collections.DictionaryEntry
3>MSBUILD : error : StackTrace:
3>MSBUILD : error : at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in :line 0
3>MSBUILD : error : at LibGit2Sharp.Core.Proxy.git_remote_connect(RemoteSafeHandle remote, GitDirection direction) in :line 0
3>MSBUILD : error : at LibGit2Sharp.Network.Fetch(Remote remote, Nullable`1 tagFetchMode, ProgressHandler onProgress, CompletionHandler onCompletion, UpdateTipsHandler onUpdateTips, TransferProgressHandler onTransferProgress, Credentials credentials) in :line 0
3>MSBUILD : error : at GitFlowVersion.LibGitExtensions.GetBranch(Repository repository, String name) in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\LibGitExtensions.cs:line 127
3>MSBUILD : error : at GitFlowVersion.LibGitExtensions.GetMasterBranch(Repository repository) in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\LibGitExtensions.cs:line 148
3>MSBUILD : error : at GitFlowVersion.DevelopVersionFinder.GetSemanticVersion() in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\BranchFinders\DevelopVersionFinder.cs:line 28
3>MSBUILD : error : at GitFlowVersion.DevelopVersionFinder.FindVersion() in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\BranchFinders\DevelopVersionFinder.cs:line 14
3>MSBUILD : error : at GitFlowVersion.GitFlowVersionFinder.FindVersion() in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\GitFlowVersionFinder.cs:line 47
3>MSBUILD : error : at GitFlowVersion.VersionForRepositoryFinder.GetVersion(Repository repository) in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersion\VersionForDirectoryFinder.cs:line 18
3>MSBUILD : error : at ModuleWeaver.GetSemanticVersion(Repository repo) in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersionFody\ModuleWeaver.cs:line 124
3>MSBUILD : error : at ModuleWeaver.Execute() in y:\BuildAgent\work\5e0d79a4e3943b17\GitFlowVersionFody\ModuleWeaver.cs:line 51
3>MSBUILD : error : at lambda_method(Closure , Object )
3>MSBUILD : error : at InnerWeaver.ExecuteWeavers(List`1 weaverInstances) in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:line 92
3>MSBUILD : error : at InnerWeaver.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:line 33
3>MSBUILD : error : Source:
3>MSBUILD : error : GitFlowVersion.Fody
3>MSBUILD : error : TargetSite:
3>MSBUILD : error : Void HandleError(Int32)
3>MSBUILD : error :
3> Finished Fody 197ms.
Reason:
When I cloned, it cloned it to a develop branch. There was no master local branch.
Workaround:
Git checkout master - build
and then switch branch to develop and build.
Both master and develop local branches are necessary.
Gfv start-release
Gfv start-hotfix
Gfv release //works for both hf and r
We need a better way to apply versioning. I propose GitHubFlowVersion
Not with a Beta0 like we do today
(the git folder is included as an artifact)
This ServiceControl build
http://builds.particular.net/viewLog.html?buildId=35026&tab=buildResultsDiv&buildTypeId=bt31
Has a tag on the latest commit on the release-1.0.0 branch with the tag "1.0.0-Beta6".
The expected output would be a the version: 1.0.0-Beta6 but we get 1.0.0-Beta6.7
Related to this is that a previous build yielded the version 1.0.0
http://builds.particular.net/viewLog.html?buildId=35024&tab=buildResultsDiv&buildTypeId=bt31
here the expected version is 1.0.0-Beta5.{number of commits since last tag}
I have two assemblies in a solution, AssemblyA and AssemblyB. AssemblyB has a project reference to AssemblyA.
I'm using GFV and publishing develop branch nuget packages from TC for both assemblies.
I end up with the following for both assemblies (from the temp AssemblyInfo written out by GFV:
[assembly: AssemblyVersion("2.8.0")]
[assembly: AssemblyFileVersion("2.8.0")]
[assembly: AssemblyInformationalVersion("2.8.0-unstable12 Branch:'develop' Sha:'c415f7a3dbadad7b72c8af4b7ae8993d1ef35710'")]
The actual compiled assemblies both have AssemblyVersion 2.8.0 .0 (I guess this is a standard .net thing - to append ".0" to get a four part version number.)
When running nuget pack I'm using %GitFlowVersion.NugetVersion% as the package version and I'm telling nuget to IncludeReferencedProjects - so AssemblyB.nupkg will have a dependency on AssemblyA.nupkg
When I install AssemblyB.nupkg nuget fails to resolve the AssemblyA.nupkg dependency.
Unable to resolve dependency 'AssemblyA (= 2.8.0.0)'.
And that's because the AssemblyB nupkg contains the following:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>AssemblyB</id>
<version>2.8.0-Unstable0012</version>
<dependencies>
<dependency id="AssemblyA" version="2.8.0.0" />
</dependencies>
</metadata>
</package>
What I really want is the dependency to specify the GitFlowVersion.NugetVersion instead of the assemblyversion from the referenced project. A workaround is not to includereferencedprojects when packing but I don't want that.
How does NServiceBus handle this? How do you get your unstable NServiceBus.Host package to depend on NServiceBus? eg
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>NServiceBus.Host</id>
<version>4.0.0-unstable3109</version>
<title>NServiceBus Host (unstable)</title>
<dependencies>
<dependency id="NServiceBus" version="[4.0.0-unstable3109]" />
</dependencies>
</metadata>
</package>
Are you munging the nuspec before you pack?
http://builds.particular.net/viewLog.html?buildTypeId=bt31&buildId=24490
Should be 0.8.0 and not 8.1.0
Error 1 Error occurred: System.UnauthorizedAccessException: Access to the path 'C:\Temp\GitFlowVersionTask\AssemblyInfo_NServiceBus_bntcjft1.n2l.cs' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at GitFlowVersionTask.TempFileTracker.DeleteTempFiles() in c:\\GitFlowVersionTask\TempFileTracker.cs:line 22
at GitFlowVersionTask.UpdateAssemblyInfo.Execute() in c:\\GitFlowVersionTask\UpdateAssemblyInfo.cs:line 35 LicenseInstaller
GitFlowVersion should also support live remote git repositories:
GitFlowVersion.exe -u https://github.com/Particular/GitFlowVersion.git -b develop
In TeamCity, you get the source as a complete checkout (including all history via the .git folder). In Continua CI (and other systems), you only get the source of the branch you requested. This means that you don't have a .git folder, nor do you have multiple branches (because you are building a single branch). To overcome this issue, dynamic repositories (clone into temp folder) will be required.
In the latest version we seems to be generating invalid version strings:
10/14/2013 6:04:43 PM: [Error] System.ArgumentException: '4.1.0-Alpha0001.0031' is not a valid version string.
Parameter name: version
at NuGet.SemanticVersion..ctor(String version)
at ripple.Steps.UpdateNuspecs.<>c__DisplayClass10.<updateSpecification>b__9(String csProjectRef) in
c:\dev\Particular\ripple\src\ripple\Steps\UpdateNuspecs.cs:line 87
Full log here:
http://builds.particular.net/repository/download/NServiceBusCore_Build/25579:id/ripple.log
I got the followin scenario:
{
"Major":0,
"Minor":6,
"Patch":0,
"Stability":"Unstable",
"Suffix":"3c588406",
"LongVersion":"0.6.0-unstable.feature-945905e1 Branch:'GitFlowVersion2' Sha:'9
45905e1e25eb85a001c99174a1df4f0aa854723'",
"NugetVersion":"0.6.0-Feature-GitFlowVersion2-945905e1e25eb85a001c99174a1df4f0
aa854723",
"ShortVersion":"0.6.0-unstable.feature-945905e1",
"BranchName":"GitFlowVersion2",
"BranchType":"Feature",
"Sha":"945905e1e25eb85a001c99174a1df4f0aa854723"
}
It seems that the nuget version is bound to max 20 chars.
09.12.2013 23:52:30: [Info] Building the nuget spec file at C:\Projects\machine.specifications.dani\Misc\machine.specifications.nuspec as version 0.6.0-Feature-GitFlowVersion2-945905e1e25eb85a001c99174a1df4f0aa854723
09.12.2013 23:52:31: [Error] Error creating package: The special version part cannot exceed 20 characters.
09.12.2013 23:52:31: [Error] ripple.RippleFatalError: Error creating package: The special version part cannot exceed 20 characters.
09.12.2013 23:52:31: [Error] Error executing CreatePackages
09.12.2013 23:52:31: [Error] ripple.RippleFatalError: Error creating package: The special version part cannot exceed 20 characters.
at ripple.RippleAssert.Fail(String message, Object[] substitutions)
at ripple.Model.PublishingService.createPackage(PackageBuilder builder, String outputPath)
at ripple.Model.PublishingService.CreatePackage(PackageParams ctx)
at ripple.Steps.CreatePackages.<>c__DisplayClass1.<execute>b__0(NugetSpec spec)
at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 eachAction)
at ripple.RippleOperation.Execute(Boolean throwOnFailure)
09.12.2013 23:53:00: [Info] Building the nuget spec file at C:\Projects\machine.specifications.dani\Misc\machine.specifications.nuspec as version 0.6.0-unstable.feature-945905e1
09.12.2013 23:53:00: [Error] Error executing CreatePackages
09.12.2013 23:53:00: [Error] System.ArgumentException: '0.6.0-unstable.feature-945905e1' is not a valid version string.
Parameter name: version
at NuGet.SemanticVersion.Parse(String version)
at ripple.Steps.CreatePackages.<>c__DisplayClass1.<execute>b__0(NugetSpec spec)
at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 eachAction)
at ripple.RippleOperation.Execute(Boolean throwOnFailure)
10.12.2013 00:00:26: [Info] Building the nuget spec file at C:\Projects\machine.specifications.dani\Misc\machine.specifications.nuspec as version
10.12.2013 00:00:26: [Error] Error executing CreatePackages
10.12.2013 00:00:26: [Error] System.ArgumentException: Value cannot be null or an empty string.
Parameter name: version
at NuGet.SemanticVersion.Parse(String version)
at ripple.Steps.CreatePackages.<>c__DisplayClass1.<execute>b__0(NugetSpec spec)
at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 eachAction)
at ripple.Steps.CreatePackages.execute(CreatePackagesInput input, IRippleStepRunner runner)
at ripple.Steps.RippleStep`1.Execute(RippleInput input, IRippleStepRunner runner)
at ripple.RippleOperation.Execute(Boolean throwOnFailure)
10.12.2013 00:00:56: [Info] Building the nuget spec file at C:\Projects\machine.specifications.dani\Misc\machine.specifications.nuspec as version 0.6.0-unstable.feature-945905e1
10.12.2013 00:00:56: [Error] Error executing CreatePackages
10.12.2013 00:00:56: [Error] System.ArgumentException: '0.6.0-unstable.feature-945905e1' is not a valid version string.
Parameter name: version
at NuGet.SemanticVersion.Parse(String version)
at ripple.Steps.CreatePackages.<>c__DisplayClass1.<execute>b__0(NugetSpec spec)
at System.Collections.Generic.GenericEnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 eachAction)
at ripple.Steps.CreatePackages.execute(CreatePackagesInput input, IRippleStepRunner runner)
at ripple.Steps.RippleStep`1.Execute(RippleInput input, IRippleStepRunner runner)
at ripple.RippleOperation.Execute(Boolean throwOnFailure)
I tagged develop and branch from it to a feature branch.
instead of getting this
Error 1 Error processing commit `b2c144b1d28223e99ef891e97498d69d45290fee`. Only one version version tag per commit is allowed. NServiceBus (NServiceBus\NServiceBus)
because there are 2 tags on a commit should just take the newest tag
Raised by mspec user. Might also influence NSBHost
.NET's Application.LocalAppDataPath makes use of the Product Version (as well as the Company name and Proudct Name). Because the machine.specifications Product Version has invalid path characters, users cannot use LocalAppDataPath.
Please make the Product Version for all the executables contain only the version number (e.g. "0.6.2" vs. the current "0.6.2 Sha:'e5364ed4dfd8034f6a9725c10117dcca42a57724'").
Hey guys, love your work.
I'm a bit confused about which version of SemVer you support. V1.0.0 doesn't support prereleases while V2.0.0 has a recommended format for build metadata that is not being followed.
Also with prereleases, using unstable
puts it further down the sort order from alpha and beta. This is a problem for systems like Octopus Deploy which automatically determines the latest release based on SemVer version sorting.
Instead of unstable
is it possible to use alpha
?
And for build metadata, the prescribed method to include that with SemVer 2.0.0 is to use '+' like so.
1.2.3-alpha.645+Branch.develop.Sha.a682956dccae752aa24597a0f5cd939f93614509
1.2.3-beta.645+Branch.hotfix-foo.Sha.a682956dccae752aa24597a0f5cd939f93614509
1.2.3-rc.2+Branch.release-1.2.Sha.a682956dccae752aa24597a0f5cd939f93614509
1.2.3-alpha.feature-a682956d+Branch.feature1.Sha.a682956dccae752aa24597a0f5cd939f93614509
Thoughts?
When a user does a fresh clone using SSH we can't auto fetch the master:
Error 1 Error occurred: GitFlowVersion.MissingBranchException: Could not fetch from '[email protected]:Particular/PlatformInstaller.git' since LibGit2 does not support the transport. You have most likely cloned using SSH. If there is a remote branch named 'master' then fetch it manually, otherwise please create a local branch named 'master'. ---> LibGit2Sharp.LibGit2SharpException: An error was raised by libgit2. Category = Net (Error).
This transport isn't implemented. Sorry
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_connect(RemoteSafeHandle remote, GitDirection direction)
at LibGit2Sharp.Network.Fetch(Remote remote, Nullable`1 tagFetchMode, ProgressHandler onProgress, CompletionHandler onCompletion, UpdateTipsHandler onUpdateTips, TransferProgressHandler onTransferProgress, Credentials credentials)
at GitFlowVersion.LibGitExtensions.GetBranch(IRepository repository, String name) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\LibGitExtensions.cs:line 126
--- End of inner exception stack trace ---
at GitFlowVersion.LibGitExtensions.GetBranch(IRepository repository, String name) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\LibGitExtensions.cs:line 133
at GitFlowVersion.VersionOnMasterFinder.<VersionsOnMaster>d__3.MoveNext() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionOnMasterFinder.cs:line 71
at GitFlowVersion.VersionOnMasterFinder.Execute() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionOnMasterFinder.cs:line 37
at GitFlowVersion.DevelopVersionFinder.GetSemanticVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\DevelopVersionFinder.cs:line 36
at GitFlowVersion.DevelopVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\BranchFinders\DevelopVersionFinder.cs:line 13
at GitFlowVersion.GitFlowVersionFinder.FindVersion() in c:\Code\Particular\GitFlowVersion\GitFlowVersion\GitFlowVersionFinder.cs:line 44
at GitFlowVersion.VersionForRepositoryFinder.GetVersion(Repository repository) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionForDirectoryFinder.cs:line 18
at GitFlowVersion.VersionCache.GetVersion(String gitDirectory) in c:\Code\Particular\GitFlowVersion\GitFlowVersion\VersionCache.cs:line 39
at GitFlowVersionTask.UpdateAssemblyInfo.Execute() in c:\Code\Particular\GitFlowVersion\GitFlowVersionTask\UpdateAssemblyInfo.cs:line 57 PlatformInstaller.CustomActions
@nulltoken do you have any info on if/when this will be supported in LibGit2Sharp?
Have you guys seen. https://github.com/JakeGinnivan/GitHubFlowVersion
Do we agree that this is also possible with your extension? So why is this fork needed? OK, GitHubFlow doesn't have a develop branch. Why not simply make that step optional here?
Add AND $(nCrunch) ==''
to the condition of importing the targets file
When building from private git repos and the master branch is not yet tracked or up to date the builds fails with HTTP 401 (not authenticated) when trying to fetch the branch (TC only fetches the branch it is going to build)
For quick solution user/pass could be read from TC parameters before passing to libgit2sharp
Hopefully libgit2sharp can get propper ssh support and this will not be a problem.
I'm trying to work out the exact workflow to establish a stable version using GitFlowVersion.
When adding GitFlowVersion to an existing repository already using GitFlow, I have a master
branch and a develop
branch. In order to start with GitFlowVersion, I add GitFlowVersion to develop
branch and commit. Then, branch to release-1.0.0
and tag the commit release-1.0.0-alpha1
. This sets the AssemblyVersion to 1.0.0.0
and the ProductVersion to 1.0.0-alpha1{etc}
. At this point, GitFlowVersion seems happy.
How to I properly apply the 1.0.0
version to master
at this point?
From the documentation, I would think this should properly apply the 1.0.0
version on the master HEAD
:
c:\repos\example (release-1.0.0) > git checkout master
c:\repos\example (master)> git merge release-1.0.0
Fast-forward...
c:\repos\example (master)>
However, when I compile, I get an error that the head of master
should be a merge commit or tag. My understanding is that it is currently a merge commit.
If I then do the following (continued from above):
c:\repos\example (master)> git tag -a 1.0.0 -m "Added GitFlowVersion"
I can compile and get the 1.0.0
version I expect. Can someone help point out the holes I have here, as I assume this isn't exactly the correct workflow. Am I required to do a pull request from release-1.0.0
to master
in order for GitFlowVersion to find the right version?
Wanted to discuss with you whether it would make sense for GFV to directly merge develop into master without the need to assign a label. But that actually violates GF. But it is already possible with the following step:
merge develop into master. Build breaks. Assign label on master. Works. If GFV allows that (which is not GF compliant) why not relax it and let it pass without assigning a label or harden the checks so that this flow is not allowed and give a meaningful error message to the user.
According to http://nvie.com/posts/a-successful-git-branching-model/
A repository is expected to contain at least two branches: master
and develop
. Should we make VersionForRepositoryFinder
throw if
develop
didn't initially branch off of master
?The above post use some lax wording regarding the constraints (eg. A feature branch may branch off from develop). Should we enforce such constraints
HotfixVersionFinder
throw if the examined branch doesn't branch off of master
?ReleaseVersionFinder
and FeatureVersionFinder
throw if the examined branch doesn't branch off of develop
?The LibGitExtensions.GetBranch()
performs a fetch from the first remote found if a specified branch cannot be found locally. Why do we need such behavior? In which context/environment is that triggered?
How do I force the develop branch to start work on a next major release rather than just incrementing the minor by 1? Also why does it start off at 0.2 in a fresh repo?
New-Item VersionTest -ItemType Directory
Set-Location C:\Projects\VersionTest
git init
GitFlowVersion.exe
No Tip found. Has repo been initialize?
Add-Content Readme.txt "Initial Commit"
git add .
git commit -m "Initial commit"
GitFlowVersion.exe
This repository doesn't contain a branch named 'develop'. Please create one. Existing branches: 'refs/heads/master'
git flow init -d
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable1 Branch:'develop' Sha:'c6eeb686f75bd7581b302d40f88ea54b157dde47'",
"NugetVersion":"0.2.0-Unstable0001",
"ShortVersion":"0.2.0-unstable1",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"c6eeb686f75bd7581b302d40f88ea54b157dde47"
}
git flow feature start 1
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable.feature-c6eeb686 Branch:'feature/1' Sha:'c6eeb686f75bd7581b302d40f88ea54b157dde47'",
"NugetVersion":"0.2.0-Feature-feature/1-c6eeb686f75bd7581b302d40f88ea54b157dde47",
"ShortVersion":"0.2.0-unstable.feature-c6eeb686",
"BranchName":"feature/1",
"BranchType":"Feature",
"Sha":"c6eeb686f75bd7581b302d40f88ea54b157dde47"
}
Add-Content .\Readme.txt "Feature 1"
git commit -a -m "Feature 1 work"
git flow feature start 2
Add-Content .\Readme.txt "Feature 2"
git commit -a -m "Feature 2 work"
C:\Chocolatey\lib\GitFlowVersion.0.14.0\Tools\GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"c6eeb686",
"LongVersion":"0.2.0-unstable.feature-cbf98521 Branch:'feature/2' Sha:'cbf98521d19692f65bc925ac09cbfd6fdb1766e2'",
"NugetVersion":"0.2.0-Feature-feature/2-cbf98521d19692f65bc925ac09cbfd6fdb1766e2",
"ShortVersion":"0.2.0-unstable.feature-cbf98521",
"BranchName":"feature/2",
"BranchType":"Feature",
"Sha":"cbf98521d19692f65bc925ac09cbfd6fdb1766e2"
}
git checkout feature/1
git flow feature finish
C:\Chocolatey\lib\GitFlowVersion.0.14.0\Tools\GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable2 Branch:'develop' Sha:'241a399362e737e8a490f6c86f9bcb66fd5b4c6d'",
"NugetVersion":"0.2.0-Unstable0002",
"ShortVersion":"0.2.0-unstable2",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"241a399362e737e8a490f6c86f9bcb66fd5b4c6d"
}
git checkout feature/1
git merge develop
git commit -a -m "Merged up develop"
git flow feature finish
GitFlowVersion.exe
{
"Major":0,
"Minor":2,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"0.2.0-unstable5 Branch:'develop' Sha:'10f163add698dd6baaa867e9d9f775cbb22e5a15'",
"NugetVersion":"0.2.0-Unstable0005",
"ShortVersion":"0.2.0-unstable5",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"10f163add698dd6baaa867e9d9f775cbb22e5a15"
}
git flow release start 1.0.0
git tag "1.0.0-alpha1"
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"Stability":"Alpha",
"Suffix":"",
"LongVersion":"1.0.0-alpha1 Branch:'release/1.0.0' Sha:'10f163add698dd6baaa867e9d9f775cbb22e5a15'",
"NugetVersion":"1.0.0-Alpha0001",
"ShortVersion":"1.0.0-beta1",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"10f163add698dd6baaa867e9d9f775cbb22e5a15"
}
Add-Content .\readme.txt "Alpha fixes"
git commit -a -m "Checking in alpha fixes"
git tag "1.0.0-beta1"
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"PreReleasePartOne":1,
"PreReleasePartTwo":1,
"Stability":"Beta",
"Suffix":"",
"LongVersion":"1.0.0-beta1.1 Branch:'release/1.0.0' Sha:'d8b57e7e6dd7d7314ef627dbfe928f6cee74fe4b'",
"NugetVersion":"1.0.0-Beta0001-0001",
"ShortVersion":"1.0.0-beta1.1",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"d8b57e7e6dd7d7314ef627dbfe928f6cee74fe4b"
}
Add-Content .\readme.txt "Beta fixes"
git commit -a -m "Checking in beta fixes"
git tag "1.0.0-rc1"
C:\Chocolatey\lib\GitFlowVersion.0.14.0\Tools\GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"PreReleasePartOne":1,
"PreReleasePartTwo":2,
"Stability":"ReleaseCandidate",
"Suffix":"",
"LongVersion":"1.0.0-rc1.2 Branch:'release/1.0.0' Sha:'57377f2592020eb74303e7ecdbd108a784dace2d'",
"NugetVersion":"1.0.0-ReleaseCandidate0001-0002",
"ShortVersion":"1.0.0-rc1.2",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"57377f2592020eb74303e7ecdbd108a784dace2d"
}
Add-Content .\readme.txt "RC fixes"
git commit -a -m "Checking in RC fixes"
git tag "1.0.0-rc2"
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"PreReleasePartOne":2,
"PreReleasePartTwo":3,
"Stability":"ReleaseCandidate",
"Suffix":"",
"LongVersion":"1.0.0-rc2.3 Branch:'release/1.0.0' Sha:'4a11f06cfd1b9078e6abfa66dde874707a139dd2'",
"NugetVersion":"1.0.0-ReleaseCandidate0002-0003",
"ShortVersion":"1.0.0-rc2.3",
"BranchName":"release/1.0.0",
"BranchType":"Release",
"Sha":"4a11f06cfd1b9078e6abfa66dde874707a139dd2"
}
git flow finish release 1.0.0
GitFlowVersion.exe
{
"Major":1,
"Minor":0,
"Patch":0,
"Stability":"Final",
"Suffix":"",
"LongVersion":"1.0.0 Sha:'ce6bcacfd2d4ca0de209892b52cfc1ea0a677707'",
"NugetVersion":"1.0.0",
"ShortVersion":"1.0.0",
"BranchName":"master",
"BranchType":"Master",
"Sha":"ce6bcacfd2d4ca0de209892b52cfc1ea0a677707"
}
git checkout develop
{
"Major":1,
"Minor":1,
"Patch":0,
"Stability":"Unstable",
"Suffix":"",
"LongVersion":"1.1.0-unstable1 Branch:'develop' Sha:'10f163add698dd6baaa867e9d9f775cbb22e5a15'",
"NugetVersion":"1.1.0-Unstable0001",
"ShortVersion":"1.1.0-unstable1",
"BranchName":"develop",
"BranchType":"Develop",
"Sha":"10f163add698dd6baaa867e9d9f775cbb22e5a15"
}
Atm we enforce feature branches to start with feature- but I can't see that gitflow stipulates this?
I suggest that we relax the rule to be any name except hotfix- or release- as long as the branch is created of the develop branch
No need to require it upfront
What do we license this under?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.