mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Cirrus: Load base-image names indirectly
Rather than hard-coding all four base-image env. var name, load the values based on the shared variable name suffix. Thanks to Ed Santiago <santiago@redhat.com> for the suggestion. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
@ -6,13 +6,17 @@ source /usr/local/bin/lib_entrypoint.sh
|
|||||||
|
|
||||||
req_env_var GCPJSON GCPNAME GCPPROJECT IMGNAMES
|
req_env_var GCPJSON GCPNAME GCPPROJECT IMGNAMES
|
||||||
|
|
||||||
BASE_IMAGES=""
|
unset BASE_IMAGES
|
||||||
# When executing under Cirrus-CI, have access to current source
|
# When executing under Cirrus-CI, script have access to current source
|
||||||
if [[ "$CI" == "true" ]] && [[ -r "$CIRRUS_WORKING_DIR/$SCRIPT_BASE" ]]
|
LIB="$CIRRUS_WORKING_DIR/$SCRIPT_BASE/lib.sh"
|
||||||
|
if [[ "$CI" == "true" ]] && [[ -r "$LIB" ]]
|
||||||
then
|
then
|
||||||
# Avoid importing anything that might conflict
|
# Avoid importing anything that might conflict
|
||||||
eval "$(egrep -sh '^export .+BASE_IMAGE=' < $CIRRUS_WORKING_DIR/$SCRIPT_BASE/lib.sh)"
|
for env in $(sed -ne 's/^[^#]\+_BASE_IMAGE=/img=/p' "$LIB")
|
||||||
BASE_IMAGES="$UBUNTU_BASE_IMAGE $PRIOR_UBUNTU_BASE_IMAGE $FEDORA_BASE_IMAGE $PRIOR_FEDORA_BASE_IMAGE"
|
do
|
||||||
|
eval $env
|
||||||
|
BASE_IMAGES="$BASE_IMAGES $img"
|
||||||
|
done
|
||||||
else
|
else
|
||||||
# metadata labeling may have broken for some reason in the future
|
# metadata labeling may have broken for some reason in the future
|
||||||
echo "Warning: Running outside of Cirrus-CI, very minor-risk of base-image deletion."
|
echo "Warning: Running outside of Cirrus-CI, very minor-risk of base-image deletion."
|
||||||
|
Reference in New Issue
Block a user