diff --git a/scripts/check-role-prefix.sh b/scripts/check-role-prefix.sh index 14c97c19e8..73e5a8dea3 100755 --- a/scripts/check-role-prefix.sh +++ b/scripts/check-role-prefix.sh @@ -24,10 +24,11 @@ MSG=$(head -n 1 "$TMP_MSG_FILE") ROLE_COUNT=$(echo "$CHANGED_ROLES" | tr '|' '\n' | wc -l) if [ "$ROLE_COUNT" -eq 1 ]; then - # shellcheck disable=SC1087 - PATTERN="^[\[(]$CHANGED_ROLES[\])]" + # shellcheck disable=SC2016 + ESCAPED_ROLE=$(printf '%s\n' "$CHANGED_ROLES" | sed 's/[]\.*^$()+?{|]/\\&/g') + PATTERN="^[[(]${ESCAPED_ROLE}[])]" else - PATTERN="^[\[(](multiple)[\])]" + PATTERN="^[[(](multiple)[])]" fi if ! grep -qE "$PATTERN" <<<"$MSG"; then diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index a41ad6c290..63d75aee8b 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -53,6 +53,7 @@ - .pre-commit-config.yaml - .readthedocs.yaml - .spellcheck.yml + - scripts/check-role-prefix.sh - roles/dlrn_report - roles/dlrn_promote - roles/devscripts diff --git a/zuul.d/project-templates.yaml b/zuul.d/project-templates.yaml index 6fe9ae944e..0257ae19f9 100644 --- a/zuul.d/project-templates.yaml +++ b/zuul.d/project-templates.yaml @@ -57,6 +57,8 @@ requires: - cifmw-pod-pre-commit - cifmw-molecule + irrelevant-files: + - scripts/check-role-prefix.sh - podified-multinode-edpm-deployment-crc: *content_provider - cifmw-crc-podified-edpm-baremetal: *content_provider - podified-multinode-hci-deployment-crc: *content_provider