mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00

A number of scripts relating to tooling used and the gate container image were not exiting upon errors as intended. Coupled with external service unavailability (i.e. downloading golangci-lint) was observed to cause difficult to debug failures. This change corrects the scripts inside/out of the gate container as well as fixes many golang related path consistency problems vs other CI jobs. After this change, all jobs use consistent path names reducing the number of special-case overrides needed. Lastly, I also made a documentation-pass, updating/correcting as needed, including documenting a likely local validation-failure mode, related to `$EPOCH_TEST_COMMIT`. This is dependent on the developers git environment, so documentation is the only possible "fix". Signed-off-by: Chris Evich <cevich@redhat.com>
55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script produces various bits of metadata needed by Makefile. Using
|
|
# a script allows uniform behavior across multiple environments and
|
|
# distributions. The script expects a single argument, as reflected below.
|
|
|
|
set -euo pipefail
|
|
|
|
cd "${GOSRC:-$(dirname $0)/../}"
|
|
|
|
valid_args() {
|
|
REGEX='^\s+[[:upper:]]+\*[)]'
|
|
egrep --text --no-filename --group-separator=' ' --only-matching "$REGEX" "$0" | \
|
|
cut -d '*' -f 1
|
|
}
|
|
|
|
unset OUTPUT
|
|
case "$1" in
|
|
# Wild-card suffix needed by valid_args() e.g. possible bad grep of "$(echo $FOO)"
|
|
VERSION*)
|
|
OUTPUT="${CIRRUS_TAG:-$(git fetch --tags && git describe HEAD 2> /dev/null)}"
|
|
;;
|
|
NUMBER*)
|
|
OUTPUT="$($0 VERSION | sed 's/-.*//')"
|
|
;;
|
|
DIST_VER*)
|
|
OUTPUT="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
|
|
;;
|
|
DIST*)
|
|
OUTPUT="$(source /etc/os-release; echo $ID)"
|
|
;;
|
|
ARCH*)
|
|
OUTPUT="${GOARCH:-$(go env GOARCH 2> /dev/null)}"
|
|
;;
|
|
BASENAME*)
|
|
OUTPUT="podman"
|
|
;;
|
|
REMOTENAME*)
|
|
OUTPUT="$($0 BASENAME)-remote"
|
|
;;
|
|
*)
|
|
echo "Error, unknown/unsupported argument '$1', valid arguments:"
|
|
valid_args
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [[ -n "$OUTPUT" ]]
|
|
then
|
|
echo -n "$OUTPUT"
|
|
else
|
|
echo "Error, empty output for info: '$1'" > /dev/stderr
|
|
exit 2
|
|
fi
|