From 8220166a5977bedf534172207d8f46b773f149c8 Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 19 Jul 2021 12:59:41 +0200 Subject: [PATCH 1/5] Add go cache to circle ci lint and test workflows --- .circleci/config.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8544a5d83f..67caa2abe5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,6 +72,11 @@ jobs: steps: - checkout - install-go + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" - run: name: Install Linting Tools command: | @@ -81,6 +86,10 @@ jobs: - run: name: Lint command: make lint + - save_cache: + key: go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" test: machine: @@ -89,6 +98,11 @@ jobs: steps: - checkout - install-go + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" - run: name: Initialize Credentials command: | @@ -110,6 +124,10 @@ jobs: - run: name: Go Tests command: make test + - save_cache: + key: go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" build-and-upload-cli: docker: From c369de84acc32611932067d4018903fb585918cf Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 19 Jul 2021 13:32:03 +0200 Subject: [PATCH 2/5] Make cache more generic --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67caa2abe5..46f1864f11 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,8 +101,7 @@ jobs: - restore_cache: keys: - go-mod-v4-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" + - go-mod-v4- - run: name: Initialize Credentials command: | From c2c367696619034ee74953e962fbd171b9ada8ef Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 19 Jul 2021 13:32:51 +0200 Subject: [PATCH 3/5] Add missing statement --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46f1864f11..70a387a1e5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,8 +75,7 @@ jobs: - restore_cache: keys: - go-mod-v4-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" + - go-mod-v4- - run: name: Install Linting Tools command: | From a44c631db681fd03fbe618467f7c60c023acc3c4 Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 19 Jul 2021 13:50:40 +0200 Subject: [PATCH 4/5] Fix circleci GOPATH --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 70a387a1e5..19cedcc77f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,8 @@ commands: rm -rf go*.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV echo 'export PATH=$PATH:~/go/bin' >> $BASH_ENV + mkdir ~/go + echo 'export GOPATH=~/go' >> $BASH_ENV quay-login: description: Log Docker agent into Quay.io @@ -88,7 +90,7 @@ jobs: - save_cache: key: go-mod-v4-{{ checksum "go.sum" }} paths: - - "/go/pkg/mod" + - "~/go/pkg/mod" test: machine: @@ -125,7 +127,7 @@ jobs: - save_cache: key: go-mod-v4-{{ checksum "go.sum" }} paths: - - "/go/pkg/mod" + - "~/go/pkg/mod" build-and-upload-cli: docker: From 96a03e61ca5183a5d0b4049031f12e5f3c525905 Mon Sep 17 00:00:00 2001 From: Miguel Varela Ramos Date: Mon, 19 Jul 2021 13:55:34 +0200 Subject: [PATCH 5/5] Force cache clear --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 19cedcc77f..7aafe50b4a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,8 +76,8 @@ jobs: - install-go - restore_cache: keys: - - go-mod-v4-{{ checksum "go.sum" }} - - go-mod-v4- + - go-mod-v1-{{ checksum "go.sum" }} + - go-mod-v1- - run: name: Install Linting Tools command: | @@ -88,7 +88,7 @@ jobs: name: Lint command: make lint - save_cache: - key: go-mod-v4-{{ checksum "go.sum" }} + key: go-mod-v1-{{ checksum "go.sum" }} paths: - "~/go/pkg/mod" @@ -101,8 +101,8 @@ jobs: - install-go - restore_cache: keys: - - go-mod-v4-{{ checksum "go.sum" }} - - go-mod-v4- + - go-mod-v1-{{ checksum "go.sum" }} + - go-mod-v1- - run: name: Initialize Credentials command: | @@ -125,7 +125,7 @@ jobs: name: Go Tests command: make test - save_cache: - key: go-mod-v4-{{ checksum "go.sum" }} + key: go-mod-v1-{{ checksum "go.sum" }} paths: - "~/go/pkg/mod"