From 2eece8dc795fd83837353928fd59ffdcc6e357a0 Mon Sep 17 00:00:00 2001 From: Justin Dalrymple Date: Mon, 18 Oct 2021 11:48:46 -0400 Subject: [PATCH] Use yarnlock as checksum for build cache (#2162) Double check cache exists before attempting deployment --- .circleci/config.yml | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eace8b12..534a012a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -148,7 +148,7 @@ jobs: - run: yarn build - save_cache: name: Cache build files - key: build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + key: build-{{ checksum "yarn.lock" }} paths: - packages/core/dist/ - packages/cli/dist/ @@ -304,7 +304,7 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} - run: yarn workspace @gitbeaker/core test:integration test-integration-browser: @@ -321,7 +321,7 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} - restore_cache: name: Restore env vars keys: @@ -343,7 +343,7 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} - restore_cache: name: Restore env vars keys: @@ -365,7 +365,7 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} - restore_cache: name: Restore env vars keys: @@ -413,7 +413,17 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} + - run: | + NUM_RELEASES=$(find . -maxdepth 2 -name '*dist*' -type d -print | wc -l) + + if [[ $NUM_RELEASES -eq 5 ]] + then + echo "Release files are present. Continuing deployment" + else + echo "Release files are missing. Halting deployment" + circleci step halt + fi - run: | apk add --no-cache git openssh @@ -441,7 +451,17 @@ jobs: - restore_cache: name: Restore build cache keys: - - build-{{ .Environment.CIRCLE_WORKFLOW_ID }} + - build-{{ checksum "yarn.lock" }} + - run: | + NUM_RELEASES=$(find . -maxdepth 2 -name '*dist*' -type d -print | wc -l) + + if [[ $NUM_RELEASES -eq 5 ]] + then + echo "Release files are present. Continuing deployment" + else + echo "Release files are missing. Halting deployment" + circleci step halt + fi - run: | apk add --no-cache git openssh