mirror of
https://github.com/containers/podman
synced 2024-10-20 17:23:30 +00:00
e8564dc44f
Over time unless they're removed, the project could grow quite a large collection of VM images. While generally cheap (less than a penny each, per month), these will become a significant cost item if not kept in-check. Add a specialized container for handling image-pruning, but limit it to only finding and printing (not actually deleting) images. Also update the image-building workflow so that base-images used to compose cache-images are also labeled with metadata. N/B: As an additional safeguard, the service account which executes the new container in production *DOES NOT* have access to delete images. This can be enabled by adding the GCE IAM role: CustomComputeImagePrune Signed-off-by: Chris Evich <cevich@redhat.com>
24 lines
445 B
Bash
Executable file
24 lines
445 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
source /usr/local/bin/lib_entrypoint.sh
|
|
|
|
req_env_var GCPJSON GCPNAME GCPPROJECT IMGNAMES BUILDID REPOREF
|
|
|
|
gcloud_init
|
|
|
|
ARGS="
|
|
--update-labels=last-used=$(date +%s)
|
|
--update-labels=build-id=$BUILDID
|
|
--update-labels=repo-ref=$REPOREF
|
|
--update-labels=project=$GCPPROJECT
|
|
"
|
|
|
|
for image in $IMGNAMES
|
|
do
|
|
$GCLOUD compute images update "$image" $ARGS &
|
|
done
|
|
|
|
wait || echo "Warning: No \$IMGNAMES were specified."
|