From f931f435796c2c650d7fc70110c02c0054dc2469 Mon Sep 17 00:00:00 2001 From: Ben Larabie Date: Thu, 7 Mar 2024 08:44:10 -0500 Subject: [PATCH] attempting to remotely launch k8s rollout --- .github/workflows/docker.yaml | 42 +++++++++-------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index e4c5312d51..30c06b46eb 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,5 +1,8 @@ name: Build, push to AWS ECR, and deploy on: + pull_request: + branches: + - main push: branches: - main @@ -56,43 +59,18 @@ jobs: -t $DOCKER_SLUG:${GITHUB_SHA::7} \ -t $DOCKER_SLUG:latest \ -f ci/Dockerfile . + - name: Publish run: | docker push $DOCKER_SLUG:latest && docker push $DOCKER_SLUG:${GITHUB_SHA::7} - - name: Configure credentials to Notify account using OIDC - uses: aws-actions/configure-aws-credentials@master - with: - role-to-assume: arn:aws:iam::239043911459:role/notification-api-apply - role-session-name: NotifyApiGitHubActions - aws-region: "ca-central-1" - - - name: Get Kubernetes configuration - run: | - aws eks --region $AWS_REGION update-kubeconfig --name notification-canada-ca-staging-eks-cluster --kubeconfig $HOME/.kube/config - - name: Update images in staging - run: | - kubectl set image deployment.apps/api api=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-beat celery-beat=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-sms celery-sms=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-primary celery-primary=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-scalable celery-scalable=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-sms-send-primary celery-sms-send-primary=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-sms-send-scalable celery-sms-send-scalable=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-email-send-primary celery-email-send-primary=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - kubectl set image deployment.apps/celery-email-send-scalable celery-email-send-scalable=$DOCKER_SLUG:${GITHUB_SHA::7} -n=notification-canada-ca --kubeconfig=$HOME/.kube/config - - - name: Restart deployments in staging + - name: Rollout in Kubernetes run: | - kubectl rollout restart deployment/api -n notification-canada-ca - kubectl rollout restart deployment/celery-beat -n notification-canada-ca - kubectl rollout restart deployment/celery-sms -n notification-canada-ca - kubectl rollout restart deployment/celery-primary -n notification-canada-ca - kubectl rollout restart deployment/celery-scalable -n notification-canada-ca - kubectl rollout restart deployment/celery-sms-send-primary -n notification-canada-ca - kubectl rollout restart deployment/celery-sms-send-scalable -n notification-canada-ca - kubectl rollout restart deployment/celery-email-send-primary -n notification-canada-ca - kubectl rollout restart deployment/celery-email-send-scalable -n notification-canada-ca + curl -L -X POST -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer "${{ secrets.WORKFLOW_GITHUB_PAT }}"" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/cds-snc/notification-manifests/actions/workflows/api-rollout-k8s-staging.yaml/dispatches \ + -d '{"ref":"deploy-workflow-tuning","inputs":{docker_sha":"${GITHUB_SHA::7}"}}' - name: my-app-install token id: notify-pr-bot