From 704c4c171f2e038477e1f30fe36d540f348775fc Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 28 Aug 2019 16:22:22 -0400 Subject: Cirrus: Remove image_prune YAML-alias workaround Originally when written, the image_prune_task was passing incorrect credentials into it's container. This was traced back to mishandling of a YAML-alias, and worked-around (including a comment). However, as of this commit, it appear YAML-alias substitution problem has been addressed. Restore the (correct) use of a YAML-alias so the correct credentials are passed into the prune container. Signed-off-by: Chris Evich --- .cirrus.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8d915fbfe..a1838c682 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -299,11 +299,9 @@ image_prune_task: memory: 1 env: - # order is significant, Cirrus not always overriding alias values as intended + <<: *meta_env_vars GCPJSON: ENCRYPTED[4c11d8e09c904c30fc70eecb95c73dec0ddf19976f9b981a0f80f3f6599e8f990bcef93c253ac0277f200850d98528e7] GCPNAME: ENCRYPTED[7f54557ba6e5a437f11283a53e71baec9ca546f48a9835538cc54d297f79968eb1337d4596a1025b14f9d1c5723fbd29] - GCPPROJECT: ENCRYPTED[7c80e728e046b1c76147afd156a32c1c57d4a1ac1eab93b7e68e718c61ca8564fc61fef815952b8ae0a64e7034b8fe4f] - <<: *meta_env_vars timeout_in: 10m -- cgit v1.2.3-54-g00ecf From 56f11b1016f90d73421fa71ee8a726d2d83c9349 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 28 Aug 2019 11:58:32 -0400 Subject: 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 for the suggestion. Signed-off-by: Chris Evich --- contrib/imgprune/entrypoint.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/contrib/imgprune/entrypoint.sh b/contrib/imgprune/entrypoint.sh index 829e9938e..b0f006332 100755 --- a/contrib/imgprune/entrypoint.sh +++ b/contrib/imgprune/entrypoint.sh @@ -6,13 +6,17 @@ source /usr/local/bin/lib_entrypoint.sh req_env_var GCPJSON GCPNAME GCPPROJECT IMGNAMES -BASE_IMAGES="" -# When executing under Cirrus-CI, have access to current source -if [[ "$CI" == "true" ]] && [[ -r "$CIRRUS_WORKING_DIR/$SCRIPT_BASE" ]] +unset BASE_IMAGES +# When executing under Cirrus-CI, script have access to current source +LIB="$CIRRUS_WORKING_DIR/$SCRIPT_BASE/lib.sh" +if [[ "$CI" == "true" ]] && [[ -r "$LIB" ]] then # Avoid importing anything that might conflict - eval "$(egrep -sh '^export .+BASE_IMAGE=' < $CIRRUS_WORKING_DIR/$SCRIPT_BASE/lib.sh)" - BASE_IMAGES="$UBUNTU_BASE_IMAGE $PRIOR_UBUNTU_BASE_IMAGE $FEDORA_BASE_IMAGE $PRIOR_FEDORA_BASE_IMAGE" + for env in $(sed -ne 's/^[^#]\+_BASE_IMAGE=/img=/p' "$LIB") + do + eval $env + BASE_IMAGES="$BASE_IMAGES $img" + done else # 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." -- cgit v1.2.3-54-g00ecf