mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 23:46:35 +01:00
Add docker image and refactor release pipeline (#310)
* 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>
This commit is contained in:
co-authored by
Alex Goodman
parent
8c4370b7cc
commit
6195002ae5
+14
-11
@@ -7,19 +7,23 @@ ACC_DIR=$2
|
||||
TEST_IMAGE=$3
|
||||
RESULTSDIR=$4
|
||||
|
||||
TEST_IMAGE_TAR=/tmp/image.tar
|
||||
TEST_TYPE=mac
|
||||
WORK_DIR=`mktemp -d -t "syft-acceptance-test-${TEST_TYPE}-XXXXXX"`
|
||||
NORMAL_TEST_IMAGE=$(echo ${TEST_IMAGE} | tr ':' '-' )
|
||||
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=$?
|
||||
@@ -33,20 +37,19 @@ trap cleanup EXIT
|
||||
skopeo --version || brew install skopeo
|
||||
|
||||
# fetch test image
|
||||
skopeo --override-os linux copy docker://docker.io/${TEST_IMAGE} docker-archive:${TEST_IMAGE_TAR}
|
||||
ls -alh ${TEST_IMAGE_TAR}
|
||||
skopeo --override-os linux --insecure-policy copy "docker://docker.io/${TEST_IMAGE}" "docker-archive:${TEST_IMAGE_TAR}"
|
||||
ls -alh "${TEST_IMAGE_TAR}"
|
||||
|
||||
# run syft
|
||||
SYFT_PATH="${DISTDIR}/syft-macos_darwin_amd64/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}"
|
||||
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}
|
||||
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
|
||||
"${GOLDEN_REPORT}" \
|
||||
"${REPORT}" | tee "${RESULTSDIR}/acceptance-${TEST_TYPE}.txt"
|
||||
|
||||
Reference in New Issue
Block a user