Skip to content

Commit c28e8c0

Browse files
committed
chore: clean short sha for consistency
1 parent b7c4fec commit c28e8c0

File tree

4 files changed

+44
-20
lines changed

4 files changed

+44
-20
lines changed

.github/workflows/container-build-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ jobs:
7777
id: ref-name
7878
run: |
7979
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
80-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
80+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
81+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
82+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
83+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
8184
8285
- name: Execute build
8386
uses: ./.github/actions/build-container

.github/workflows/e2e-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ jobs:
119119
id: ref-name
120120
run: |
121121
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
122-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
122+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
123+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
124+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
125+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
123126
124127
- name: Create cluster for E2E tests
125128
env:

.github/workflows/publish.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ jobs:
6666
id: ref-name
6767
run: |
6868
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
69-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
69+
SAFE_REF="${{ github.event.inputs.tag }}"
7070
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
71-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
71+
SAFE_REF="${{ github.ref_name }}"
7272
else
7373
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
74-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
74+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
7575
fi
76+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
77+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
78+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
7679
7780
- name: Build image list
7881
id: build-list
@@ -130,13 +133,16 @@ jobs:
130133
id: ref-name
131134
run: |
132135
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
133-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
136+
SAFE_REF="${{ github.event.inputs.tag }}"
134137
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
135-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
138+
SAFE_REF="${{ github.ref_name }}"
136139
else
137140
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
138-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
141+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
139142
fi
143+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
144+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
145+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
140146
141147
- name: Publish container for ${{ matrix.component }}
142148
uses: ./.github/actions/publish-container
@@ -176,13 +182,16 @@ jobs:
176182
id: ref-name
177183
run: |
178184
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
179-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
185+
SAFE_REF="${{ github.event.inputs.tag }}"
180186
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
181-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
187+
SAFE_REF="${{ github.ref_name }}"
182188
else
183189
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
184-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
190+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
185191
fi
192+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
193+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
194+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
186195
187196
# ko is already installed in the setup-ci-env action
188197
- name: Authenticate to GHCR
@@ -260,13 +269,16 @@ jobs:
260269
id: ref-name
261270
run: |
262271
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
263-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
272+
SAFE_REF="${{ github.event.inputs.tag }}"
264273
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
265-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
274+
SAFE_REF="${{ github.ref_name }}"
266275
else
267276
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
268-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
277+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
269278
fi
279+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
280+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
281+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
270282
271283
- name: Prep system for multi-node Kind cluster
272284
run: |

.github/workflows/release.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ jobs:
5555
id: ref-name
5656
run: |
5757
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
58-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
58+
SAFE_REF="${{ github.event.inputs.tag }}"
5959
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
60-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
60+
SAFE_REF="${{ github.ref_name }}"
6161
else
6262
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
63-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
63+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
6464
fi
65+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
66+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
67+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
6568
6669
- name: Build image list
6770
env:
@@ -100,13 +103,16 @@ jobs:
100103
id: ref-name
101104
run: |
102105
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
103-
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
106+
SAFE_REF="${{ github.event.inputs.tag }}"
104107
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
105-
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
108+
SAFE_REF="${{ github.ref_name }}"
106109
else
107110
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
108-
echo "value=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_OUTPUT
111+
SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}"
109112
fi
113+
# Sanitize ref name: replace slashes with hyphens for Docker tag compatibility
114+
SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g')
115+
echo "value=$SAFE_REF" >> $GITHUB_OUTPUT
110116
111117
- name: Package and publish Helm chart
112118
env:

0 commit comments

Comments
 (0)