Skip to content

Commit b3ed5d0

Browse files
authored
Merge pull request #21727 from wireapp/wire-builds
Fix wire-builds chart bump push authentication [WPB-26802]
2 parents 61f1402 + f32ffe9 commit b3ed5d0

1 file changed

Lines changed: 56 additions & 31 deletions

File tree

.github/workflows/publish-and-deploy-webapp.yml

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,12 @@ jobs:
191191
- name: Check out wire-builds
192192
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
193193
with:
194-
persist-credentials: false
195194
repository: wireapp/wire-builds
196195
token: ${{secrets.WIRE_BUILDS_WRITE_ACCESS_GH_TOKEN}}
197196
ref: ${{matrix.target_branch}}
198197
fetch-depth: 1
199198

200-
- name: Create new build in wire-build
199+
- name: Create new build in wire-builds
201200
shell: bash
202201
run: |
203202
set -eo pipefail
@@ -208,47 +207,73 @@ jobs:
208207
git config --global user.email "zebot@users.noreply.github.com"
209208
git config --global user.name "Zebot"
210209
211-
for retry in $(seq 3); do
212-
set +e
213-
(
214-
set -e
210+
push_succeeded=false
215211
212+
for retry in $(seq 3); do
216213
if (( retry > 1 )); then
217214
echo "Retrying..."
218215
fi
219216
220-
git fetch --depth 1 origin "${{ matrix.target_branch }}"
221-
git checkout "${{ matrix.target_branch }}"
222-
git reset --hard @{upstream}
223-
224-
build_json=$(cat ./build.json | \
225-
./bin/set-chart-fields webapp \
226-
"version=$chart_version" \
227-
"repo=https://s3-eu-west-1.amazonaws.com/public.wire.com/charts-webapp" \
228-
"meta.appVersion=$image_tag" \
229-
"meta.commitURL=${{github.event.head_commit.url}}" \
230-
"meta.commit=${{github.event.head_commit.id}}" \
231-
| ./bin/bump-prerelease )
232-
echo "$build_json" > ./build.json
233-
234-
git add build.json
235-
git commit -m "Bump webapp to $chart_version"
236-
git push origin "${{ matrix.target_branch }}"
237-
217+
set +e
218+
(
219+
set -eo pipefail
220+
221+
git fetch --depth 1 origin "${{ matrix.target_branch }}"
222+
git checkout "${{ matrix.target_branch }}"
223+
git reset --hard @{upstream}
224+
225+
build_json=$(cat ./build.json | \
226+
./bin/set-chart-fields webapp \
227+
"version=$chart_version" \
228+
"repo=https://s3-eu-west-1.amazonaws.com/public.wire.com/charts-webapp" \
229+
"meta.appVersion=$image_tag" \
230+
"meta.commitURL=${{github.event.head_commit.url}}" \
231+
"meta.commit=${{github.event.head_commit.id}}" \
232+
| ./bin/bump-prerelease )
233+
echo "$build_json" > ./build.json
234+
235+
git add build.json
236+
git commit -m "Bump webapp to $chart_version"
237+
git push origin "${{ matrix.target_branch }}"
238238
)
239-
if [ $? -eq 0 ]; then
239+
attempt_exit_code=$?
240+
set -e
241+
242+
if [[ "$attempt_exit_code" -eq 0 ]]; then
240243
echo "pushing to wire-builds succeeded"
244+
push_succeeded=true
241245
break
242-
else
243-
echo "pushing to wire-builds FAILED (in retry $retry)"
244246
fi
245-
set -e
247+
248+
echo "pushing to wire-builds FAILED (retry $retry)"
246249
done
247-
if (( $? != 0 )); then
248-
echo "Retrying didn't help. Failing the step."
249-
exit 1
250+
251+
if [[ "$push_succeeded" != "true" ]]; then
252+
echo "Retrying didn't help. Failing the step."
253+
exit 1
250254
fi
251255
256+
notify_wire_builds_failure:
257+
name: 'Notify wire-builds bump failure to Deployoholics'
258+
runs-on: ubuntu-24.04
259+
needs: [build, publish_wire_builds]
260+
if: ${{ always() && needs.publish_wire_builds.result == 'failure' }}
261+
262+
steps:
263+
- name: Announce wire-builds bump failure
264+
uses: 8398a7/action-slack@293f8dc0f9731ac35321056641cdef895f4f65f8
265+
env:
266+
SLACK_WEBHOOK_URL: ${{ secrets.WIRE_DEPLOYOHOLICS_WEBHOOK_URL }}
267+
with:
268+
status: failure
269+
text: |
270+
❌ wire-builds chart bump failed for ${{ needs.build.outputs.release_name }} ❌
271+
**Triggered by:** ${{ github.actor }}
272+
**Ref:** ${{ github.ref_name }}
273+
**Chart version:** ${{ needs.build.outputs.chart_version }}
274+
**Image tag:** ${{ needs.build.outputs.image_tag }}
275+
**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
276+
252277
set_deployment_targets:
253278
name: 'Set deployment targets'
254279
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)