From c6ef7ac4ed03de60937236a1ab2a87a9c0247f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Krupa?= Date: Thu, 10 Jan 2019 13:04:06 +0100 Subject: 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 --- .travis.yml | 11 ++++++----- packaging/docker/build.sh | 12 +++++++----- tests/lifecycle.sh | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07192b4e2e..a392498b80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,17 +37,18 @@ jobs: name: ubuntu 14.04 (not containerized) install: sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot script: fakeroot ./netdata-installer.sh --dont-wait --dont-start-it --install $HOME - - name: alpine + lifecycle - script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:alpine" ./tests/lifecycle.sh - - name: ubuntu 18.04 - script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:ubuntu1804" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp + - name: build container (alpine installation) + script: ./packaging/docker/build.sh + env: DEVEL="true" + - name: ubuntu 18.04 + lifecycle + script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:ubuntu1804" ./tests/lifecycle.sh - name: CentOS 7 script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos7" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp - name: CentOS 6 script: docker run -it -v "${PWD}:/code:rw" -w /code "netdata/os-test:centos6" ./netdata-installer.sh --dont-wait --dont-start-it --install /tmp - stage: packaging - name: Create release + name: Create release (only on special commit msg) install: - sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot python-pip - sudo apt install -y --only-upgrade docker-ce diff --git a/packaging/docker/build.sh b/packaging/docker/build.sh index 523a371937..f0ea5c7385 100755 --- a/packaging/docker/build.sh +++ b/packaging/docker/build.sh @@ -45,15 +45,17 @@ for ARCH in "${ARCHITECTURES[@]}"; do done wait +# There is no reason to continue if we cannot log in to docker hub +if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then + echo "No docker hub username or password specified. Exiting without pushing images to registry" + exit 0 +fi + # Create temporary docker CLI config with experimental features enabled (manifests v2 need it) mkdir -p /tmp/docker echo '{"experimental":"enabled"}' > /tmp/docker/config.json -# Login to docker hub to allow for futher operations -if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then - echo "No docker hub username or password specified. Exiting without pushing images to registry" - exit 1 -fi +# Login to docker hub to allow futher operations echo "$DOCKER_PASSWORD" | docker --config /tmp/docker login -u "$DOCKER_USERNAME" --password-stdin # Push images to registry diff --git a/tests/lifecycle.sh b/tests/lifecycle.sh index c0a0f7fc90..5a61904f9a 100755 --- a/tests/lifecycle.sh +++ b/tests/lifecycle.sh @@ -27,7 +27,7 @@ touch new_file git status echo "========= UPDATE =========" -/etc/periodic/daily/netdata-updater +/etc/cron.daily/netdata-updater echo "========= UNINSTALL =========" mv /tmp/netdata-uninstaller.sh ./netdata-uninstaller.sh -- cgit v1.2.3