Skip to content

Commit a1d410d

Browse files
committed
fix(ci): improve docker tag sanitization in workflows
- Replace multiple character translations with a cleaner sanitization step - Remove disallowed characters more reliably from branch names for docker tags - Ensure consistent and safe docker tag formatting across CI jobs
1 parent 6930cd7 commit a1d410d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ jobs:
5454
set -e
5555
if [[ "${{ steps.check_branch.outputs.exists }}" == "true" ]]; then
5656
BRANCH="${{ steps.current_branch.outputs.branch }}"
57-
DOCKER_TAG=$(echo "$BRANCH" | tr '/' '-' | tr '_' '-' | tr '.' '-' | tr '@' '-' | tr ':' '-' | tr ' ' '-' | tr '[A-Z]' '[a-z]')
57+
58+
fix=$(echo "$BRANCH" | tr '/' '_')
59+
DOCKER_TAG=$(echo "$fix" | sed 's/[^a-zA-Z0-9_.-]//g')
5860
IMAGE="ghcr.io/manticoresoftware/manticoresearch:test-kit-${DOCKER_TAG,,}"
5961
else
6062
IMAGE="ghcr.io/manticoresoftware/manticoresearch:test-kit-latest"
@@ -104,7 +106,8 @@ jobs:
104106
run: |
105107
set -e
106108
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
107-
DOCKER_TAG=$(echo "$BRANCH" | tr '/' '-' | tr '_' '-' | tr '.' '-' | tr '@' '-' | tr ':' '-' | tr ' ' '-' | tr '[A-Z]' '[a-z]')
109+
fix=$(echo "$BRANCH" | tr '/' '_')
110+
DOCKER_TAG=$(echo "$fix" | sed 's/[^a-zA-Z0-9_.-]//g')
108111
DOCKER_TAG="test-kit-${DOCKER_TAG,,}-buddy"
109112
COMMIT=${GITHUB_SHA::8}
110113
IMAGE="${GHCR_REPO}:${DOCKER_TAG}"

0 commit comments

Comments
 (0)