From 84a11022ad767cb08a4f0e673d02a4880e918f38 Mon Sep 17 00:00:00 2001 From: Russel Waters Date: Tue, 3 Sep 2019 19:43:57 -0400 Subject: [PATCH] add master tag for beta and caching for subsequent artifacts_beta builds (#2276) * add master tag for beta and caching for subsequent artifacts_beta builds * update latest tag for nanocurrency/nano-beta docker image on RC and DB updates as well --- .travis.yml | 6 ++++++ ci/deploy-docker.sh | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7022af50..e2c54ade 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: cpp stages: - build_base - build_env + - master_beta_docker - tag_test - test - artifacts_beta @@ -23,6 +24,11 @@ jobs: if: branch=master AND type=push script: - if [ -n "$DOCKER_PASSWORD" ]; then ci/deploy-docker.sh; fi; + - stage: master_beta_docker + name: "beta docker master tag" + if: tag =~RC|DB + script: + - if [ -n "$DOCKER_PASSWORD" ]; then TRAVIS_TAG="${TRAVIS_TAG}" ci/deploy-docker.sh; fi; - stage: tag_test name: "gcc" if: tag is present diff --git a/ci/deploy-docker.sh b/ci/deploy-docker.sh index cc80b132..de09bbcb 100755 --- a/ci/deploy-docker.sh +++ b/ci/deploy-docker.sh @@ -13,10 +13,14 @@ if [ -n "$DOCKER_PASSWORD" ]; then "$scripts"/custom-timeout.sh 30 docker push "$ci_image_name" fi - if [[ "$TRAVIS_BUILD_STAGE_NAME" =~ "Artifacts" ]]; then + if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Master_beta_docker" ]]; then + # quick build and tag beta network master + "$scripts"/custom-timeout.sh 30 docker build --build-arg NETWORK=beta --build-arg CI_BUILD=true --build-arg TRAVIS_TAG="$TRAVIS_TAG" -f docker/node/Dockerfile -t nanocurrency/nano-beta:master --cache-from nanocurrency/nano-beta:master . + "$scripts"/custom-timeout.sh 30 docker push nanocurrency/nano-beta:master + elif [[ "$TRAVIS_BUILD_STAGE_NAME" =~ "Artifacts" ]]; then tags=() if [[ "${TRAVIS_TAG}" =~ ("RC"|"DB") ]]; then - tags+=("$TRAVIS_TAG" latest-including-rc) + tags+=("$TRAVIS_TAG" latest latest-including-rc) elif [ -n "$TRAVIS_TAG" ]; then tags+=("$TRAVIS_TAG" latest latest-including-rc) elif [ -n "$TRAVIS_BRANCH" ]; then @@ -26,13 +30,17 @@ if [ -n "$DOCKER_PASSWORD" ]; then if [[ "$TRAVIS_JOB_NAME" =~ "live" ]]; then network_tag_suffix='' network="live" + cached='' else network_tag_suffix="-beta" network="beta" + # use cache from Master_beta_docker to prevent rebuilds + cached="--cache-from nanocurrency/nano-beta:master" + docker pull nanocurrency/nano-beta:master fi docker_image_name="nanocurrency/nano${network_tag_suffix}" - "$scripts"/custom-timeout.sh 30 docker build --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg TRAVIS_TAG="$TRAVIS_TAG" -f docker/node/Dockerfile -t "$docker_image_name" . + "$scripts"/custom-timeout.sh 30 docker build "$cached" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg TRAVIS_TAG="$TRAVIS_TAG" -f docker/node/Dockerfile -t "$docker_image_name" . for tag in "${tags[@]}"; do # Sanitize docker tag # https://docs.docker.com/engine/reference/commandline/tag/