File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ if [[ -n "${QUAY_E2E_USERNAME:-}" && -n "${QUAY_E2E_PASSWORD:-}" ]]; then
2121fi
2222
2323# Calculate cutoff timestamp
24- cutoff=$( date -u -v-${MAX_AGE_DAYS} d +%s 2> /dev/null || date -u -d " ${MAX_AGE_DAYS} days ago" +%s)
24+ cutoff=$( date -u -v-" ${MAX_AGE_DAYS} " d +%s 2> /dev/null || date -u -d " ${MAX_AGE_DAYS} days ago" +%s)
2525
2626if [[ " ${DRY_RUN} " == " true" ]]; then
2727 echo " DRY RUN: will list tags without deleting them"
3838
3939deleted=0
4040while IFS= read -r name; do
41- # Get the image creation timestamp ( RFC3339 format)
42- created=$( regctl image config " ${REPO} :${name} " --format ' {{.Created}}' 2> /dev/null || true)
41+ # Get the image creation timestamp in RFC3339 format using jsonPretty to ensure quotes and T/Z separators
42+ created=$( regctl image config " ${REPO} :${name} " --format ' {{jsonPretty .Created}}' 2> /dev/null | sed ' s/^"//;s/"$// ' || true)
4343
4444 if [[ -z " ${created} " ]]; then
4545 echo " Warning: could not get creation time for tag ${name} , skipping"
4646 continue
4747 fi
4848
49- # Convert RFC3339 to epoch (strip fractional seconds and Z suffix for macOS compatibility)
50- stripped=$( echo " ${created} " | sed ' s/\.[0-9]*Z$//' | sed ' s/Z$//' )
51- created_ts=$( date -u -jf " %Y-%m-%dT%H:%M:%S" " ${stripped} " +%s 2> /dev/null \
49+ # Convert to a format that date can parse (handle both RFC3339 and 'YYYY-MM-DD HH:MM:SS...' formats)
50+ normalized=$( echo " ${created} " | sed ' s/ /T/' | sed ' s/ UTC$//' )
51+ created_ts=$( date -u -jf " %Y-%m-%dT%H:%M:%S" " ${normalized% .* } " +%s 2> /dev/null \
52+ || date -u -d " ${normalized} " +%s 2> /dev/null \
5253 || date -u -d " ${created} " +%s 2> /dev/null \
5354 || true)
5455
You can’t perform that action at this time.
0 commit comments