Minor-release-per-branch workflow, aka "git-flow-light", aka "git-ebb"
453
This repository contains bash shell scripts that assist in implementing a release management strategy that is based on one release branch per minor version.
In this strategy, the master branch contains the latest & greatest code, and branches are created for each minor version (vx.y) and only patches for that release go into its minor branch.
$ git clone [email protected]:SciSpike/release-mgmt.git /tmp/scispike/release-mgmt
$ alias release=/tmp/scispike/release-mgmt/release
$
$ # For a Node.js project using npm:
$ release nodejs pre # release a preview
$ release nodejs rc # release a release candidate
$ release nodejs minor # release a minor version
$ release nodejs patch # release a patch
$
$ # For a Node.js project using npm that also produces a Docker image,
$ # and you want the package version to be the same as the Docker image's
$ # version label:
$ release nodejs+image pre # release a preview
$ release nodejs+image rc # release a release candidate
$ release nodejs+image minor # release a minor version
$ release nodejs+image patch # release a patch
$
$ # For a Helm chart project:
$ release chart pre # release a preview
$ release chart rc # release a release candidate
$ release chart minor # release a minor version
$ release chart patch # release a patch
$
$ # For a generic project that uses a VERSION file:
$ release version pre # release a preview
$ release version rc # release a release candidate
$ release version minor # release a minor version
$ release version patch # release a patch
$
$ # For a .NET project in c# that uses a AssemblyInfo.cs file with entries for AssemblyVersion, AssemblyFileVersion and AssemblyInformationalVersion:
$ release csharp pre # release a preview
$ release csharp rc # release a release candidate
$ release csharp minor # release a minor version
$ release csharp patch # release a patch
$
$ # To use the Docker image to release a Node.js preview:
$ docker run \
--rm \
-it \
-e [email protected] \
-v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
-v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub \
-v $PWD:/gitrepo \
scispike/release \
nodejs pre
This is a minor-release-per-branch strategy, and all that the scripts do is manipulate versions, create release commits & tags, create release branches, and push so that your CI/CD process can actually perform releases based on branch & tag names.
You can override certain defaults; see the release-xxx scripts for more information, or issue ./release xxx --help to get usage information, where xxx is nodejs, image, version, or chart.
We currently support release management for
release-chart)Dockerfile's LABEL directive with a version= label (release-image)release-nodejs) using npm along with package.json (yarn is a TODO)VERSION file (by any name)If you need to support other project types, see below for developer information.
master is pre (ie, 1.0.0-pre.0), and is configurable by setting the PRE environment variable.rc for "release candidate" (ie, 1.0.0-rc.0), and is configurable via the RC environment variable.master branch always contains the latest & greatest code line.MASTER environment variable.origin, but is configurable via the ORIGIN environment variable.git cherry-picked into your master branch, or even backported to prior release branches.git.master branch.
0.1.0-pre.0.0, like 1.0.0-pre.0 or whatever you need.master with the command ./release xxx pre in the master branch.
master branch with ./release xxx rc.
vx.y where x is your master branch's current major version and y is the minor version. The initial version in the vx.y branch will have the suffix -rc.0, which will be released, then it will be immediately bumped to -rc.1 in preparation for your next release candidate.master; git cherry-pick is a simple tool with which to do that../release xxx minor.
vx.y.0, and the script will bump your prerelease number in the release branch to x.y.1-rc.0, where x & y are your major & minor version numbers, respectively.master or even older release branches as you see fit../release xxx patch or prereleases with ./release xxx rc.master for your next minor release, vx.z where z is y + 1.You need to have bash with git & docker installed in order to run the scripts natively.
You'll also need the technology-specific tools, like npm if you're using nodejs.
You can also forgo all dependencies except docker and use this strategy via its Docker containers, as these scripts have been Dockerized under the scispike organization on Docker Hub.
For example, see https://hub.docker.com/r/scispike/release.
All you really have to do is map a volume containing the root of your git repo to /gitrepo and set the EMAIL environment variable.
You might also want to include other environment variables supported by git; see https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables.
If your current directory is the root of your git repo:
$ docker run --rm -i -v "$PWD:/gitrepo" -e [email protected] scispike/release xxx pre # or rc, minor, patch, ...
Just replace xxx above with image, chart, nodejs, version, or whatever else we support in the future.
VERSION file to store its version../release-this <level> to release it, where <level> is pre, rc, minor, patch, or major../release is basically an abstract function that implements the release workflow, but needs getVersion, setVersion and usage_xxx functions to exist at runtime for the particular technology being used../release looks for a file called ./release-$1 (where $1 is the value of the first argument given) & sources it, which provides said functions.$1, initially, are chart for Helm Charts, image for Docker images, nodejs for Node.js projects using npm, and version for projects that use a simple text file called VERSION, but may increase over time.test/
test/test-all.shrelease-xxx script & a test/xxx directory from an existing release technology xxx, then remember totest/test-all.sh to add your new type to those tested./release-this level where level is the release level (pre, rc, ...)NOTE: this repo now releases all technologies together under a single release, and the prior Docker images should be considered deprecated.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux.sudo apt-get update -ysudo apt-get install -y apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"sudo apt-get update -ysudo apt-get install -y docker-cesudo usermod -aG docker $USERsudo apt-get install -y docker-composesudo mkdir /c adjust for your drive where docker is installed. ignore if directory already exists.sudo mount --bind /mnt/c /cdocker infodocker-compose --versionContent type
Image
Digest
Size
43.2 MB
Last updated
almost 7 years ago
docker pull scispike/release:master-latest-dev