Skip to content

Commit e248797

Browse files
committed
fix: sanitize Docker image tags by replacing slashes with dashes
Branch names with slashes (e.g., feat/web-beautiful-ui) are valid git refs but invalid Docker tags. When workflow_dispatch tag input is empty, the workflow now sanitizes github.ref_name by replacing '/' with '-' before using it as an image tag or bundle version. Fixes bug e3999610 - Branch names can invalidate image tags
1 parent 08810ab commit e248797

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

.github/workflows/release-images.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
TAG="${{ github.event.inputs.tag }}"
5151
[ -z "$TAG" ] && TAG="${{ github.ref_name }}"
5252
TAG="${TAG#refs/tags/}"
53+
TAG="${TAG//\//-}"
5354
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
5455
- name: Build application bundle
5556
run: python scripts/build_release_bundle.py --version "${{ steps.version.outputs.version }}" --repository "${{ github.repository }}"
@@ -75,6 +76,7 @@ jobs:
7576
TAG="${{ github.event.inputs.tag }}"
7677
[ -z "$TAG" ] && TAG="${{ github.ref_name }}"
7778
TAG="${TAG#refs/tags/}"
79+
TAG="${TAG//\//-}"
7880
[ -z "$TAG" ] && TAG="latest"
7981
OWNER="${GITHUB_REPOSITORY_OWNER,,}"
8082
{
@@ -128,6 +130,7 @@ jobs:
128130
TAG="${{ github.event.inputs.tag }}"
129131
[ -z "$TAG" ] && TAG="${{ github.ref_name }}"
130132
TAG="${TAG#refs/tags/}"
133+
TAG="${TAG//\//-}"
131134
[ -z "$TAG" ] && TAG="latest"
132135
OWNER="${GITHUB_REPOSITORY_OWNER,,}"
133136
{
@@ -184,6 +187,7 @@ jobs:
184187
TAG="${{ github.event.inputs.tag }}"
185188
[ -z "$TAG" ] && TAG="${{ github.ref_name }}"
186189
TAG="${TAG#refs/tags/}"
190+
TAG="${TAG//\//-}"
187191
[ -z "$TAG" ] && TAG="latest"
188192
OWNER="${GITHUB_REPOSITORY_OWNER,,}"
189193
{
@@ -275,6 +279,7 @@ jobs:
275279
TAG="${{ github.event.inputs.tag }}"
276280
[ -z "$TAG" ] && TAG="${{ github.ref_name }}"
277281
TAG="${TAG#refs/tags/}"
282+
TAG="${TAG//\//-}"
278283
[ -z "$TAG" ] && TAG="latest"
279284
OWNER="${GITHUB_REPOSITORY_OWNER,,}"
280285
{

0 commit comments

Comments
 (0)