test building docker container on every PR (#5145)
* test building docker container on every PR * fix docker building and switch lifecycle test to use ubuntu cron * clarify stage name
Paweł Krupa committed
Jan 10, 2019 at 13:04 UTC
c6ef7ac4ed03de60937236a1ab2a87a9c0247f15
3 files changed
+14
-11
.travis.yml
+6
-5
@@ -37,17 +37,18 @@ jobs:
37
name: ubuntu 14.04 (not containerized)
38
install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot
39
script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME
40
- - name: alpine + lifecycle
41
- script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:alpine" ./tests/lifecycle.sh
42
- - name: ubuntu 18.04
43
- script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:ubuntu1804" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp
40
+ - name: build container (alpine installation)
41
+ script: ./packaging/docker/build.sh
42
+ env: DEVEL="true"
43
+ - name: ubuntu 18.04 + lifecycle
44
+ script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:ubuntu1804" ./tests/lifecycle.sh
45
- name: CentOS 7
46
script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp
47
- name: CentOS 6
48
script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos6" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp
49
50
- stage: packaging
50
- name: Create release
51
+ name: Create release (only on special commit msg)
52
install:
53
- sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot python-pip
54
- sudo apt install -y --only-upgrade docker-ce
packaging/docker/build.sh
+7
-5
@@ -45,15 +45,17 @@ for ARCH in "${ARCHITECTURES[@]}"; do
45
done
46
wait
47
48
+# There is no reason to continue if we cannot log in to docker hub
49
+if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then
50
+ echo "No docker hub username or password specified. Exiting without pushing images to registry"
51
+ exit 0
52
+fi
53
+
54
# Create temporary docker CLI config with experimental features enabled (manifests v2 need it)
55
mkdir -p /tmp/docker
56
echo '{"experimental":"enabled"}' > /tmp/docker/config.json
57
52
-# Login to docker hub to allow for futher operations
53
-if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then
54
- echo "No docker hub username or password specified. Exiting without pushing images to registry"
55
- exit 1
56
-fi
58
+# Login to docker hub to allow futher operations
59
echo "$DOCKER_PASSWORD" | docker --config /tmp/docker login -u "$DOCKER_USERNAME" --password-stdin
60
61
# Push images to registry
tests/lifecycle.sh
+1
-1
@@ -27,7 +27,7 @@ touch new_file
27
git status
28
29
echo "========= UPDATE ========="
30
-/etc/periodic/daily/netdata-updater
30
+/etc/cron.daily/netdata-updater
31
32
echo "========= UNINSTALL ========="
33
mv /tmp/netdata-uninstaller.sh ./netdata-uninstaller.sh