Slide 1

Slide 1 text

GitVersion GitVersion Dev.Talk September 2015 Marcel Körtgen

Slide 2

Slide 2 text

GitVersion Agenda •What is GitVersion? Why to use? •Why Semantic Versioning? •GitVersion: How It Works •Using GitVersion

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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)

Slide 8

Slide 8 text

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!

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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')

Slide 12

Slide 12 text

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/

Slide 13

Slide 13 text

GitVersion GitHubFlow http://gitversion.readthedocs.org/en/latest/git-branching-strategies/githubflow-examples/

Slide 14

Slide 14 text

GitVersion GitFlow http://gitversion.readthedocs.org/en/latest/git-branching-strategies/gitflow-examples/

Slide 15

Slide 15 text

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/

Slide 16

Slide 16 text

GitVersion Demo Time Using GitVersion with .NET, Ant & Maven https://github.com/mkoertgen/hello.gitversion

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

GitVersion Summary •GitVersion gives • Automated Semantic Versioning • Branch workflows GitFlow & GitHubFlow • Continuous Delivery & Deployment • including pre-releases • Build Server Integration • AppVeyor, TeamCity, Jenkins, NuGet, ...

Slide 19

Slide 19 text

GitVersion Some references • GitVersion (GitHub) • .NET Rocks #1178 - Semantic Versioning • Semantic Versioning, GitFlow, GitHubFlow • OctopusDeploy, AppVeyor, … • Atlassian SourceTree

Slide 20

Slide 20 text

GitVersion Thank You Time for Questions!