mirror of
https://github.com/anchore/syft.git
synced 2025-11-20 18:03:16 +01:00
* Create independent build targets for Mac and Linux Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Create targets for macOS signing and notarization Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Create target for Linux packaging Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Update release workflow and leverage new make targets Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Add release assets to release draft Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Add homebrew formula release follow-up and improve Makefile Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Add follow-up workflow for updating version check file Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Get rid of fetch depth 0 for checkout action Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Add follow-up workflow for Docker images Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Restore wait-for-checks job Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Replace make functions with shell functions Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * Account for envsubst command in bootstrap-ci-linux Signed-off-by: Dan Luhring <dan.luhring@anchore.com> * move homebrew generation into script Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * add release approval step; remove goreleaser; add docker image smoke testing in acceptance step Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * replace homebrew formula template file with heredoc template Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update release documentation Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
DISTDIR=$1
|
|
ACC_DIR=$2
|
|
TEST_IMAGE=$3
|
|
RESULTSDIR=$4
|
|
|
|
TEST_TYPE=mac
|
|
WORK_DIR=$(mktemp -d -t "syft-acceptance-test-${TEST_TYPE}-XXXXXX")
|
|
TEST_IMAGE_TAR=${WORK_DIR}/image.tar
|
|
NORMAL_TEST_IMAGE=$(echo "${TEST_IMAGE}" | tr ':' '-' )
|
|
REPORT=${WORK_DIR}/acceptance-${TEST_TYPE}-${NORMAL_TEST_IMAGE}.json
|
|
GOLDEN_REPORT=${ACC_DIR}/test-fixtures/acceptance-${NORMAL_TEST_IMAGE}.json
|
|
|
|
SYFT_PATH="${DISTDIR}/syft_darwin_amd64/syft"
|
|
|
|
# check if tmp dir was created
|
|
if [[ ! "${WORK_DIR}" || ! -d "${WORK_DIR}" ]]; then
|
|
echo "Could not create temp dir"
|
|
exit 1
|
|
fi
|
|
|
|
trap "rm -f ${WORK_DIR}/*; rmdir ${WORK_DIR};" EXIT
|
|
|
|
function cleanup {
|
|
# we should still preserve previous failures
|
|
exit_code=$?
|
|
rm -rf "${WORK_DIR}"
|
|
exit ${exit_code}
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
# install skopeo
|
|
skopeo --version || brew install skopeo
|
|
|
|
# fetch test image
|
|
skopeo --override-os linux --insecure-policy copy "docker://docker.io/${TEST_IMAGE}" "docker-archive:${TEST_IMAGE_TAR}"
|
|
ls -alh "${TEST_IMAGE_TAR}"
|
|
|
|
# run syft
|
|
chmod 755 "${SYFT_PATH}"
|
|
"${SYFT_PATH}" version
|
|
SYFT_CHECK_FOR_APP_UPDATE=0 "${SYFT_PATH}" "docker-archive://${TEST_IMAGE_TAR}" -vv -o json > "${REPORT}"
|
|
|
|
# keep the generated report around
|
|
mkdir -p "${RESULTSDIR}"
|
|
cp "${REPORT}" "${RESULTSDIR}"
|
|
|
|
# compare the results to a known good output
|
|
${ACC_DIR}/compare.py \
|
|
"${GOLDEN_REPORT}" \
|
|
"${REPORT}" | tee "${RESULTSDIR}/acceptance-${TEST_TYPE}.txt"
|