Fixes and cleanup in release pipeline (#4625)
* remove firehol release pipeline code; move tagging to separate script; add option to modify files based on tags * fix #4572
Paweł Krupa committed
Nov 12, 2018 at 18:26 UTC
562f1b84534dabf0a8d3f90f8d218b99aa283630
11 files changed
+81
-159
.travis.yml
+1
-1
@@ -53,7 +53,7 @@ jobs:
53
- stage: nightlies
54
name: tarball and self-extractor build
55
install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot
56
- script: ".travis/firehol_create_artifacts.sh"
56
+ script: ".travis/create_artifacts.sh"
57
- name: docker images
58
install: sudo apt update -y && sudo apt install -y --only-upgrade docker-ce && docker info
59
script: "docker/build.sh"
.travis/decrypt-if-have-key
deleted
-33
@@ -1,33 +0,0 @@
1
-#!/bin/bash
2
-
3
-set -e
4
-
5
-# Decrypt our private files; changes to this file should be inspected
6
-# closely to ensure they do not create information leaks
7
-
8
-eval key="\${encrypted_${1}_key}"
9
-eval iv="\${encrypted_${1}_iv}"
10
-
11
-if [ ! "$key" ]
12
-then
13
- echo "No aes key present - skipping decryption"
14
- exit 0
15
-fi
16
-
17
-for i in .travis/*.enc
18
-do
19
- u=$(echo $i | sed -e 's/.enc$//')
20
- openssl aes-256-cbc -K "$key" -iv "$iv" -in $i -out $u -d
21
-done
22
-
23
-if [ -f .travis/travis_rsa ]
24
-then
25
- echo "ssh key present - loading to agent"
26
- # add key, then remove to prevent leaks
27
- chmod 600 .travis/travis_rsa
28
- ssh-add .travis/travis_rsa
29
- rm -f .travis/travis_rsa
30
- touch /tmp/ssh-key-loaded
31
-else
32
- echo "No ssh key present - skipping agent start"
33
-fi
.travis/deploy-if-have-key
deleted
-55
@@ -1,55 +0,0 @@
1
-#!/bin/bash
2
-
3
-set -e
4
-
5
-# Deploy tar-files and checksums to the firehol website
6
-
7
-if [ ! -f /tmp/ssh-key-loaded ]
8
-then
9
- echo "No ssh key decrypted - skipping deployment to website"
10
- exit 0
11
-fi
12
-
13
-case "$TRAVIS_BRANCH" in
14
- master|stable-*)
15
- :
16
- ;;
17
- *)
18
- echo "Not on master or stable-* branch - skipping deployment to website"
19
- exit 0
20
- ;;
21
-esac
22
-
23
-if [ "$TRAVIS_PULL_REQUEST" = "true" ]
24
-then
25
- echo "Building pull request - skipping deployment to website"
26
- exit 0
27
-fi
28
-
29
-if [ "$TRAVIS_TAG" != "" ]
30
-then
31
- echo "Building tag - skipping deployment to website"
32
- exit 0
33
-fi
34
-
35
-if [ "$TRAVIS_OS_NAME" != "linux" ]
36
-then
37
- echo "Building non-linux version - skipping deployment to website"
38
- exit 0
39
-fi
40
-
41
-if [ "$CC" != "gcc" ]
42
-then
43
- echo "Building non-gcc version - skipping deployment to website"
44
- exit 0
45
-fi
46
-
47
-ssh-keyscan -H firehol.org >> ~/.ssh/known_hosts
48
-ssh travis@firehol.org mkdir -p uploads/netdata/$TRAVIS_BRANCH/
49
-scp -p *.tar.gz travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
50
-scp -p *.tar.gz.sha travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
51
-scp -p *.tar.gz.asc travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
52
-scp -p *.gz.run travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
53
-scp -p *.gz.run.sha travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
54
-scp -p *.gz.run.asc travis@firehol.org:uploads/netdata/$TRAVIS_BRANCH/
55
-ssh travis@firehol.org touch uploads/netdata/$TRAVIS_BRANCH/complete.txt
.travis/firehol_create_artifacts.sh
deleted
-31
@@ -1,31 +0,0 @@
1
-#!/bin/bash
2
-# shellcheck disable=SC2230
3
-
4
-# WARNING: This script is deprecated and placed here until @paulfantom figures out how to fully replace it
5
-
6
-if [ ! -f .gitignore ]
7
-then
8
- echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
9
- exit 1
10
-fi
11
-
12
-eval "$(ssh-agent -s)"
13
-./.travis/decrypt-if-have-key decb6f6387c4
14
-export KEYSERVER=ipv4.pool.sks-keyservers.net
15
-./packaging/gpg-recv-key phil@firehol.org "0762 9FF7 89EA 6156 012F 9F50 C406 9602 1359 9237"
16
-./packaging/gpg-recv-key costa@tsaousis.gr "4DFF 624A E564 3B51 2872 1F40 29CA 3358 89B9 A863"
17
-# Run the commit hooks in case the developer didn't
18
-git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | ./packaging/check-files -
19
-fakeroot ./packaging/git-build
20
-# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
21
-# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
22
-python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
23
-echo "--- Create tarball ---"
24
-make dist
25
-echo "--- Create self-extractor ---"
26
-./makeself/build-x86_64-static.sh
27
-echo "--- Create checksums ---"
28
-for i in *.tar.gz; do sha512sum -b "$i" > "$i.sha"; done #FIXME remove?
29
-for i in *.gz.run; do sha512sum -b "$i" > "$i.sha"; done #FIXME remove?
30
-sha256sum -b ./*.tar.gz ./*.gz.run > "sha256sums.txt"
31
-./.travis/deploy-if-have-key
.travis/generate_changelog.sh
+2
-2
@@ -10,8 +10,8 @@ fi
10
11
ORGANIZATION=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $1}')
12
PROJECT=$(echo "$TRAVIS_REPO_SLUG" | awk -F '/' '{print $2}')
13
-GIT_MAIL="pawel+bot@netdata.cloud"
14
-GIT_USER="netdatabot"
13
+GIT_MAIL=${GIT_MAIL:-"pawel+bot@netdata.cloud"}
14
+GIT_USER=${GIT_USER:-"netdatabot"}
15
16
echo "--- Initialize git configuration ---"
17
git config user.email "${GIT_MAIL}"
.travis/labeler.sh
+2
-2
@@ -24,8 +24,8 @@ for STATE in "open" "closed"; do
24
URL="https://api.github.com/repos/netdata/netdata/issues/$ISSUE"
25
BODY="$(curl "${URL}" | jq .body 2>/dev/null)"
26
case "${BODY}" in
27
- *"##### Question summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["question"]}' -X PATCH "${URL}" ;;
28
- *"##### Bug report summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["bug"]}' -X PATCH "${URL}" ;;
27
+ *"# Question summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["question"]}' -X PATCH "${URL}" ;;
28
+ *"# Bug report summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["bug"]}' -X PATCH "${URL}" ;;
29
* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage"]}' -X PATCH "${URL}" ;;
30
esac
31
done
.travis/releaser.sh
+10
-33
@@ -25,42 +25,19 @@
25
26
set -e
27
28
-if [ ! -f .gitignore ]
29
-then
30
- echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
31
- exit 1
28
+if [ ! -f .gitignore ]; then
29
+ echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
30
+ exit 1
31
fi
32
34
-echo "---- FIGURING OUT TAGS ----"
35
-# Check if current commit is tagged or not
36
-GIT_TAG=$(git tag --points-at)
37
-if [ -z "${GIT_TAG}" ]; then
38
- git semver
39
- # Figure out next tag based on commit message
40
- GIT_TAG=HEAD
41
- echo "Last commit message: $TRAVIS_COMMIT_MESSAGE"
42
- case "${TRAVIS_COMMIT_MESSAGE}" in
43
- *"[netdata patch release]"* ) GIT_TAG="v$(git semver --next-patch)" ;;
44
- *"[netdata minor release]"* ) GIT_TAG="v$(git semver --next-minor)" ;;
45
- *"[netdata major release]"* ) GIT_TAG="v$(git semver --next-major)" ;;
46
- *) echo "Keyword not detected. Doing nothing" ;;
47
- esac
48
-
49
- # Tag it!
50
- if [ "$GIT_TAG" != "HEAD" ]; then
51
- echo "Assigning a new tag: $GIT_TAG"
52
- git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER"
53
- # git is able to push due to configuration already being initialized in `generate_changelog.sh` script
54
- git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" --tags
55
- fi
56
-fi
33
+export GIT_MAIL="pawel+bot@netdata.cloud"
34
+export GIT_USER="netdatabot"
35
+echo "--- Initialize git configuration ---"
36
+git config user.email "${GIT_MAIL}"
37
+git config user.name "${GIT_USER}"
38
58
-if [ "${GIT_TAG}" == "HEAD" ]; then
59
- echo "Not creating a release since neither of two conditions was met:"
60
- echo " - keyword in commit message"
61
- echo " - commit is tagged"
62
- exit 0
63
-fi
39
+echo "---- FIGURING OUT TAGS ----"
40
+./.travis/tagger.sh || exit 0
41
42
echo "---- GENERATING CHANGELOG -----"
43
./.travis/generate_changelog.sh
.travis/tagger.sh
new
+64
@@ -0,0 +1,64 @@
1
+#!/bin/bash
2
+# SPDX-License-Identifier: MIT
3
+# Copyright (C) 2018 Pawel Krupa (@paulfantom) - All Rights Reserved
4
+# Permission to copy and modify is granted under the MIT license
5
+#
6
+# Original script is available at https://github.com/paulfantom/travis-helper/blob/master/releasing/releaser.sh
7
+#
8
+# Tags are generated by searching for a keyword in last commit message. Keywords are:
9
+# - [patch] or [fix] to bump patch number
10
+# - [minor], [feature] or [feat] to bump minor number
11
+# - [major] or [breaking change] to bump major number
12
+# All keywords MUST be surrounded with square braces.
13
+#
14
+# Requirements:
15
+# - GITHUB_TOKEN variable set with GitHub token. Access level: repo.public_repo
16
+# - git-semver python package (pip install git-semver)
17
+
18
+set -e
19
+
20
+if [ ! -f .gitignore ]; then
21
+ echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
22
+ exit 1
23
+fi
24
+
25
+# Embed new version in files which need it.
26
+# This wouldn't be needed if we could use `git tag` everywhere.
27
+function embed_version {
28
+ VERSION="$1"
29
+ MAJOR=$(echo "$GIT_TAG" | cut -d . -f 1 | cut -d v -f 2)
30
+ MINOR=$(echo "$GIT_TAG" | cut -d . -f 2)
31
+ PATCH=$(echo "$GIT_TAG" | cut -d . -f 3)
32
+ sed -i "s/\\[VERSION_MAJOR\\], \\[.*\\]/\\[VERSION_MAJOR\\], \\[$MAJOR\\]/" configure.ac
33
+ sed -i "s/\\[VERSION_MINOR\\], \\[.*\\]/\\[VERSION_MINOR\\], \\[$MINOR\\]/" configure.ac
34
+ sed -i "s/\\[VERSION_PATCH\\], \\[.*\\]/\\[VERSION_PATCH\\], \\[$PATCH\\]/" configure.ac
35
+ git add configure.ac
36
+}
37
+
38
+# Check if current commit is tagged or not
39
+GIT_TAG=$(git tag --points-at)
40
+if [ -z "${GIT_TAG}" ]; then
41
+ git semver
42
+ # Figure out next tag based on commit message
43
+ echo "Last commit message: $TRAVIS_COMMIT_MESSAGE"
44
+ case "${TRAVIS_COMMIT_MESSAGE}" in
45
+ *"[netdata patch release]"*) GIT_TAG="v$(git semver --next-patch)" ;;
46
+ *"[netdata minor release]"*) GIT_TAG="v$(git semver --next-minor)" ;;
47
+ *"[netdata major release]"*) GIT_TAG="v$(git semver --next-major)" ;;
48
+ *) echo "Keyword not detected. Exiting..."; exit 1;;
49
+ esac
50
+
51
+ # Tag it!
52
+ if [ "$GIT_TAG" != "HEAD" ]; then
53
+ echo "Assigning a new tag: $GIT_TAG"
54
+ embed_version "$GIT_TAG"
55
+ git commit -m "[ci skip] release $GIT_TAG"
56
+ git tag "$GIT_TAG" -a -m "Automatic tag generation for travis build no. $TRAVIS_BUILD_NUMBER"
57
+ git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
58
+ git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')" --tags
59
+ fi
60
+else
61
+ embed_version "$GIT_TAG"
62
+ git commit -m "[ci skip] release $GIT_TAG"
63
+ git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e 's/^https:\/\///')"
64
+fi
.travis/travis_rsa.enc
Binary files a/.travis/travis_rsa.enc and /dev/null differ
Makefile.am
+1
-1
@@ -1,6 +1,6 @@
1
# SPDX-License-Identifier: GPL-3.0-or-later
2
3
-AUTOMAKE_OPTIONS=foreign subdir-objects 1.10
3
+AUTOMAKE_OPTIONS=foreign subdir-objects 1.11
4
ACLOCAL_AMFLAGS = -I build/m4
5
6
MAINTAINERCLEANFILES= \
configure.ac
+1
-1
@@ -5,7 +5,7 @@
5
AC_PREREQ(2.60)
6
7
define([VERSION_MAJOR], [1])
8
-define([VERSION_MINOR], [10])
8
+define([VERSION_MINOR], [11])
9
define([VERSION_FIX], [1])
10
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
11
define([VERSION_SUFFIX], [_rolling])