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
This commit is contained in:
Russel Waters 2019-09-03 19:43:57 -04:00 committed by GitHub
commit 84a11022ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -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

View file

@ -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/