Search code examples
continuous-deliverybranching-strategy

Continuous Delivery, Versioning and Feature Branches confusion


I'm currently in the process of implementing CD with a Feature Branch Workflow. What's unclear to me is when to increase the version number.

Shall it be increased when a new feature is created?

So let's say we have version 1.1 and I'm going to implement a new feature FB-123.

When creating the FB shall I increment the version?

       *---*--- increment build number, now on 1.2.456 
      / increment version to 1.2 
  ---* 1.1

And use the Jenkins Build number for subsequent commits?


Solution

  • I would consider to use the following versioning schema:

    • Every major/minor release is tagged with a git tag
    • branches schema - <major>.<minor>.<number of commits from latest minor>-<feature branch-name>-<sha1>
    • master schema - <major>.<minor> (it considers that every accepted pull request is a minor release)

    You can calculate the number of commits from latest minor by

    git rev-list HEAD ^<latest minor tag> --ancestry-path <latest minor tag> --count
    

    This schema will allow you to derive from the version name:

    • the base version
    • the branch name
    • the git commit that the version was built from
    • to compare properly 2 versions of the same branch