Share
Embed
Introduction to GitVersion
Introduction to GitVersion (https://github.com/GitTools/GitVersion)
Awesome Incremented
September 21, 2015
Transcript
20 slides
-
GitVersion Agenda •What is GitVersion? Why to use? •Why Semantic
Versioning? •GitVersion: How It Works •Using GitVersion -
GitVersion What is GitVersion? •Automates Semantic Versioning • Looks at
git history • Works out SemVer of commit being built •Currently supports • GitFlow & GitHubFlow • Build Server Integration -
GitVersion Why GitVersion? Born out of frustration... •Patching versions after
accepting contributions • Another commit, another build •Slow feedback for non-main branches • No “Continuous Whatever” for features or RCs -
GitVersion Why GitVersion? What GitVersion gives •Not having to rebuild
to increment versions •Not duplicating version information • branch conventions •SemVer for each branch (calculated) •Version flows when merged -
GitVersion Why Semantic Versioning? Mainly solves 2 common dependency problems
•“Version lock” • can’t update → dep’s rely on `exact` versions •“Version promiscuity” • opposite of version lock • update → everything breaks -
GitVersion Version lock (example) •Your app is using • facebook
(1.0.0), twitter (1.0.0) → jsonLib (1.0.0) • facebook (1.1.0) comes out → jsonLib (1.1.0) •Can’t update! twitter locked to jsonLib (1.0.0) • Common when dep. mgnt relies on `exact` versions such as strong naming, e.g. • COM scenarios (Office Addins) -
GitVersion Version promiscuity (example) •Again • facebook (1.1.0) comes out
→ jsonLib (1.1.0) • but jsonLib 1.1.0 introduces breaking changes! •Updating breaks twitter 1.0.0 •We need to know when we can update! -
GitVersion Why Semantic Versioning? •SemVer = Conventions on breaking changes
• Can safely update without fear •It’s simple {major}.{minor}.{patch}-{tag}+{buildmetadata} • major = breaking change • minor = feature • patch = bugfix -
GitVersion Why Semantic Versioning? “Version lock”-behaviour introduced to tackle “Dependency
hell” Fun Questions • Is “Version lock” an issue for • OSGI? • Microservices, e.g. 12-factor-app ? • How about “Version promiscuity”? -
GitVersion GitVersion: How it works •What GitVersion not does •
Understanding code changes •Instead it calculates versions from • highest reachable tag ('v2.0.8') • branch-name ('release/2.1.0') • GitVersion.yaml • commits (Merge 'release/3.0.0' into 'master') -
GitVersion GitVersion: Example e137e9 -> 1.0.0+0 a5f6c5 -> 1.0.1+1 adb29a
-> 1.0.1-feature-foo.1+1 (PR #5 Version: `1.0.1-PullRequest.5+2`) 7c2438 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`) 5f413b -> 1.0.1+4 d6155b -> 2.0.0-rc.1+0 (Before and after tag) d53ab6 -> 2.0.0-rc.2+1 (Pre-release number was bumped because of the tag on previous commit) b5d142 -> 2.0.0+0 (2.0.0 branch was merged, so master is now at 2.0.0) http://gitversion.readthedocs.org/en/latest/examples/ -
GitVersion Using GitVersion •Command Line Tool • choco install GitVersion.Portable
• GitVersion.exe /?, init → GitVersion.yaml • GitVersion.exe /output buildserver •MSBuild Task • Install-Package GitVersionTask • Ruby Gem • http://gitversion.readthedocs.org/en/latest/usage/ -
GitVersion Demo Time Using GitVersion with .NET, Ant & Maven
https://github.com/mkoertgen/hello.gitversion -
GitVersion Demo Time Using GitVersion with .NET, Ant & Maven
• git clone https://github.com/mkoertgen/hello.gitversion • net> HelloGitVersion.sln • ant> ant • maven> build.bat -
GitVersion Summary •GitVersion gives • Automated Semantic Versioning • Branch
workflows GitFlow & GitHubFlow • Continuous Delivery & Deployment • including pre-releases • Build Server Integration • AppVeyor, TeamCity, Jenkins, NuGet, ... -
GitVersion Some references • GitVersion (GitHub) • .NET Rocks #1178
- Semantic Versioning • Semantic Versioning, GitFlow, GitHubFlow • OctopusDeploy, AppVeyor, … • Atlassian SourceTree