From 44e8d062b441df8cac8c956a4c72565c8df5d1f1 Mon Sep 17 00:00:00 2001 From: redshiftzero Date: Mon, 15 Apr 2019 21:49:55 -0700 Subject: [PATCH] ci: fix app-test job, DRY up docker layer cache loading --- .circleci/config.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 454a745a1e..5fb921f520 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,15 +30,15 @@ common-steps: command: | set +o pipefail docker images - fromtag=$(docker images |grep securedrop-test-xenial |head -n1 |awk '{print $2}') - cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial:${fromtag:-latest}" ./bin/dev-shell true + fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}') + cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" ./bin/dev-shell true - &saveimagelayers run: name: Save Docker image layer cache command: | docker images - docker save -o /caches/layers.tar securedrop-test-xenial:latest + docker save -o /caches/layers.tar securedrop-test-xenial-py2:latest - &savecache save_cache: @@ -73,11 +73,7 @@ jobs: paths: - /caches/layers.tar.gz - - run: - name: Load image layer cache - command: | - set +o pipefail - docker load -i /caches/layers.tar |true + - *loadimagelayers - run: name: Build Docker image @@ -141,9 +137,9 @@ jobs: name: Run tests command: | export TESTFILES=$(cd securedrop; circleci tests glob 'tests/test*py' 'tests/**/test*py' |circleci tests split --split-by=timings |xargs echo) - docker rm -f securedrop-test-xenial || true - fromtag=$(docker images |grep securedrop-test-xenial |head -n1 |awk '{print $2}') - cd securedrop && DOCKER_RUN_ARGUMENTS=$(bash <(curl -s https://codecov.io/env)) DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial:${fromtag:-latest}" make test + docker rm -f securedrop-test-xenial-py2 || true + fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}') + cd securedrop && DOCKER_RUN_ARGUMENTS=$(bash <(curl -s https://codecov.io/env)) DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" make test - store_test_results: path: ~/test-results @@ -169,11 +165,7 @@ jobs: paths: - /caches/layers.tar.gz - - run: - name: Load image layer cache - command: | - set +o pipefail - docker load -i /caches/layers.tar |true + - *loadimagelayers - run: name: Build Docker images @@ -237,9 +229,9 @@ jobs: name: Run tests command: | export TESTFILES=$(cd securedrop; circleci tests glob 'tests/pageslayout/test*py' |circleci tests split --split-by=timings |xargs echo) - docker rm -f securedrop-test-xenial || true - fromtag=$(docker images |grep securedrop-test-xenial |head -n1 |awk '{print $2}') - cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial:${fromtag:-latest}" make translation-test + docker rm -f securedrop-test-xenial-py2 || true + fromtag=$(docker images |grep securedrop-test-xenial-py2 |head -n1 |awk '{print $2}') + cd securedrop && DOCKER_BUILD_ARGUMENTS="--cache-from securedrop-test-xenial-py2:${fromtag:-latest}" make translation-test - store_test_results: path: ~/test-results