Sunday, 4 June 2017

How to implement git tag and versionning in a CI pipeline process

I am working on node and java project.

To bump the version number I usually use the following command:

  • ./gradlew build release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=0.1.5 -Prelease.newVersion=0.1.6-SNAPSHOT
  • npm version $version && git add package.json && git commit -m "prepare $version" && git push && git tag -a -m "new version $version" && git push --tags

I am using Gitlab-CI and I have setup the following CI branches:

  1. dev: used by developers, the build trigger a dev deloyment.
  2. master: when dev is merged into master, will trigger a version TAG
  3. staging: when master is merged into staging, will trigger a staging deployment
  4. production: when staging is merged into production, will trigger a preproduction autoamtique deployment and wait for the production deployment.

There are still scenario I might have not think about and I would like to know what do you think for the tag branch:

  • I am thinking of updating the CHANGELOG.md when (2) happen. What are the possibility for doing that ?

I also wonder if I should automate the last minor version and tag:

  • What would be an efficient versioning tag for (2).
    • Should I just set the version in dev, and let it tag in master?
    • Should the tag in master prepare the next version in dev (like when using ./gradlew release and the -SNAPSHOT version ?
    • Should I use the ${CI_PIPELINE_ID} as minor version or just append it as a build number or just ignore it it the tag ?

Any critics and advice are well appreciated.



via BigDong

No comments:

Post a Comment