Skip to content

Commit 0f2bb2b

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

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

.github/workflows/image-publish.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,13 @@ jobs:
197197
echo "──────────────────────────────────────────────"
198198
echo "🔠 INPUTS"
199199
echo "──────────────────────────────────────────────"
200-
set -x
201-
echo "$MODE"
202-
echo "$REGISTRY"
203-
echo "$TAG_SUFFIX"
204-
echo "$CVMFS_DEST_DIR"
205-
echo "$CVMFS_REMOVE_TAGS"
206-
echo "$EXTRA_BUILD_TAG"
207-
echo "$BUILD_PLATFORMS_CSV"
208-
echo "$REG_USER"
209-
echo "$REG_TOKEN"
210-
echo "$CVMFS_GH_TOKEN"
211-
set +x
200+
echo "mode: $MODE"
201+
echo "registry: $REGISTRY"
202+
echo "tag_suffix: $TAG_SUFFIX"
203+
echo "cvmfs_dest_dir: $CVMFS_DEST_DIR"
204+
echo "cvmfs_remove_tags: $CVMFS_REMOVE_TAGS"
205+
echo "extra_build_tag: $EXTRA_BUILD_TAG"
206+
echo "build_platforms_csv: $BUILD_PLATFORMS_CSV"
212207
213208
echo "──────────────────────────────────────────────"
214209
echo "🧩 VALIDATING CONDITIONAL INPUTS"
@@ -378,24 +373,40 @@ jobs:
378373
# CVMFS REMOVAL TAGS (only in removal modes)
379374
########################################################################
380375
if [[ "${_is_remove_mode}" == "true" ]]; then
381-
echo "→ Checking cvmfs_remove_tags content and charset..."
382-
if ! awk 'NF{exit 0} END{exit 1}' <<<"${CVMFS_REMOVE_TAGS:-}"; then
383-
fail "'mode'=${MODE} requires 'inputs.cvmfs_remove_tags' (one tag per line)."
376+
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)."
384380
fi
381+
385382
while IFS= read -r _line; do
383+
# remove leading/trailing whitespace
386384
_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)"
389+
387390
if [[ -z "${_trimmed}" ]]; then
391+
# skip blank lines
388392
continue
389393
fi
390-
if [[ ! "${_trimmed}" =~ ^[A-Za-z0-9._-]+$ ]]; then
391-
fail "'cvmfs_remove_tags' entry '${_trimmed}' contains invalid characters. Allowed: [A-Za-z0-9._-]"
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}'"
392399
fi
393400
done <<< "${CVMFS_REMOVE_TAGS:-}"
401+
394402
echo "✅ cvmfs_remove_tags OK."
395403
else
396404
echo "✅ cvmfs_remove_tags not required for mode '${MODE}'."
397405
fi
398406
407+
########################################################################
408+
# DONE!
409+
########################################################################
399410
echo "🎯 All conditional input validations passed successfully."
400411
401412
- name: "Normalize suffix for use in artifacts"

0 commit comments

Comments
 (0)