syft/test/acceptance/compare.sh
Alex Goodman ba4f63099d
Add release process (#89)
* add check for app update; fix ETUI error handling

* validate user args

* add goreleaser support

* replace cgo dependencies (go-rpm) with go equivalents

* add acceptance tests against build snapshot

* add brew tap + acceptance test pipeline

* add mac acceptance tests

* fix compare makefile

* fix mac acceptance tests

* add release pipeline with wait checks

* add token to release step

* rm dir presenters int test

* enforce dpkg to be non interactive

Co-authored-by: Alfredo Deza <adeza@anchore.com>

* pin brew formulae

* pin skopeo to formulae url

* only run acceptance tests

Co-authored-by: Alfredo Deza <adeza@anchore.com>
2020-07-23 10:52:44 -04:00

27 lines
No EOL
657 B
Bash
Executable file

#!/usr/bin/env bash
set -eu
BOLD="$(tput -T linux bold)"
RED="$(tput -T linux setaf 1)"
RESET="$(tput -T linux sgr0)"
FAIL="${BOLD}${RED}"
SUCCESS="${BOLD}"
JQ_ARGS="-S .artifacts"
if ! command -v jq &> /dev/null ;then
JQ_IMAGE="imega/jq:latest"
JQ_CMD="docker run --rm -i ${JQ_IMAGE} ${JQ_ARGS}"
docker pull "${JQ_IMAGE}"
else
JQ_CMD="jq ${JQ_ARGS}"
fi
if [[ $(cat $1 | ${JQ_CMD}) ]]; then
set -x
# compare the output of both results
diff <(cat $1 | ${JQ_CMD}) <(cat $2 | ${JQ_CMD})
set +x
echo "${SUCCESS}Comparison passed!${RESET}"
else
exit "${FAIL}Failing since one of the test files is empty ($1)${RESET}"
fi