From 0535cfdaf9cb7b4c7b2d9085b8545384c1355133 Mon Sep 17 00:00:00 2001 From: Weston Steimel Date: Thu, 28 Jul 2022 14:13:48 +0100 Subject: [PATCH 1/6] bump goreleaser to v1.10.3 Signed-off-by: Weston Steimel --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5cd41a213c9..4c11b52c32b 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,7 @@ bootstrap-tools: $(TEMPDIR) curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TEMPDIR)/ v1.45.0 curl -sSfL https://raw.githubusercontent.com/wagoodman/go-bouncer/master/bouncer.sh | sh -s -- -b $(TEMPDIR)/ v0.3.0 curl -sSfL https://raw.githubusercontent.com/anchore/chronicle/main/install.sh | sh -s -- -b $(TEMPDIR)/ v0.3.0 - .github/scripts/goreleaser-install.sh -d -b $(TEMPDIR)/ v1.4.1 + .github/scripts/goreleaser-install.sh -d -b $(TEMPDIR)/ v1.10.3 GOBIN="$(shell realpath $(TEMPDIR))" go install github.com/neilpa/yajsv@v1.4.0 GOBIN="$(shell realpath $(TEMPDIR))" go install github.com/sigstore/cosign/cmd/cosign@v1.5.1 From a336b480233479ed28d7f180fdaf3eb8589bbe2d Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Thu, 28 Jul 2022 11:30:52 -0400 Subject: [PATCH 2/6] update install tests Signed-off-by: Christopher Phillips --- test/install/3_install_asset_test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/install/3_install_asset_test.sh b/test/install/3_install_asset_test.sh index bf3b86c5033..03d4045b778 100755 --- a/test/install/3_install_asset_test.sh +++ b/test/install/3_install_asset_test.sh @@ -26,6 +26,9 @@ test_positive_snapshot_install_asset() { expected_path="${install_dir}/${binary}" assertFileExists "${expected_path}" "install_asset os=${os} arch=${arch} format=${format}" + if [ $arch == "amd64" ]; then + arch="amd64_v1" + fi assertFilesEqual \ "$(snapshot_dir)/${os}-build_${os}_${arch}/${binary}" \ "${expected_path}" \ From 5d5746c9b5f1d8d98ab4ba56de7f3019e3484625 Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Thu, 28 Jul 2022 11:32:57 -0400 Subject: [PATCH 3/6] update Makefile path for SNAPSHOT_BIN Signed-off-by: Christopher Phillips --- Makefile | 2 +- test/install/3_install_asset_test.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4c11b52c32b..6ab3b2c11ad 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ BOOTSTRAP_CACHE="c7afb99ad" DISTDIR=./dist SNAPSHOTDIR=./snapshot OS=$(shell uname | tr '[:upper:]' '[:lower:]') -SNAPSHOT_BIN=$(shell realpath $(shell pwd)/$(SNAPSHOTDIR)/$(OS)-build_$(OS)_amd64/$(BIN)) +SNAPSHOT_BIN=$(shell realpath $(shell pwd)/$(SNAPSHOTDIR)/$(OS)-build_$(OS)_amd64_v1/$(BIN)) ## Variable assertions diff --git a/test/install/3_install_asset_test.sh b/test/install/3_install_asset_test.sh index 03d4045b778..743c75129da 100755 --- a/test/install/3_install_asset_test.sh +++ b/test/install/3_install_asset_test.sh @@ -26,9 +26,12 @@ test_positive_snapshot_install_asset() { expected_path="${install_dir}/${binary}" assertFileExists "${expected_path}" "install_asset os=${os} arch=${arch} format=${format}" + # directory structure for arch has been updated as of go 1.18 + # https://goreleaser.com/customization/build/#why-is-there-a-_v1-suffix-on-amd64-buildsjk if [ $arch == "amd64" ]; then arch="amd64_v1" fi + assertFilesEqual \ "$(snapshot_dir)/${os}-build_${os}_${arch}/${binary}" \ "${expected_path}" \ From a262d487e8d3d1578172d714f4fc3b26ed58c82b Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Thu, 28 Jul 2022 11:44:28 -0400 Subject: [PATCH 4/6] update go test function for new snapshot path Signed-off-by: Christopher Phillips --- test/cli/utils_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/cli/utils_test.go b/test/cli/utils_test.go index e985cc9833f..83f3862af49 100644 --- a/test/cli/utils_test.go +++ b/test/cli/utils_test.go @@ -225,7 +225,11 @@ func getSyftBinaryLocationByOS(t testing.TB, goOS string) string { // note: there is a subtle - vs _ difference between these versions switch goOS { case "darwin", "linux": - return path.Join(repoRoot(t), fmt.Sprintf("snapshot/%s-build_%s_%s/syft", goOS, goOS, runtime.GOARCH)) + archPath := runtime.GOARCH + if runtime.GOARCH == "amd64" { + archPath = fmt.Sprintf("%s_v1", archPath) + } + return path.Join(repoRoot(t), fmt.Sprintf("snapshot/%s-build_%s_%s/syft", goOS, goOS, archPath)) default: t.Fatalf("unsupported OS: %s", runtime.GOOS) } From 6199167ce65d860450f5c5988a61729d0a91800b Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Thu, 28 Jul 2022 11:56:05 -0400 Subject: [PATCH 5/6] add arch before case Signed-off-by: Christopher Phillips --- test/cli/utils_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/cli/utils_test.go b/test/cli/utils_test.go index 83f3862af49..5751dea66b5 100644 --- a/test/cli/utils_test.go +++ b/test/cli/utils_test.go @@ -222,13 +222,15 @@ func getSyftBinaryLocation(t testing.TB) string { } func getSyftBinaryLocationByOS(t testing.TB, goOS string) string { + // note: for amd64 we need to update the snapshot location with the v1 suffix + // see : https://goreleaser.com/customization/build/#why-is-there-a-_v1-suffix-on-amd64-builds + archPath := runtime.GOARCH + if runtime.GOARCH == "amd64" { + archPath = fmt.Sprintf("%s_v1", archPath) + } // note: there is a subtle - vs _ difference between these versions switch goOS { case "darwin", "linux": - archPath := runtime.GOARCH - if runtime.GOARCH == "amd64" { - archPath = fmt.Sprintf("%s_v1", archPath) - } return path.Join(repoRoot(t), fmt.Sprintf("snapshot/%s-build_%s_%s/syft", goOS, goOS, archPath)) default: t.Fatalf("unsupported OS: %s", runtime.GOOS) From 4c8b8ca71536aeaae12e8c019528f17554aef3bc Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Thu, 28 Jul 2022 12:47:17 -0400 Subject: [PATCH 6/6] update pathing for mac.sh Signed-off-by: Christopher Phillips --- test/compare/mac.sh | 2 +- test/compare/rpm.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/compare/mac.sh b/test/compare/mac.sh index 7d52f4cb55a..3aadab2e2a0 100755 --- a/test/compare/mac.sh +++ b/test/compare/mac.sh @@ -39,7 +39,7 @@ else fi # run syft -SYFT_PATH="${DISTDIR}/darwin-build_darwin_amd64/syft" +SYFT_PATH="${DISTDIR}/darwin-build_darwin_amd64_v1/syft" chmod 755 "${SYFT_PATH}" "${SYFT_PATH}" version SYFT_CHECK_FOR_APP_UPDATE=0 "${SYFT_PATH}" packages docker-archive:${TEST_IMAGE_TAR} -vv -o json > "${REPORT}" diff --git a/test/compare/rpm.sh b/test/compare/rpm.sh index 53d6800c064..d84ff6df191 100755 --- a/test/compare/rpm.sh +++ b/test/compare/rpm.sh @@ -53,4 +53,4 @@ ${ACC_DIR}/compare.py \ ${GOLDEN_REPORT} \ ${REPORT} | tee ${RESULTSDIR}/acceptance-${TEST_TYPE}.txt -EXIT_CODE=0 \ No newline at end of file +EXIT_CODE=0