diff options
author | Paweł Krupa <pawel@krupa.net.pl> | 2018-11-22 20:11:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-22 20:11:19 +0200 |
commit | 035ba52862c9667739c0f461bf2a2b39ed677ee2 (patch) | |
tree | 88ea3d4bcd7264ede4dbca0364eb3ee1062cd991 | |
parent | a64bd98de6d7167d308c4d512f5509291d8151bb (diff) |
Add option to create release candidates (#4706)
[netdata patch release]
-rw-r--r-- | .travis/README.md | 60 | ||||
-rwxr-xr-x | .travis/releaser.sh | 15 | ||||
-rwxr-xr-x | .travis/tagger.sh | 19 |
3 files changed, 64 insertions, 30 deletions
diff --git a/.travis/README.md b/.travis/README.md index 5a51b2a7c6..e37e9feffb 100644 --- a/.travis/README.md +++ b/.travis/README.md @@ -29,40 +29,43 @@ installations of netdata. Jobs are run on following operating systems: - CentOS 7 (containerized) - alpine (containerized) -### Release +### Packaging This stage is executed only on "master" brach and allows us to create a new tag just looking at git commit message. -It also has an option to automatically generate changelog based on GitHub labels and sync it with GitHub release. -For the sake of simplicity and to use travis features this stage cannot be integrated with next stage. - -Releases are generated by searching for a keyword in last commit message. Keywords are: - - [patch] or [fix] to bump patch number - - [minor], [feature] or [feat] to bump minor number - - [major] or [breaking change] to bump major number -All keywords MUST be surrounded with square braces. -Alternative is to push a tag to master branch. - -### Packaging +It executes one script called `releaser.sh` which is responsible for creating a release on GitHub by using +[hub](https://github.com/github/hub). This script is also executing other scripts which can also be used in other +CI jobs: + - `tagger.sh` + - `generate_changelog.sh` + - `build.sh` + - `create_artifacts.sh` -This stage is executed only on "master" branch and it is separated into 3 jobs: - - Update Changelog/Create release - - Nightly tarball and self-extractor build - - Nightly docker images +Alternatively new release can be also created by pushing new tag to master branch. -##### Update Changelog/Create release +##### tagger.sh -This job is running one script called `releaser.sh`, which is responsible for a couple of things. First of all it -automatically updates our CHANGELOG.md file based on GitHub features (mostly labels and pull requests). Apart from -that it can also create a new git tag and a github draft release connected to that tag. -Releases are generated by searching for a keyword in last commit message. Keywords are: +Script responsible to find out what will be the next tag based on a keyword in last commit message. Keywords are: - `[netdata patch release]` to bump patch number - `[netdata minor release]` to bump minor number - `[netdata major release]` to bump major number + - `[netdata release candidate]` to create a new release candidate (appends or modifies suffix `-rcX` of previous tag) All keywords MUST be surrounded with square brackets. +Tag is then stored in `GIT_TAG` variable. -Alternatively new release can be also created by pushing new tag to master branch. +##### generate_changelog.sh -##### Nightly tarball and self-extractor build AND Nightly docker images +Automatic changelog generator which updates our CHANGELOG.md file based on GitHub features (mostly labels and pull +requests). Internally it uses +[github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) and more +information can be found on that project site. + +##### build.sh and create_artifacts.sh + +Scripts used to build new container images and provide release artifacts (tar.gz and makeself archives) + +### Nightlies + +##### Tarball and self-extractor build AND Nightly docker images As names might suggest those two jobs are responsible for nightly netdata package creation and are run every day (in cron). Combined they produce: @@ -70,11 +73,16 @@ cron). Combined they produce: - tar.gz archive (soon to be removed) - self-extracting package -Currently "Nightly tarball and self-extractor build" is using old firehol script and it is planed to be replaced with -new design. +This is achieved by running 2 scripts described earlier: + - `create_artifacts.sh` + - `build.sh` -##### Nightly changelog generation +##### Changelog generation This job is responsible for regenerating changelog every day by executing `generate_changelog.sh` script. This is done only once a day due to github rate limiter. +##### Labeler + +Once a day we are doing automatic label assignment by executing `labeler.sh`. This script is a temporary workaround until +we start using GitHub Actions. For more information what it is currently doing go to its code. diff --git a/.travis/releaser.sh b/.travis/releaser.sh index e12d5da5bf..e74741ad2c 100755 --- a/.travis/releaser.sh +++ b/.travis/releaser.sh @@ -21,7 +21,6 @@ # Requirements: # - GITHUB_TOKEN variable set with GitHub token. Access level: repo.public_repo # - docker -# - git-semver python package (pip install git-semver) set -e @@ -37,7 +36,9 @@ git config user.email "${GIT_MAIL}" git config user.name "${GIT_USER}" echo "---- FIGURING OUT TAGS ----" -./.travis/tagger.sh || exit 0 +# tagger.sh is sourced since we need environment variables it sets +#shellcheck source=/dev/null +source .travis/tagger.sh || exit 0 echo "---- GENERATING CHANGELOG -----" ./.travis/generate_changelog.sh @@ -57,4 +58,12 @@ tar -C /tmp -xvf "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin" # Create a release draft -hub release create --draft -a "netdata-${GIT_TAG}.tar.gz" -a "netdata-${GIT_TAG}.gz.run" -a "sha256sums.txt" -m "${GIT_TAG}" "${GIT_TAG}" +if [ -z ${GIT_TAG+x} ]; then + echo "Variable GIT_TAG is not set. Something went terribly wrong! Exiting." + exit 1 +fi +if [ -z ${RC+x} ]; then + hub release create --prerelease --draft -a "netdata-${GIT_TAG}.tar.gz" -a "netdata-${GIT_TAG}.gz.run" -a "sha256sums.txt" -m "${GIT_TAG}" "${GIT_TAG}" +else + hub release create --draft -a "netdata-${GIT_TAG}.tar.gz" -a "netdata-${GIT_TAG}.gz.run" -a "sha256sums.txt" -m "${GIT_TAG}" "${GIT_TAG}" +fi diff --git a/.travis/tagger.sh b/.travis/tagger.sh index 3b71277420..e4d4e0af57 100755 --- a/.travis/tagger.sh +++ b/.travis/tagger.sh @@ -35,6 +35,22 @@ function embed_version { git add configure.ac } +# Figure out what will be new release candidate tag based only on previous ones. +# This assumes that RELEASES are in format of "v0.1.2" and prereleases (RCs) are using "v0.1.2-rc0" +function release_candidate { + LAST_TAG=$(git semver) + if [[ $LAST_TAG =~ -rc* ]]; then + LAST_RELEASE=$(echo "$LAST_TAG" | cut -d'-' -f 1) + LAST_RC=$(echo "$LAST_TAG" | cut -d'c' -f 2) + RC=$((LAST_RC + 1)) + else + LAST_RELEASE=$LAST_TAG + RC=0 + fi + GIT_TAG="v$LAST_RELEASE-rc$RC" + export GIT_TAG +} + # Check if current commit is tagged or not GIT_TAG=$(git tag --points-at) if [ -z "${GIT_TAG}" ]; then @@ -45,9 +61,9 @@ if [ -z "${GIT_TAG}" ]; then *"[netdata patch release]"*) GIT_TAG="v$(git semver --next-patch)" ;; *"[netdata minor release]"*) GIT_TAG="v$(git semver --next-minor)" ;; *"[netdata major release]"*) GIT_TAG="v$(git semver --next-major)" ;; + *"[netdata release candidate]"*) release_candidate ;; *) echo "Keyword not detected. Exiting..."; exit 1;; esac - # Tag it! if [ "$GIT_TAG" != "HEAD" ]; then echo "Assigning a new tag: $GIT_TAG" @@ -62,3 +78,4 @@ else git commit -m "[ci skip] release $GIT_TAG" git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" fi +export GIT_TAG |