From 413f3df2d2edc71a0a4f01cd80ebfe085ec6d496 Mon Sep 17 00:00:00 2001 From: Michael Pond Date: Thu, 9 Jan 2025 09:52:17 -0500 Subject: [PATCH 1/3] adding workflow to upadte docker tag for api --- .../call-manifests-update-docker-tag.yaml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/call-manifests-update-docker-tag.yaml diff --git a/.github/workflows/call-manifests-update-docker-tag.yaml b/.github/workflows/call-manifests-update-docker-tag.yaml new file mode 100644 index 0000000000..563fa195fc --- /dev/null +++ b/.github/workflows/call-manifests-update-docker-tag.yaml @@ -0,0 +1,30 @@ +name: Call Manifests Update Docker Tag + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + update-docker-tag-in-manifests: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set Docker Tag + run: echo "DOCKER_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV + env: + GITHUB_SHA: ${{ github.sha }} + + - name: Trigger repository_dispatch + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.MANIFESTS_WORKFLOW_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/cds-snc/notification-manifests/dispatches \ + -d '{"event_type":"update-docker-image","client_payload":{"component":"API","docker_tag":"${{ env.DOCKER_TAG }}"}}' From 1ba0f24eb35ac7193c14b8a0c6441d77ccc844df Mon Sep 17 00:00:00 2001 From: Michael Pond Date: Thu, 9 Jan 2025 10:49:32 -0500 Subject: [PATCH 2/3] making this an action and calling it from our staging workflow --- .../call-manifests-update-docker-tag.yaml | 3 --- .github/workflows/docker.yaml | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) rename .github/{workflows => actions}/call-manifests-update-docker-tag.yaml (96%) diff --git a/.github/workflows/call-manifests-update-docker-tag.yaml b/.github/actions/call-manifests-update-docker-tag.yaml similarity index 96% rename from .github/workflows/call-manifests-update-docker-tag.yaml rename to .github/actions/call-manifests-update-docker-tag.yaml index 563fa195fc..c56b8b4ef1 100644 --- a/.github/workflows/call-manifests-update-docker-tag.yaml +++ b/.github/actions/call-manifests-update-docker-tag.yaml @@ -2,9 +2,6 @@ name: Call Manifests Update Docker Tag on: workflow_dispatch: - push: - branches: - - main jobs: update-docker-tag-in-manifests: diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index c1feb3534c..4d3178bd09 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -94,7 +94,7 @@ jobs: run: | aws eks update-kubeconfig --name notification-canada-ca-staging-eks-cluster - - name: Update images in staging + - name: Update images in staging (Kustomize) run: | DOCKER_TAG=${GITHUB_SHA::7} kubectl set image deployment.apps/notify-api notify-api=$DOCKER_SLUG:$DOCKER_TAG -n=notification-canada-ca --kubeconfig=$HOME/.kube/config @@ -107,6 +107,8 @@ jobs: kubectl set image deployment.apps/notify-celery-email-send-primary notify-celery-email-send-primary=$DOCKER_SLUG:$DOCKER_TAG -n=notification-canada-ca --kubeconfig=$HOME/.kube/config kubectl set image deployment.apps/notify-celery-email-send-scalable notify-celery-email-send-scalable=$DOCKER_SLUG:$DOCKER_TAG -n=notification-canada-ca --kubeconfig=$HOME/.kube/config + - name: Update images in staging (Helm) + uses: ./.github/actions/call-manifests-update-docker-tag.yaml - name: my-app-install token id: notify-pr-bot From d7e8f5797acc6898494f7f23d6aa774380dc4509 Mon Sep 17 00:00:00 2001 From: Michael Pond Date: Thu, 9 Jan 2025 11:24:14 -0500 Subject: [PATCH 3/3] moving this to the main workflow --- .../call-manifests-update-docker-tag.yaml | 27 ------------------- .github/workflows/docker.yaml | 11 +++++++- 2 files changed, 10 insertions(+), 28 deletions(-) delete mode 100644 .github/actions/call-manifests-update-docker-tag.yaml diff --git a/.github/actions/call-manifests-update-docker-tag.yaml b/.github/actions/call-manifests-update-docker-tag.yaml deleted file mode 100644 index c56b8b4ef1..0000000000 --- a/.github/actions/call-manifests-update-docker-tag.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Call Manifests Update Docker Tag - -on: - workflow_dispatch: - -jobs: - update-docker-tag-in-manifests: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set Docker Tag - run: echo "DOCKER_TAG=${GITHUB_SHA::7}" >> $GITHUB_ENV - env: - GITHUB_SHA: ${{ github.sha }} - - - name: Trigger repository_dispatch - run: | - curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.MANIFESTS_WORKFLOW_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/cds-snc/notification-manifests/dispatches \ - -d '{"event_type":"update-docker-image","client_payload":{"component":"API","docker_tag":"${{ env.DOCKER_TAG }}"}}' diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4d3178bd09..ef381d19e7 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -108,7 +108,16 @@ jobs: kubectl set image deployment.apps/notify-celery-email-send-scalable notify-celery-email-send-scalable=$DOCKER_SLUG:$DOCKER_TAG -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - name: Update images in staging (Helm) - uses: ./.github/actions/call-manifests-update-docker-tag.yaml + env: + GITHUB_SHA: ${{ github.sha }} + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.MANIFESTS_WORKFLOW_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/cds-snc/notification-manifests/dispatches \ + -d '{"event_type":"update-docker-image","client_payload":{"component":"API","docker_tag":"${{ env.DOCKER_TAG }}"}}' - name: my-app-install token id: notify-pr-bot