From f392038d1dcfb46624ec9ebd268dfa732b84a94c Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sat, 3 Feb 2018 18:30:08 -0700 Subject: [PATCH] Deploy docker images in Travis --- .travis.yml | 10 ++++++++-- ci/build-docker-image.sh | 7 +++++++ ci/build-travis.sh | 6 ------ ci/deploy-docker.sh | 11 +++++++++++ 4 files changed, 26 insertions(+), 8 deletions(-) create mode 100755 ci/build-docker-image.sh create mode 100755 ci/deploy-docker.sh diff --git a/.travis.yml b/.travis.yml index 681ab2b8..f235bbf7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,10 +34,16 @@ compiler: before_install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo mkdir -p /etc/docker && echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json && sudo service docker restart; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update && brew install qt5 && brew cask install xquartz && brew upgrade boost && brew install rust; fi - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker pull lukealonso/raiblocks-ci:latest; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then travis_wait 40 ci/build-docker-image.sh docker/ci/Dockerfile nanocurrency/nano-ci; fi script: - if [ -n "$ONE_TIME_TESTS" ]; then ci/check-commit-format.sh; fi - if [ -n "$ONE_TIME_TESTS" ]; then doxygen doxygen.config; fi # TODO also deploy the built HTML - if [ "$TRAVIS_OS_NAME" = "osx" ]; then ci/build-travis.sh "/usr/local/opt/qt5/lib/cmake/Qt5"; fi - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker run -v $TRAVIS_BUILD_DIR:/workspace lukealonso/raiblocks-ci:latest /bin/bash -c "cd /workspace && ASAN=${ASAN} TSAN=${TSAN} ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then docker run -v $TRAVIS_BUILD_DIR:/workspace nanocurrency/nano-ci /bin/bash -c "cd /workspace && ASAN=${ASAN} TSAN=${TSAN} ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"; fi + +deploy: + provider: script + script: travis_wait 80 ci/deploy-docker.sh + on: + condition: -n "$ONE_TIME_TESTS" diff --git a/ci/build-docker-image.sh b/ci/build-docker-image.sh new file mode 100755 index 00000000..362e2536 --- /dev/null +++ b/ci/build-docker-image.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -eu + +docker pull "$2" || true +echo "Building $2" +# Output for the build is WAY too long for Travis logs +docker build -f "$1" -t "$2" --cache-from "$2" . > /dev/null 2>&1 diff --git a/ci/build-travis.sh b/ci/build-travis.sh index 032c5422..6189c723 100755 --- a/ci/build-travis.sh +++ b/ci/build-travis.sh @@ -48,12 +48,6 @@ else TRUE_CMD=true fi -if ! cargo --version &>/dev/null; then - # We'll update the docker image once this PR gets merged. - # If you're reading this comment on master, contact @PlasmaPower - apt-get update && apt-get install -yq cargo -fi - pushd load-tester cargo build --release popd diff --git a/ci/deploy-docker.sh b/ci/deploy-docker.sh new file mode 100755 index 00000000..05ea5745 --- /dev/null +++ b/ci/deploy-docker.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -eu + +docker login -u nanocurrency -p "$DOCKER_PASSWORD" + +# We push this just so it can be a cache next time +docker push nanocurrency/nano-ci + +# We don't need to build this unless we're deploying it +ci/build-docker-image.sh docker/node/Dockerfile nanocurrency/nano +docker push nanocurrency/nano