Normalize snapshot and release artifacts (#789)

* refactor signing steps in release/snapshot workflows

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* show signing logs on snapshot or release failure

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* update install.sh + tests to account for new goreleaser changes

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* update cli tests to account for new goreleaser build names

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* fix acceptance test to use new snapshot bin path

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* add notarization

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* address review comments

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2022-02-04 12:41:37 -05:00
committed by GitHub
parent 40423d8eee
commit 341288ba29
24 changed files with 669 additions and 288 deletions
+2 -4
View File
@@ -101,10 +101,8 @@ func getSyftBinaryLocation(t testing.TB) string {
func getSyftBinaryLocationByOS(t testing.TB, goOS string) string {
// note: there is a subtle - vs _ difference between these versions
switch goOS {
case "darwin":
return path.Join(repoRoot(t), fmt.Sprintf("snapshot/syft-macos_darwin_%s/syft", runtime.GOARCH))
case "linux":
return path.Join(repoRoot(t), fmt.Sprintf("snapshot/syft_linux_%s/syft", runtime.GOARCH))
case "darwin", "linux":
return path.Join(repoRoot(t), fmt.Sprintf("snapshot/%s-build_%s_%s/syft", goOS, goOS, runtime.GOARCH))
default:
t.Fatalf("unsupported OS: %s", runtime.GOOS)
}
+1 -1
View File
@@ -39,7 +39,7 @@ else
fi
# run syft
SYFT_PATH="${DISTDIR}/syft-macos_darwin_amd64/syft"
SYFT_PATH="${DISTDIR}/darwin-build_darwin_amd64/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}"
@@ -72,9 +72,7 @@ run_test_case test_positive_snapshot_download_asset "linux" "arm64" "tar.gz"
run_test_case test_positive_snapshot_download_asset "linux" "arm64" "rpm"
run_test_case test_positive_snapshot_download_asset "linux" "arm64" "deb"
run_test_case test_positive_snapshot_download_asset "darwin" "amd64" "tar.gz"
run_test_case test_positive_snapshot_download_asset "darwin" "amd64" "zip"
run_test_case test_positive_snapshot_download_asset "darwin" "arm64" "tar.gz"
run_test_case test_positive_snapshot_download_asset "darwin" "arm64" "zip"
run_test_case test_positive_snapshot_download_asset "windows" "amd64" "zip"
# note: the mac signing process produces a dmg which is not part of the snapshot process (thus is not exercised here)
@@ -33,8 +33,6 @@ release=$(get_release_tag "${OWNER}" "${REPO}" "latest" )
# exercise all possible assets against a real github release (based on asset listing from https://github.com/anchore/syft/releases/tag/v0.36.0)
run_test_case test_download_release_asset "${release}" "darwin" "amd64" "tar.gz" "application/gzip"
run_test_case test_download_release_asset "${release}" "darwin" "arm64" "tar.gz" "application/gzip"
run_test_case test_download_release_asset "${release}" "darwin" "arm64" "zip" "application/zip"
run_test_case test_download_release_asset "${release}" "darwin" "amd64" "dmg" "application/zlib"
run_test_case test_download_release_asset "${release}" "linux" "amd64" "tar.gz" "application/gzip"
run_test_case test_download_release_asset "${release}" "linux" "amd64" "rpm" "application/x-rpm"
run_test_case test_download_release_asset "${release}" "linux" "amd64" "deb" "application/vnd.debian.binary-package"
+1 -9
View File
@@ -26,14 +26,8 @@ test_positive_snapshot_install_asset() {
expected_path="${install_dir}/${binary}"
assertFileExists "${expected_path}" "install_asset os=${os} arch=${arch} format=${format}"
build_dir_name="${name}"
if [ "$os" == "darwin" ]; then
# TODO: when we simplify the goreleaser build steps, this exception would not longer be expected
build_dir_name="${name}-macos"
fi
assertFilesEqual \
"$(snapshot_dir)/${build_dir_name}_${os}_${arch}/${binary}" \
"$(snapshot_dir)/${os}-build_${os}_${arch}/${binary}" \
"${expected_path}" \
"unable to verify installation of os=${os} arch=${arch} format=${format}"
@@ -83,9 +77,7 @@ trap 'teardown_snapshot_server ${worker_pid}' EXIT
run_test_case test_positive_snapshot_install_asset "linux" "amd64" "tar.gz"
run_test_case test_positive_snapshot_install_asset "linux" "arm64" "tar.gz"
run_test_case test_positive_snapshot_install_asset "darwin" "amd64" "tar.gz"
run_test_case test_positive_snapshot_install_asset "darwin" "amd64" "zip"
run_test_case test_positive_snapshot_install_asset "darwin" "arm64" "tar.gz"
run_test_case test_positive_snapshot_install_asset "darwin" "arm64" "zip"
run_test_case test_positive_snapshot_install_asset "windows" "amd64" "zip"
# let's make certain we covered all assets that were expected