better artifacts uploading; remove build hacks (#5134)
Paweł Krupa committed
Jan 14, 2019 at 09:26 UTC
914a3a48a5ee71a6b5cd007a86dda6bf2a8602d1
4 files changed
+22
-22
.travis/create_artifacts.sh
+10
-16
@@ -1,11 +1,17 @@
1
#!/bin/bash
2
# shellcheck disable=SC2230
3
4
+set -e
5
+
6
if [ ! -f .gitignore ]; then
7
echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
8
exit 1
9
fi
10
11
+# Everything from this directory will be uploaded to GCS
12
+mkdir -p artifacts
13
+BASENAME="netdata-$(git describe)"
14
+
15
# Make sure stdout is in blocking mode. If we don't, then conda create will barf during downloads.
16
# See https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959 for details.
17
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);'
@@ -13,30 +19,18 @@ echo "--- Create tarball ---"
19
autoreconf -ivf
20
./configure
21
make dist
22
+mv "${BASENAME}.tar.gz" artifacts/
23
+
24
echo "--- Create self-extractor ---"
25
./packaging/makeself/build-x86_64-static.sh
26
27
# Needed fo GCS
28
echo "--- Copy artifacts to separate directory ---"
21
-mkdir -p artifacts
22
-BASENAME="netdata-$(git describe)"
23
-mv "${BASENAME}".* artifacts/
29
+#shellcheck disable=SC2164
30
cd artifacts
31
ln -s "${BASENAME}.tar.gz" netdata-latest.tar.gz
32
ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
33
sha256sum -b ./* >"sha256sums.txt"
28
-cd ../
29
-
30
-# TODO(paulfantom): remove this section after releasing v1.12 and always use "artifacts" directory
31
-echo "--- Create checksums ---"
32
-GIT_TAG=$(git tag --points-at)
33
-if [ "${GIT_TAG}" != "" ]; then
34
- ln -s netdata-latest.gz.run "netdata-${GIT_TAG}.gz.run"
35
- ln -s netdata-*.tar.gz "netdata-${GIT_TAG}.tar.gz"
36
- sha256sum -b "netdata-${GIT_TAG}.gz.run" "netdata-${GIT_TAG}.tar.gz" >"sha256sums.txt"
37
-else
38
- sha256sum -b ./*.tar.gz ./*.gz.run >"sha256sums.txt"
39
-fi
40
-
34
echo "checksums:"
35
cat sha256sums.txt
36
+
.travis/releaser.sh
+9
-2
@@ -41,6 +41,7 @@ echo "---- FIGURING OUT TAGS ----"
41
# tagger.sh is sourced since we need environment variables it sets
42
#shellcheck source=/dev/null
43
source .travis/tagger.sh || exit 0
44
+# variable GIT_TAG is produced by tagger.sh script
45
46
echo "---- UPDATE VERSION FILE ----"
47
echo "$GIT_TAG" >packaging/version
@@ -55,8 +56,9 @@ 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
+# After those operations output of command `git describe` should be identical with a value of GIT_TAG
60
59
-if [ -z ${RC+x} ]; then
61
+if [[ $(git describe) =~ -rc* ]]; then
62
echo "This is a release candidate tag, exiting without artifact building"
63
exit 0
64
fi
@@ -66,6 +68,7 @@ export REPOSITORY="netdata/netdata"
68
./packaging/docker/build.sh
69
70
echo "---- CREATING RELEASE ARTIFACTS -----"
71
+# Artifacts are stored in `artifacts/` directory
72
./.travis/create_artifacts.sh
73
74
echo "---- CREATING RELEASE DRAFT WITH ASSETS -----"
@@ -84,4 +87,8 @@ if [ "${GIT_TAG}" != "$(git tag --points-at)" ]; then
87
echo "ERROR! Current commit is not tagged. Stopping release creation."
88
exit 1
89
fi
87
-hub release create --draft -a "netdata-${GIT_TAG}.tar.gz" -a "netdata-${GIT_TAG}.gz.run" -a "sha256sums.txt" -m "${GIT_TAG}" "${GIT_TAG}"
90
+hub release create --draft \
91
+ -a "artifacts/netdata-${GIT_TAG}.tar.gz" \
92
+ -a "artifacts/netdata-${GIT_TAG}.gz.run" \
93
+ -a "artifacts/sha256sums.txt" \
94
+ -m "${GIT_TAG}" "${GIT_TAG}"
.travis/tagger.sh
-2
@@ -37,8 +37,6 @@ function release_candidate() {
37
RC=0
38
fi
39
GIT_TAG="v$VERSION-rc$RC"
40
- export GIT_TAG
41
- export RC
40
}
41
42
# Check if current commit is tagged or not
packaging/makeself/jobs/99-makeself.install.sh
+3
-2
@@ -90,5 +90,6 @@ run rm "${NETDATA_MAKESELF_PATH}/makeself.lsm.tmp"
90
91
FILE="netdata-${VERSION}.gz.run"
92
93
-run mv "${NETDATA_INSTALL_PATH}.gz.run" "${FILE}"
94
-echo >&2 "Self-extracting installer moved to '${FILE}'"
93
+run mkdir -p artifacts
94
+run mv "${NETDATA_INSTALL_PATH}.gz.run" "artifacts/${FILE}"
95
+echo >&2 "Self-extracting installer moved to 'artifacts/${FILE}'"