From 98cdf38a59c91d1b517fa1060cf608717609225d Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Fri, 27 May 2022 20:16:02 +0300 Subject: [PATCH 1/4] Fail CircleCI early * Fail CircleCI pipeline on any error by switching from `set +e` to `set -e` * While here remove trailing whitespaces from CircleCI config file --- .circleci/config.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f012825..ca06917e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,9 +11,9 @@ jobs: steps: - checkout - - run: - command: | - set +e + - run: + command: | + set -e echo "Building website" sudo apt-get update sudo apt-get install python3 python3-pip @@ -22,7 +22,7 @@ jobs: mkdocs gh-deploy --force cd .. - echo "Building application" + echo "Building application" go get -v -t -d ./... go vet -tests=false ./... go test -v ./... @@ -38,11 +38,11 @@ jobs: steps: - checkout - - run: + - run: command: | - set +e + set +e source version - export RELEASE_VERSION; + export RELEASE_VERSION; RELEASE_VERSION=$RELEASE_VERSION.${CIRCLE_BUILD_NUM} export RELEASE_VERSION; echo $RELEASE_VERSION @@ -54,7 +54,7 @@ jobs: git tag -a ${RELEASE_VERSION} -m "Release Version" git push origin ${RELEASE_VERSION} curl -sL https://git.io/goreleaser | bash - + workflows: version: 2 @@ -70,6 +70,6 @@ workflows: - build filters: branches: - only: + only: - release From 4ab85e43716ef6b7237c6f445e40d60c31e6695d Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Fri, 27 May 2022 20:37:26 +0300 Subject: [PATCH 2/4] Drop `xargs` in favour of `while` loop and switch one another `set +e` --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca06917e..a5b49ff5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,9 @@ jobs: go test -v ./... mkdir -p build go build -v -o build/tfswitch - find ./test-data/* -type d | xargs -n 1 ./build/tfswitch -c + find ./test-data/* -type d -print0 | while read -r -d $'\0' TEST_PATH; do + ./build/tfswitch -c "${TEST_PATH}" || exit 1 + done release: docker: @@ -40,7 +42,7 @@ jobs: - checkout - run: command: | - set +e + set -e source version export RELEASE_VERSION; RELEASE_VERSION=$RELEASE_VERSION.${CIRCLE_BUILD_NUM} From 49579b9ae16c322c25af686a6460d167a3566f0d Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Fri, 27 May 2022 20:42:20 +0300 Subject: [PATCH 3/4] Push breaking change for testing --- test-data/test_tfswitchtoml/.tfswitch.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/test_tfswitchtoml/.tfswitch.toml b/test-data/test_tfswitchtoml/.tfswitch.toml index f234e9cc..808d303d 100644 --- a/test-data/test_tfswitchtoml/.tfswitch.toml +++ b/test-data/test_tfswitchtoml/.tfswitch.toml @@ -1,2 +1,2 @@ -bin = "/usr/local/bin/terraform" +bin = "/usr/local/NONEXISTENT/bin/terraform" version = "0.11.3" From 518152ccc77e9e8717681ad0cb6471dd8ff440be Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Fri, 27 May 2022 20:43:48 +0300 Subject: [PATCH 4/4] Revert last change --- test-data/test_tfswitchtoml/.tfswitch.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/test_tfswitchtoml/.tfswitch.toml b/test-data/test_tfswitchtoml/.tfswitch.toml index 808d303d..f234e9cc 100644 --- a/test-data/test_tfswitchtoml/.tfswitch.toml +++ b/test-data/test_tfswitchtoml/.tfswitch.toml @@ -1,2 +1,2 @@ -bin = "/usr/local/NONEXISTENT/bin/terraform" +bin = "/usr/local/bin/terraform" version = "0.11.3"