Skip to content

Commit

Permalink
Add waits for all docker images to update argocd_metadata (#1202)
Browse files Browse the repository at this point in the history
* Remove unnecessary waits to update argocd_metadata

* Annotate important value not to be changed
Reintroduce waits

* Only checkout if success to reduce race condition probability

* Add waits for each docker image we build

* Avoid race condition in updating of argocd metadata repo

As @theosanderson said:
Your race condition point is a good reason to use concurrency, but without cancel-in-progress
  • Loading branch information
corneliusroemer committed Feb 29, 2024
1 parent 290b40c commit b64039a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
build-root-directory: ./backend

dockerImage:
name: Build Backend Docker Image
name: Build Backend Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/config-preprocessor-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
dockerImage:
name: Build config-processor Docker Image
name: Build config-processor Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dummyPreprocessing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
build-or-use-cache:
name: Preprocessing dummy docker image build # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/keycloakify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
dockerImage:
name: Build keycloakify Docker Image
name: Build keycloakify Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preprocessing-nextclade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
dockerImage:
name: Build preprocessing-nextclade Docker Image
name: Build preprocessing-nextclade Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/update-argocd-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
workflow_dispatch:

concurrency:
group: ci-update-argocd-metadata

jobs:
update:
permissions:
Expand All @@ -19,24 +22,59 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Get SHA - length 7
id: get_sha
run: |
echo "sha=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Wait for Prepro Dummy Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Preprocessing dummy docker image build
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Wait for Config Processor Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Build config-processor Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Wait for Backend Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Build Backend Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Wait for Website Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Build Website Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Wait for Prepro Nextclade Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Build preprocessing-nextclade Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Wait for Keycloakify Docker Image
uses: lewagon/wait-on-check-action@v1.3.3
with:
ref: ${{ github.sha }}
check-name: Build keycloakify Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 2

- name: Checkout External Repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: npm run test

dockerImage:
name: Build Website Docker Image
name: Build Website Docker Image # Don't change: Referenced by .github/workflows/update-argocd-metadata.yml
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down

0 comments on commit b64039a

Please sign in to comment.