From a61aa82453f90e3e5ff6384ba0efdf38616ff494 Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 18:34:30 +0100 Subject: [PATCH 1/9] Wait for forge app public image --- .github/workflows/helm-chart.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 3a3b2664..73b51254 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -52,6 +52,18 @@ jobs: for node in $(kubectl get nodes -o name); do kubectl label --overwrite $node "role=management" done + + - name: Set application version + run: | + echo APP_VERSION=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') >> $GITHUB_ENV + + - name: Wait for application public image + uses: PaulLesur/wait-docker-image-github-action@v1.0 + with: + image: forge-k8s + tag: ${{ env.APP_VERSION }} + timeout: 300 + fail-on-timeout: true - name: Run chart-testing (install and upgrade) run: ct install --upgrade --config ./.github/configs/chart-testing.yaml From 62dee2c93a5cd38603ffde83c6dcec6e919af56d Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 18:59:58 +0100 Subject: [PATCH 2/9] Update docker image name --- .github/workflows/helm-chart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 73b51254..56eafb88 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -60,7 +60,7 @@ jobs: - name: Wait for application public image uses: PaulLesur/wait-docker-image-github-action@v1.0 with: - image: forge-k8s + image: flowfuse/forge-k8s tag: ${{ env.APP_VERSION }} timeout: 300 fail-on-timeout: true From b598d79a825824c1639766f415092de35a22787b Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 19:15:37 +0100 Subject: [PATCH 3/9] Update Docker image reference in helm-chart.yml --- .github/workflows/helm-chart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 56eafb88..df159009 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -60,7 +60,7 @@ jobs: - name: Wait for application public image uses: PaulLesur/wait-docker-image-github-action@v1.0 with: - image: flowfuse/forge-k8s + image: docker.io/flowfuse/forge-k8s tag: ${{ env.APP_VERSION }} timeout: 300 fail-on-timeout: true From 57e80174cb58b9e261c9aab1f2ca077ba0ff338b Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 19:54:15 +0100 Subject: [PATCH 4/9] Replace external action with own shell script to check if image exists --- .github/workflows/helm-chart.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index df159009..64904e2b 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -52,18 +52,21 @@ jobs: for node in $(kubectl get nodes -o name); do kubectl label --overwrite $node "role=management" done - - - name: Set application version - run: | - echo APP_VERSION=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') >> $GITHUB_ENV - - name: Wait for application public image - uses: PaulLesur/wait-docker-image-github-action@v1.0 - with: - image: docker.io/flowfuse/forge-k8s - tag: ${{ env.APP_VERSION }} - timeout: 300 - fail-on-timeout: true + - name: Wait for forge application public image + run: | + IMAGE="flowfuse/forge-k8s:${{ env.APP_VERSION }}" + TAG=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') + ATTEMPTS=0 + until docker pull $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do + ATTEMPTS=$((ATTEMPTS+1)) + echo "Attempt $ATTEMPTS failed! Trying again in 30 seconds..." + sleep 30 + done + if [ $ATTEMPTS -eq 10 ]; then + echo "Failed to pull $IMAGE:$TAG after $ATTEMPTS attempts!" + exit 1 + fi - name: Run chart-testing (install and upgrade) run: ct install --upgrade --config ./.github/configs/chart-testing.yaml From d5d03439434c790e75e1f6e66eba70a898a12d9d Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 20:04:18 +0100 Subject: [PATCH 5/9] Replace external action with own shell script to check if image exists --- .github/workflows/helm-chart.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 64904e2b..1f0f85c2 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -53,6 +53,7 @@ jobs: kubectl label --overwrite $node "role=management" done + - name: Wait for forge application public image run: | IMAGE="flowfuse/forge-k8s:${{ env.APP_VERSION }}" From b175e17f7e67a977243a8e20d418b047f42329bc Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 20:55:58 +0100 Subject: [PATCH 6/9] Fix IMAGE variable --- .github/workflows/helm-chart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 1f0f85c2..8d388d53 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -56,7 +56,7 @@ jobs: - name: Wait for forge application public image run: | - IMAGE="flowfuse/forge-k8s:${{ env.APP_VERSION }}" + IMAGE="flowfuse/forge-k8s" TAG=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') ATTEMPTS=0 until docker pull $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do From bc12fa62bed3a068f253398872d5722f47bd7a57 Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 21:06:24 +0100 Subject: [PATCH 7/9] Inspect docker image instead of pulling to optimise execution time --- .github/workflows/helm-chart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 8d388d53..badb3c43 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -59,13 +59,13 @@ jobs: IMAGE="flowfuse/forge-k8s" TAG=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') ATTEMPTS=0 - until docker pull $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do + until docker inspect $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do ATTEMPTS=$((ATTEMPTS+1)) echo "Attempt $ATTEMPTS failed! Trying again in 30 seconds..." sleep 30 done if [ $ATTEMPTS -eq 10 ]; then - echo "Failed to pull $IMAGE:$TAG after $ATTEMPTS attempts!" + echo "Failed to inspect $IMAGE:$TAG after $ATTEMPTS attempts!" exit 1 fi From f4e9e133aac4023d9c235ed7acc84dbc62b85cfe Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 21:11:10 +0100 Subject: [PATCH 8/9] Inspect docker image instead of pulling to optimise execution time --- .github/workflows/helm-chart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index badb3c43..269f9c93 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -59,13 +59,13 @@ jobs: IMAGE="flowfuse/forge-k8s" TAG=$(helm show chart ./helm/flowforge | awk -F': ' '/appVersion/ {print $2}') ATTEMPTS=0 - until docker inspect $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do + until docker manifest inspect $IMAGE:$TAG || [ $ATTEMPTS -eq 10 ]; do ATTEMPTS=$((ATTEMPTS+1)) echo "Attempt $ATTEMPTS failed! Trying again in 30 seconds..." sleep 30 done if [ $ATTEMPTS -eq 10 ]; then - echo "Failed to inspect $IMAGE:$TAG after $ATTEMPTS attempts!" + echo "Failed to inspect remote $IMAGE:$TAG after $ATTEMPTS attempts!" exit 1 fi From b8669c4d74ffcb3d16c96b0e726239b97075e3d8 Mon Sep 17 00:00:00 2001 From: ppawlowski Date: Mon, 26 Feb 2024 21:15:27 +0100 Subject: [PATCH 9/9] Remove unnecessary whitespace and blank line in helm-chart.yml --- .github/workflows/helm-chart.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/helm-chart.yml b/.github/workflows/helm-chart.yml index 269f9c93..e8e7a8ca 100644 --- a/.github/workflows/helm-chart.yml +++ b/.github/workflows/helm-chart.yml @@ -53,7 +53,6 @@ jobs: kubectl label --overwrite $node "role=management" done - - name: Wait for forge application public image run: | IMAGE="flowfuse/forge-k8s"