From e3b1522394899227e1292f9da57887046567c57d Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Tue, 23 Mar 2021 06:58:30 -0400 Subject: [PATCH] upgrade goreleaser + constrain pipeline tool cache Signed-off-by: Alex Goodman --- .github/workflows/release.yaml | 29 +++++++++++++++++++---------- .goreleaser.yaml | 7 ++----- Makefile | 10 +++++----- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1721d9152..16d2500d1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -103,23 +103,32 @@ jobs: with: fetch-depth: 0 - # We are expecting this cache to have been created during the "Build-Snapshot-Artifacts" job in the "Acceptance" workflow. - - name: Restore bootstrap cache - id: cache + - name: Restore tool cache + id: tool-cache uses: actions/cache@v2.1.3 with: - path: | - ~/go/pkg/mod - ${{ github.workspace }}/.tmp - key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}-${{ hashFiles('Makefile') }} + path: ${{ github.workspace }}/.tmp + key: ${{ runner.os }}-tool-${{ hashFiles('Makefile') }} + + - name: Restore go cache + id: go-cache + uses: actions/cache@v2.1.3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}- ${{ runner.os }}-go-${{ env.GO_VERSION }}- - - name: Bootstrap project dependencies - if: steps.bootstrap-cache.outputs.cache-hit != 'true' + - name: (cache-miss) Bootstrap all project dependencies + if: steps.tool-cache.outputs.cache-hit != 'true' || steps.go-cache.outputs.cache-hit != 'true' run: make bootstrap + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.TOOLBOX_DOCKER_USER }} + password: ${{ secrets.TOOLBOX_DOCKER_PASS }} + - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v2 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index bd8c7749e..2317d3bbf 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -92,18 +92,15 @@ brews: description: *description dockers: - - - binaries: - - syft - dockerfile: Dockerfile + - dockerfile: Dockerfile image_templates: - "anchore/syft:latest" - "anchore/syft:{{ .Tag }}" - "anchore/syft:v{{ .Major }}" - "anchore/syft:v{{ .Major }}.{{ .Minor }}" - build_flag_templates: - "--build-arg=BUILD_DATE={{.Date}}" - "--build-arg=BUILD_VERSION={{.Version}}" - "--build-arg=VCS_REF={{.FullCommit}}" - "--build-arg=VCS_URL={{.GitURL}}" + use_buildx: true diff --git a/Makefile b/Makefile index 35d4cb09e..fe74cc184 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ COVERAGE_THRESHOLD := 68 # CI cache busting values; change these if you want CI to not use previous stored cache INTEGRATION_CACHE_BUSTER="23493ba738c3d2f" CLI_CACHE_BUSTER="789bacdf" -BOOTSTRAP_CACHE="789bacdf" +BOOTSTRAP_CACHE="c7afb99ad" ## Build variables DISTDIR=./dist @@ -100,10 +100,10 @@ $(TEMPDIR): .PHONY: bootstrap-tools bootstrap-tools: $(TEMPDIR) - [ -f "$(TEMPDIR)/benchstat" ] || GO111MODULE=off GOBIN=$(shell realpath $(TEMPDIR)) go get -u golang.org/x/perf/cmd/benchstat - [ -f "$(TEMPDIR)/golangci" ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TEMPDIR)/ v1.26.0 - [ -f "$(TEMPDIR)/bouncer" ] || curl -sSfL https://raw.githubusercontent.com/wagoodman/go-bouncer/master/bouncer.sh | sh -s -- -b $(TEMPDIR)/ v0.2.0 - [ -f "$(TEMPDIR)/goreleaser" ] || curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(TEMPDIR)/ v0.140.0 + GO111MODULE=off GOBIN=$(shell realpath $(TEMPDIR)) go get -u golang.org/x/perf/cmd/benchstat + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TEMPDIR)/ v1.26.0 + curl -sSfL https://raw.githubusercontent.com/wagoodman/go-bouncer/master/bouncer.sh | sh -s -- -b $(TEMPDIR)/ v0.2.0 + curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(TEMPDIR)/ v0.160.0 .PHONY: bootstrap-go bootstrap-go: