Skip to content

Commit e44a152

Browse files
committed
Hot patch v1.20 - fix cvmfs_remove_tags - 2
1 parent 0f2bb2b commit e44a152

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

.github/workflows/image-publish.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -370,40 +370,39 @@ jobs:
370370
fi
371371
372372
########################################################################
373-
# CVMFS REMOVAL TAGS (only in removal modes)
373+
# CVMFS REMOVAL TAGS (only in removal modes) — Python inline
374374
########################################################################
375375
if [[ "${_is_remove_mode}" == "true" ]]; then
376376
echo "→ Checking cvmfs_remove_tags content..."
377-
# require at least one non-blank, non-comment line
378-
if ! awk 'NF && $1 !~ /^#/ {exit 0} END{exit 1}' <<<"${CVMFS_REMOVE_TAGS:-}"; then
379-
fail "'mode'=${MODE} requires 'inputs.cvmfs_remove_tags' (one tag per line, ignoring comments)."
380-
fi
377+
python -c '
378+
import os, re, sys
381379
382-
while IFS= read -r _line; do
383-
# remove leading/trailing whitespace
384-
_trimmed="$(echo "${_line}" | xargs)"
385-
# strip inline comments (anything after '#')
386-
_trimmed="${_trimmed%%#*}"
387-
# trim again, in case comment removal leaves trailing space
388-
_trimmed="$(echo "${_trimmed}" | xargs)"
380+
raw = os.environ.get("CVMFS_REMOVE_TAGS", "")
381+
print("debug: raw CVMFS_REMOVE_TAGS follows:"); print(raw)
389382
390-
if [[ -z "${_trimmed}" ]]; then
391-
# skip blank lines
392-
continue
393-
fi
394-
if [[ "${_trimmed}" =~ [[:space:]] ]]; then
395-
fail "'cvmfs_remove_tags' entry contains whitespace: '${_line}'"
396-
fi
397-
if (( ${#_trimmed} > 128 )); then
398-
fail "'cvmfs_remove_tags' entry too long (>128 chars): '${_trimmed}'"
399-
fi
400-
done <<< "${CVMFS_REMOVE_TAGS:-}"
383+
tags=[]
384+
for i,line in enumerate(raw.splitlines(), 1):
385+
s=line.strip()
386+
if "#" in s:
387+
s=s.split("#",1)[0].strip()
388+
if not s:
389+
continue
390+
if re.search(r"\s",s):
391+
print(f"::error::cvmfs_remove_tags: line {i} has whitespace {line!r}"); sys.exit(1)
392+
tags.append(s)
401393
394+
if not tags:
395+
print("::error::cvmfs_remove_tags: no valid tags (one tag per line, comments allowed)"); sys.exit(1)
396+
else:
397+
print(\"validated cvmfs_remove_tags:\"); [print(t) for t in tags]
398+
'
402399
echo "✅ cvmfs_remove_tags OK."
403400
else
404401
echo "✅ cvmfs_remove_tags not required for mode '${MODE}'."
405402
fi
406403
404+
405+
407406
########################################################################
408407
# DONE!
409408
########################################################################

0 commit comments

Comments
 (0)