From a19a6f9accc37d2015acf88a9a84354eec0eadf6 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:26:02 +0300 Subject: [PATCH 01/15] Catch pipefail errors in Makefile https://stackoverflow.com/questions/33925523/how-to-set-pipefail-in-a-makefile --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index ccdd8a7..c88b24e 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ BUILD_DIR = ./dist/dive_linux_amd64 BUILD_PATH = $(BUILD_DIR)/$(BIN) PWD := ${CURDIR} PRODUCTION_REGISTRY = docker.io +SHELL = /bin/bash -o pipefail TEST_IMAGE = busybox:latest all: gofmt clean build From 741f95aa8ad7397fa7514c810b8591b85d174861 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:34:11 +0300 Subject: [PATCH 02/15] New goreleaser install method https://goreleaser.com/deprecations/#godownloader --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c88b24e..6ca1d29 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ ci-static-analysis: golangci-lint run ci-install-go-tools: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sudo sh -s -- -b /usr/local/bin/ latest + curl -sfL https://goreleaser.com/static/run > /usr/local/bin/goreleaser ci-install-ci-tools: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin/ "v0.122.0" From ac0fa872cd5747c37bd6f0817d5cbfdc5ff64894 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:45:14 +0300 Subject: [PATCH 03/15] Test what directories are available on PATH Actual for CircleCI and GitHub Actions --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ca1d29..ae0bebb 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,8 @@ ci-install-go-tools: curl -sfL https://goreleaser.com/static/run > /usr/local/bin/goreleaser ci-install-ci-tools: - curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b /usr/local/bin/ "v0.122.0" + echo ${PATH} + curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b ${HOME}/bin/ "v0.122.0" ci-docker-login: echo '${DOCKER_PASSWORD}' | docker login -u '${DOCKER_USERNAME}' --password-stdin '${PRODUCTION_REGISTRY}' From 0c9b09ea7757b7add4eeb3e7fd19c6b31591c3d7 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:47:23 +0300 Subject: [PATCH 04/15] Add PATH inspection to an earlier command --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ae0bebb..1001ff7 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,10 @@ ci-static-analysis: golangci-lint run ci-install-go-tools: - curl -sfL https://goreleaser.com/static/run > /usr/local/bin/goreleaser + echo ${PATH} + curl -sfL https://goreleaser.com/static/run > ${HOME}/bin/goreleaser ci-install-ci-tools: - echo ${PATH} curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b ${HOME}/bin/ "v0.122.0" ci-docker-login: From 6c0552e1820e6e0629fc40d8218800fddfcde0b6 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:53:07 +0300 Subject: [PATCH 05/15] Change PATH to $HOME/.local/bin for GitHub Actions PATH in GitHub Actions: /opt/hostedtoolcache/go/1.19.10/x64/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin PATH in CircleCI: /home/circleci/go/bin:/usr/local/go/bin:/home/circleci/bin:/home/circleci/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1001ff7..127c0e4 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,10 @@ ci-static-analysis: golangci-lint run ci-install-go-tools: - echo ${PATH} - curl -sfL https://goreleaser.com/static/run > ${HOME}/bin/goreleaser + curl -sfL https://goreleaser.com/static/run > ${HOME}/.local/bin/goreleaser ci-install-ci-tools: - curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b ${HOME}/bin/ "v0.122.0" + curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b ${HOME}/.local/bin/ "v0.122.0" ci-docker-login: echo '${DOCKER_PASSWORD}' | docker login -u '${DOCKER_USERNAME}' --password-stdin '${PRODUCTION_REGISTRY}' From 9fe4975733e264ac720a1d898e9bf3aea8507bf7 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 06:58:24 +0300 Subject: [PATCH 06/15] Debug GitHub Actions /home/runner/.local/bin It says this PATH dir does not exist --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 127c0e4..f59cc70 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ ci-static-analysis: golangci-lint run ci-install-go-tools: + pwd + ls -la + mkdir -p ${HOME}/.local/bin curl -sfL https://goreleaser.com/static/run > ${HOME}/.local/bin/goreleaser ci-install-ci-tools: From ba3c9125e19561de0d94ae2d919bcbc06a3bc64a Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:03:13 +0300 Subject: [PATCH 07/15] `golangci-lint` got new install URL too https://goreleaser.com/deprecations/#godownloader --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f59cc70..0237257 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,11 @@ ci-static-analysis: golangci-lint run ci-install-go-tools: - pwd - ls -la mkdir -p ${HOME}/.local/bin curl -sfL https://goreleaser.com/static/run > ${HOME}/.local/bin/goreleaser ci-install-ci-tools: - curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo sh -s -- -b ${HOME}/.local/bin/ "v0.122.0" + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${HOME}/.local/bin/ ci-docker-login: echo '${DOCKER_PASSWORD}' | docker login -u '${DOCKER_USERNAME}' --password-stdin '${PRODUCTION_REGISTRY}' From 3d7eb32d7e290ba55ca7645c1b667b5ae48b8621 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:18:29 +0300 Subject: [PATCH 08/15] Make `goreleaser` script executable --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 0237257..5fb9eb7 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ ci-static-analysis: ci-install-go-tools: mkdir -p ${HOME}/.local/bin curl -sfL https://goreleaser.com/static/run > ${HOME}/.local/bin/goreleaser + chmod +x ${HOME}/.local/bin/goreleaser ci-install-ci-tools: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${HOME}/.local/bin/ From ebe293c24bd9b28bfa6347905acb5699e6021ee5 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:25:47 +0300 Subject: [PATCH 09/15] `.goreleaser.yml` deprecated `brews.github` https://goreleaser.com/deprecations/?h=#brewsgithub --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index a76f758..68d2a57 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,7 +14,7 @@ builds: ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`. brews: - - github: + - tap: owner: wagoodman name: homebrew-dive homepage: "https://github.com/wagoodman/dive/" From 1eb78e1ab77e358bf5a4a4113a46e4f4788c9d5b Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:27:44 +0300 Subject: [PATCH 10/15] `.goreleaser.yml` deprecated `docker.binaries` https://goreleaser.com/deprecations/?h=#dockerbinaries --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 68d2a57..33a1240 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -37,7 +37,7 @@ nfpms: dockers: - - binaries: + ids: - dive dockerfile: Dockerfile # todo: on 1.0 remove 'v' prefix From 02182266ecbbe8376c57384652b504a389fc3209 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:44:19 +0300 Subject: [PATCH 11/15] `goreleaser` now adds `_v1` suffix to binaries https://goreleaser.com/customization/builds/#why-is-there-a-_v1-suffix-on-amd64-builds --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5fb9eb7..b48a980 100644 --- a/Makefile +++ b/Makefile @@ -90,9 +90,11 @@ ci-test-rpm-package-install: " ci-test-linux-run: - chmod 755 ./dist/dive_linux_amd64/dive && \ - ./dist/dive_linux_amd64/dive '${TEST_IMAGE}' --ci && \ - ./dist/dive_linux_amd64/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci + ls -la ./dist + ls -la ./dist/dist/dive_linux_amd64_v1 + chmod 755 ./dist/dive_linux_amd64_v1/dive && \ + ./dist/dive_linux_amd64_v1/dive '${TEST_IMAGE}' --ci && \ + ./dist/dive_linux_amd64_v1/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci # we're not attempting to test docker, just our ability to run on these systems. This avoids setting up docker in CI. ci-test-mac-run: From cd63ad53fba87a0ca87cffa2b599ea9a5bc8533a Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 07:58:00 +0300 Subject: [PATCH 12/15] Make tabs not spaces https://stackoverflow.com/questions/2131213/can-you-make-valid-makefiles-without-tab-characters --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b48a980..e759628 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ ci-test-rpm-package-install: ci-test-linux-run: ls -la ./dist - ls -la ./dist/dist/dive_linux_amd64_v1 + ls -la ./dist/dist/dive_linux_amd64_v1 chmod 755 ./dist/dive_linux_amd64_v1/dive && \ ./dist/dive_linux_amd64_v1/dive '${TEST_IMAGE}' --ci && \ ./dist/dive_linux_amd64_v1/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci From 7933564b4cedcb5340801a154a948f99832b04c7 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 08:03:27 +0300 Subject: [PATCH 13/15] `_v1` suffix for mac and windows --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e759628..5992dd6 100644 --- a/Makefile +++ b/Makefile @@ -91,19 +91,19 @@ ci-test-rpm-package-install: ci-test-linux-run: ls -la ./dist - ls -la ./dist/dist/dive_linux_amd64_v1 + ls -la ./dist/dive_linux_amd64_v1 chmod 755 ./dist/dive_linux_amd64_v1/dive && \ ./dist/dive_linux_amd64_v1/dive '${TEST_IMAGE}' --ci && \ ./dist/dive_linux_amd64_v1/dive --source docker-archive .data/test-kaniko-image.tar --ci --ci-config .data/.dive-ci # we're not attempting to test docker, just our ability to run on these systems. This avoids setting up docker in CI. ci-test-mac-run: - chmod 755 ./dist/dive_darwin_amd64/dive && \ - ./dist/dive_darwin_amd64/dive --source docker-archive .data/test-docker-image.tar --ci --ci-config .data/.dive-ci + chmod 755 ./dist/dive_darwin_amd64_v1/dive && \ + ./dist/dive_darwin_amd64_v1/dive --source docker-archive .data/test-docker-image.tar --ci --ci-config .data/.dive-ci # we're not attempting to test docker, just our ability to run on these systems. This avoids setting up docker in CI. ci-test-windows-run: - ./dist/dive_windows_amd64/dive --source docker-archive .data/test-docker-image.tar --ci --ci-config .data/.dive-ci + ./dist/dive_windows_amd64_v1/dive --source docker-archive .data/test-docker-image.tar --ci --ci-config .data/.dive-ci From d131aebc05b0cb3e3ea5d706c645a0552f0aafd2 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 08:15:41 +0300 Subject: [PATCH 14/15] `.goreleaser.yml` deprecated `brews.tap` https://goreleaser.com/deprecations/#brewstap --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 33a1240..b83bbef 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,7 +14,7 @@ builds: ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`. brews: - - tap: + - repository: owner: wagoodman name: homebrew-dive homepage: "https://github.com/wagoodman/dive/" From dfe9a8c5c96685259cc0fa0e2963c26434660b75 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Thu, 6 Jul 2023 08:19:29 +0300 Subject: [PATCH 15/15] `goreleaser` deprecated `--rm-dist` https://goreleaser.com/deprecations/#-rm-dist --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5992dd6..b5cb57f 100644 --- a/Makefile +++ b/Makefile @@ -34,16 +34,16 @@ ci-docker-logout: docker logout '${PRODUCTION_REGISTRY}' ci-publish-release: - goreleaser --rm-dist + goreleaser --clean ci-build-snapshot-packages: goreleaser \ --snapshot \ --skip-publish \ - --rm-dist + --clean ci-release: - goreleaser release --rm-dist + goreleaser release --clean # todo: add --pull=never when supported by host box ci-test-production-image: