From faf3b578f58b60fc2164cfd6316e2bd028fd86f0 Mon Sep 17 00:00:00 2001 From: Mike Mwanje Date: Wed, 9 Nov 2022 13:52:10 +0300 Subject: [PATCH 1/5] use uniform image registry --- .../workflows/deploy-frontend-pr-previews.yml | 38 ++++++------ .../deploy-frontends-to-production.yml | 58 +++++++++---------- .../workflows/deploy-frontends-to-staging.yml | 58 +++++++++---------- 3 files changed, 77 insertions(+), 77 deletions(-) diff --git a/.github/workflows/deploy-frontend-pr-previews.yml b/.github/workflows/deploy-frontend-pr-previews.yml index c77b52977e..af59569a39 100644 --- a/.github/workflows/deploy-frontend-pr-previews.yml +++ b/.github/workflows/deploy-frontend-pr-previews.yml @@ -118,8 +118,8 @@ jobs: - name: Build and Push Image run: | cd netmanager/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} ./ - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} + docker build --tag gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} ./ + docker push gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -128,7 +128,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} \ + --image=gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} \ --port=80 \ --cpu=1000m \ --memory=256Mi \ @@ -146,7 +146,7 @@ jobs: createPR: false changes: | { - "image.repository": "${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/netmanager-pr-previews", + "image.repository": "gcr.io/airqo-250220/pr-previews/netmanager-pr-previews", "image.tag": "${{ github.sha }}" } @@ -220,8 +220,8 @@ jobs: - name: Build and Push Image run: | cd calibrate/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} + docker build --tag gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} . + docker push gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -230,7 +230,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} \ + --image=gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} \ --port=80 \ --cpu=1000m \ --memory=256Mi \ @@ -248,7 +248,7 @@ jobs: createPR: false changes: | { - "image.repository": "${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews", + "image.repository": "gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews", "image.tag": "${{ github.sha }}" } @@ -313,8 +313,8 @@ jobs: - name: Build and Push Image run: | cd platform/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} + docker build --tag gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} . + docker push gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -323,7 +323,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} \ + --image=gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} \ --port=3000 \ --cpu=1000m \ --memory=256Mi \ @@ -339,7 +339,7 @@ jobs: createPR: false changes: | { - "image.repository": "${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/next-platform-pr-previews", + "image.repository": "gcr.io/airqo-250220/pr-previews/next-platform-pr-previews", "image.tag": "${{ github.sha }}" } @@ -401,8 +401,8 @@ jobs: - name: Build and Push Image run: | cd docs/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} + docker build --tag gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} . + docker push gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -411,7 +411,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} \ + --image=gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} \ --port=3000 \ --cpu=1000m \ --memory=256Mi \ @@ -427,7 +427,7 @@ jobs: createPR: false changes: | { - "image.repository": "${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/pr-previews/docs-pr-previews", + "image.repository": "gcr.io/airqo-250220/pr-previews/docs-pr-previews", "image.tag": "${{ github.sha }}" } @@ -522,14 +522,14 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_DEV_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_STAGE_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} + --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} + docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} \ + --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet diff --git a/.github/workflows/deploy-frontends-to-production.yml b/.github/workflows/deploy-frontends-to-production.yml index aec5e4ead4..f03b0b7dc6 100644 --- a/.github/workflows/deploy-frontends-to-production.yml +++ b/.github/workflows/deploy-frontends-to-production.yml @@ -81,10 +81,10 @@ jobs: - name: Build and Push Docker Image run: | cd netmanager/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:latest + docker build --tag gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-platform-frontend:latest + docker push gcr.io/airqo-250220/airqo-platform-frontend:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -109,8 +109,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=netmanager/.env env-platform-production | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/netmanager/prod-airqo-platform-frontend.yaml - kubectl set image deployment/airqo-platform-frontend airqo-platform=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-platform-frontend kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-platform-frontend airqo-platform=gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-platform-frontend kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy website ### website: @@ -181,16 +181,16 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_PROD_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_PROD_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest + --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} + docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest + docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest \ + --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet @@ -234,10 +234,10 @@ jobs: - name: Build and Push Docker Image run: | cd calibrate/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:latest + docker build --tag gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-calibrate-app:latest + docker push gcr.io/airqo-250220/airqo-calibrate-app:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -261,8 +261,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=calibrate/.env env-calibrate-prod | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/calibrate/prod-airqo-calibrate-app.yaml - kubectl set image deployment/airqo-calibrate-app prod-calibrate-app=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-calibrate-app kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-calibrate-app prod-calibrate-app=gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-calibrate-app kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy next platform ### next-platform: @@ -295,10 +295,10 @@ jobs: - name: Build and Push Docker Image run: | cd platform/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:latest + docker build --tag gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-next-platform:latest + docker push gcr.io/airqo-250220/airqo-next-platform:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -322,8 +322,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=platform/.env env-next-platform-production | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/platform/prod-airqo-next-platform.yaml - kubectl set image deployment/airqo-next-platform airqo-next-platform=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-next-platform kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-next-platform airqo-next-platform=gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-next-platform kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy docs ### docs: @@ -345,10 +345,10 @@ jobs: - name: Build and Push Docker Image run: | cd docs/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:latest + docker build --tag gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-prod-docs:latest + docker push gcr.io/airqo-250220/airqo-prod-docs:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -363,5 +363,5 @@ jobs: - name: Deploy to K8S run: | kubectl apply -f k8s/docs/prod-airqo-docs.yaml - kubectl set image deployment/airqo-prod-docs airqo-prod-docs=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-prod-docs kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-prod-docs airqo-prod-docs=gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-prod-docs kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production diff --git a/.github/workflows/deploy-frontends-to-staging.yml b/.github/workflows/deploy-frontends-to-staging.yml index 5a0b8239f4..ffb5a82b3c 100644 --- a/.github/workflows/deploy-frontends-to-staging.yml +++ b/.github/workflows/deploy-frontends-to-staging.yml @@ -123,10 +123,10 @@ jobs: - name: Build and Push Docker Image run: | cd netmanager/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:latest + docker build --tag gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-platform-frontend:latest + docker push gcr.io/airqo-250220/airqo-stage-platform-frontend:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -151,8 +151,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=netmanager/.env env-platform-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/netmanager/stage-airqo-platform-frontend.yaml - kubectl set image deployment/airqo-stage-platform-frontend sta-platform-ui=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-platform-frontend kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-platform-frontend sta-platform-ui=gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-platform-frontend kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy website ### website: @@ -220,16 +220,16 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_STAGE_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_STAGE_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest + --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} + docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest + docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=${{ secrets.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest \ + --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet @@ -273,10 +273,10 @@ jobs: - name: Build and Push Docker Image run: | cd calibrate/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:latest + docker build --tag gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-calibrate-app:latest + docker push gcr.io/airqo-250220/airqo-stage-calibrate-app:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -300,8 +300,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=calibrate/.env env-calibrate-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/calibrate/stage-airqo-calibrate-app.yaml - kubectl set image deployment/airqo-stage-calibrate-app sta-calibrate-app=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-calibrate-app kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-calibrate-app sta-calibrate-app=gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-calibrate-app kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy next platform ### next-platform: @@ -334,10 +334,10 @@ jobs: - name: Build and Push Docker Image run: | cd platform/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} . - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:latest + docker build --tag gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} . + docker push gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} + docker tag gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-next-platform:latest + docker push gcr.io/airqo-250220/airqo-stage-next-platform:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -361,8 +361,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=platform/.env env-next-platform-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/platform/stage-airqo-next-platform.yaml - kubectl set image deployment/airqo-stage-next-platform sta-next-platform=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-next-platform kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-next-platform sta-next-platform=gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-next-platform kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy docs ### docs: @@ -384,10 +384,10 @@ jobs: - name: Build and Push Docker Image run: | cd docs/ - docker build --tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} . - docker tag ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:latest - docker push ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} + docker build --tag gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} . + docker tag gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-docs:latest + docker push gcr.io/airqo-250220/airqo-stage-docs:latest + docker push gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -402,5 +402,5 @@ jobs: - name: Deploy to K8S run: | kubectl apply -f k8s/docs/stage-airqo-docs.yaml - kubectl set image deployment/airqo-stage-docs sta-docs=${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-docs kubernetes.io/change-cause="Image updated to ${{ secrets.REGISTRY_URL }}/${{ secrets.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-docs sta-docs=gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-docs kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging From 51cebe91c76c8702f616fa2d58a4ff442eecc3a5 Mon Sep 17 00:00:00 2001 From: Mike Mwanje Date: Wed, 9 Nov 2022 14:03:14 +0300 Subject: [PATCH 2/5] remove nolonger used files --- .../deploy-k8s-changes-to-production.yml | 125 ------------------ .../deploy-k8s-changes-to-staging.yml | 125 ------------------ 2 files changed, 250 deletions(-) delete mode 100644 .github/workflows/deploy-k8s-changes-to-production.yml delete mode 100644 .github/workflows/deploy-k8s-changes-to-staging.yml diff --git a/.github/workflows/deploy-k8s-changes-to-production.yml b/.github/workflows/deploy-k8s-changes-to-production.yml deleted file mode 100644 index e334c67a33..0000000000 --- a/.github/workflows/deploy-k8s-changes-to-production.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: deploy-k8s-manifest-updates-to-production - -on: - pull_request: - branches: - - master - types: - - closed - -jobs: - check: - # this job will only run if the PR has been merged - if: github.event.pull_request.merged == true - name: check for changed manifests - outputs: - run_platform: ${{ steps.check_files.outputs.run_platform }} # platform - run_calibrate_app: ${{ steps.check_files.outputs.run_calibrate_app }} # calibrate app - run_docs: ${{ steps.check_files.outputs.run_docs }} # docs - - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: check modified frontends - id: check_files - run: | - echo "=============== list modified files ===============" - git diff --name-only HEAD^ HEAD - - echo "========== check paths of modified files ==========" - git diff --name-only HEAD^ HEAD > files.txt - - echo "run_platform=false" >>$GITHUB_OUTPUT - echo "run_calibrate_app=false" >>$GITHUB_OUTPUT - echo "run_docs=false" >>$GITHUB_OUTPUT - - while IFS= read -r file - do - echo $file - - if [[ $file == k8s/platform/* ]]; then - echo "run_platform=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == platform/* ]]; then - echo "run_platform=false" >>$GITHUB_OUTPUT - fi - - if [[ $file == k8s/calibrate/* ]]; then - echo "run_calibrate_app=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == calibrate/* ]]; then - echo "run_calibrate_app=false" >>$GITHUB_OUTPUT - fi - - if [[ $file == k8s/docs/* ]]; then - echo "run_docs=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == docs/* ]]; then - echo "run_docs=false" >>$GITHUB_OUTPUT - fi - - done < files.txt - - ### deploy platform ### - platform: - name: build-push-deploy-netmanager - needs: [check] - if: needs.check.outputs.run_platform == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_PROD }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/platform/prod-airqo-platform-frontend.yaml - - ### calibrate app ### - calibrate-app: - name: build-push-deploy-calibrate-app - needs: [check] - if: needs.check.outputs.run_calibrate_app == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_PROD }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/calibrate/prod-airqo-calibrate-app.yaml - - ### docs ### - docs: - name: build-push-deploy-docs - needs: [check] - if: needs.check.outputs.run_docs == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_PROD }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/docs/prod-airqo-docs.yaml diff --git a/.github/workflows/deploy-k8s-changes-to-staging.yml b/.github/workflows/deploy-k8s-changes-to-staging.yml deleted file mode 100644 index fd845da9f6..0000000000 --- a/.github/workflows/deploy-k8s-changes-to-staging.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: deploy-k8s-manifest-updates-to-staging - -on: - pull_request: - branches: - - staging - types: - - closed - -jobs: - check: - # this job will only run if the PR has been merged - if: github.event.pull_request.merged == true - name: check for changed manifests - outputs: - run_platform: ${{ steps.check_files.outputs.run_platform }} # platform - run_calibrate_app: ${{ steps.check_files.outputs.run_calibrate_app }} # calibrate app - run_docs: ${{ steps.check_files.outputs.run_docs }} # docs - - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: check modified frontends - id: check_files - run: | - echo "=============== list modified files ===============" - git diff --name-only HEAD^ HEAD - - echo "========== check paths of modified files ==========" - git diff --name-only HEAD^ HEAD > files.txt - - echo "run_platform=false" >>$GITHUB_OUTPUT - echo "run_calibrate_app=false" >>$GITHUB_OUTPUT - echo "run_docs=false" >>$GITHUB_OUTPUT - - while IFS= read -r file - do - echo $file - - if [[ $file == k8s/platform/* ]]; then - echo "run_platform=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == platform/* ]]; then - echo "run_platform=false" >>$GITHUB_OUTPUT - fi - - if [[ $file == k8s/calibrate/* ]]; then - echo "run_calibrate_app=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == calibrate/* ]]; then - echo "run_calibrate_app=false" >>$GITHUB_OUTPUT - fi - - if [[ $file == k8s/docs/* ]]; then - echo "run_docs=true" >>$GITHUB_OUTPUT - fi - - if [[ $file == docs/* ]]; then - echo "run_docs=false" >>$GITHUB_OUTPUT - fi - - done < files.txt - - ### deploy platform ### - platform: - name: build-push-deploy-netmanager - needs: [check] - if: needs.check.outputs.run_platform == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_STAGE }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/platform/stage-airqo-platform-frontend.yaml - - ### calibrate app ### - calibrate-app: - name: build-push-deploy-calibrate-app - needs: [check] - if: needs.check.outputs.run_calibrate_app == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_STAGE }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/calibrate/stage-airqo-calibrate-app.yaml - - ### docs ### - docs: - name: build-push-deploy-docs - needs: [check] - if: needs.check.outputs.run_docs == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Login to K8S - uses: azure/k8s-set-context@v1 - with: - method: kubeconfig - kubeconfig: ${{ secrets.K8S_CONFIG_STAGE }} - - - name: Deploy to K8S - run: kubectl apply -f k8s/docs/stage-airqo-docs.yaml From 82ff6a6189113567a8bcf93ed16b3248ad50b83a Mon Sep 17 00:00:00 2001 From: Mike Mwanje Date: Thu, 17 Nov 2022 18:49:58 +0300 Subject: [PATCH 3/5] use gihub action global env --- .../workflows/deploy-frontend-pr-previews.yml | 42 +++++++------ .../deploy-frontends-to-production.yml | 62 ++++++++++--------- .../workflows/deploy-frontends-to-staging.yml | 62 ++++++++++--------- 3 files changed, 89 insertions(+), 77 deletions(-) diff --git a/.github/workflows/deploy-frontend-pr-previews.yml b/.github/workflows/deploy-frontend-pr-previews.yml index af59569a39..32c7e7954c 100644 --- a/.github/workflows/deploy-frontend-pr-previews.yml +++ b/.github/workflows/deploy-frontend-pr-previews.yml @@ -5,6 +5,10 @@ on: branches: - staging +env: + REGISTRY_URL: gcr.io + PROJECT_ID: airqo-250220 + jobs: branch-name: name: Format branch name string @@ -118,8 +122,8 @@ jobs: - name: Build and Push Image run: | cd netmanager/ - docker build --tag gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} ./ - docker push gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} ./ + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -128,7 +132,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=gcr.io/airqo-250220/pr-previews/netmanager-pr-previews:${{ github.sha }} \ + --image=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/netmanager-pr-previews:${{ github.sha }} \ --port=80 \ --cpu=1000m \ --memory=256Mi \ @@ -146,7 +150,7 @@ jobs: createPR: false changes: | { - "image.repository": "gcr.io/airqo-250220/pr-previews/netmanager-pr-previews", + "image.repository": "${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/netmanager-pr-previews", "image.tag": "${{ github.sha }}" } @@ -220,8 +224,8 @@ jobs: - name: Build and Push Image run: | cd calibrate/ - docker build --tag gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} . - docker push gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -230,7 +234,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews:${{ github.sha }} \ + --image=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews:${{ github.sha }} \ --port=80 \ --cpu=1000m \ --memory=256Mi \ @@ -248,7 +252,7 @@ jobs: createPR: false changes: | { - "image.repository": "gcr.io/airqo-250220/pr-previews/calibrate-app-pr-previews", + "image.repository": "${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/calibrate-app-pr-previews", "image.tag": "${{ github.sha }}" } @@ -313,8 +317,8 @@ jobs: - name: Build and Push Image run: | cd platform/ - docker build --tag gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} . - docker push gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -323,7 +327,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=gcr.io/airqo-250220/pr-previews/next-platform-pr-previews:${{ github.sha }} \ + --image=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/next-platform-pr-previews:${{ github.sha }} \ --port=3000 \ --cpu=1000m \ --memory=256Mi \ @@ -339,7 +343,7 @@ jobs: createPR: false changes: | { - "image.repository": "gcr.io/airqo-250220/pr-previews/next-platform-pr-previews", + "image.repository": "${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/next-platform-pr-previews", "image.tag": "${{ github.sha }}" } @@ -401,8 +405,8 @@ jobs: - name: Build and Push Image run: | cd docs/ - docker build --tag gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} . - docker push gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} - name: Deploy to Cloud Run run: |- @@ -411,7 +415,7 @@ jobs: --max-instances=10 \ --timeout=60 \ --concurrency=10 \ - --image=gcr.io/airqo-250220/pr-previews/docs-pr-previews:${{ github.sha }} \ + --image=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/docs-pr-previews:${{ github.sha }} \ --port=3000 \ --cpu=1000m \ --memory=256Mi \ @@ -427,7 +431,7 @@ jobs: createPR: false changes: | { - "image.repository": "gcr.io/airqo-250220/pr-previews/docs-pr-previews", + "image.repository": "${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/pr-previews/docs-pr-previews", "image.tag": "${{ github.sha }}" } @@ -522,14 +526,14 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_DEV_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_STAGE_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} - docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} + --tag ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} + docker push ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} \ + --image-url=${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/website-pr-previews:${{ github.sha }} \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet diff --git a/.github/workflows/deploy-frontends-to-production.yml b/.github/workflows/deploy-frontends-to-production.yml index f03b0b7dc6..2f266cf88b 100644 --- a/.github/workflows/deploy-frontends-to-production.yml +++ b/.github/workflows/deploy-frontends-to-production.yml @@ -24,6 +24,10 @@ on: required: false type: boolean +env: + REGISTRY_URL: gcr.io + PROJECT_ID: airqo-250220 + jobs: image-tag: name: create image tag @@ -81,10 +85,10 @@ jobs: - name: Build and Push Docker Image run: | cd netmanager/ - docker build --tag gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-platform-frontend:latest - docker push gcr.io/airqo-250220/airqo-platform-frontend:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -109,8 +113,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=netmanager/.env env-platform-production | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/netmanager/prod-airqo-platform-frontend.yaml - kubectl set image deployment/airqo-platform-frontend airqo-platform=gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-platform-frontend kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-platform-frontend airqo-platform=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-platform-frontend kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy website ### website: @@ -181,16 +185,16 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_PROD_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_PROD_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} - docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest - docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest + --tag ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} + docker push ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest + docker push ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest \ + --image-url=${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-website:latest \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet @@ -234,10 +238,10 @@ jobs: - name: Build and Push Docker Image run: | cd calibrate/ - docker build --tag gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-calibrate-app:latest - docker push gcr.io/airqo-250220/airqo-calibrate-app:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -261,8 +265,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=calibrate/.env env-calibrate-prod | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/calibrate/prod-airqo-calibrate-app.yaml - kubectl set image deployment/airqo-calibrate-app prod-calibrate-app=gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-calibrate-app kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-calibrate-app prod-calibrate-app=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-calibrate-app kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy next platform ### next-platform: @@ -295,10 +299,10 @@ jobs: - name: Build and Push Docker Image run: | cd platform/ - docker build --tag gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-next-platform:latest - docker push gcr.io/airqo-250220/airqo-next-platform:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -322,8 +326,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=platform/.env env-next-platform-production | kubectl replace -f - -n production echo "=============== Deploy the application ===============" kubectl apply -f k8s/platform/prod-airqo-next-platform.yaml - kubectl set image deployment/airqo-next-platform airqo-next-platform=gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-next-platform kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-next-platform airqo-next-platform=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-next-platform kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production ### deploy docs ### docs: @@ -345,10 +349,10 @@ jobs: - name: Build and Push Docker Image run: | cd docs/ - docker build --tag gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-prod-docs:latest - docker push gcr.io/airqo-250220/airqo-prod-docs:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -363,5 +367,5 @@ jobs: - name: Deploy to K8S run: | kubectl apply -f k8s/docs/prod-airqo-docs.yaml - kubectl set image deployment/airqo-prod-docs airqo-prod-docs=gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} -n production - kubectl annotate deployment/airqo-prod-docs kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production + kubectl set image deployment/airqo-prod-docs airqo-prod-docs=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} -n production + kubectl annotate deployment/airqo-prod-docs kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-prod-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n production diff --git a/.github/workflows/deploy-frontends-to-staging.yml b/.github/workflows/deploy-frontends-to-staging.yml index ffb5a82b3c..96806e381f 100644 --- a/.github/workflows/deploy-frontends-to-staging.yml +++ b/.github/workflows/deploy-frontends-to-staging.yml @@ -7,6 +7,10 @@ on: types: - closed +env: + REGISTRY_URL: gcr.io + PROJECT_ID: airqo-250220 + jobs: image-tag: if: github.event.pull_request.merged == true @@ -123,10 +127,10 @@ jobs: - name: Build and Push Docker Image run: | cd netmanager/ - docker build --tag gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-platform-frontend:latest - docker push gcr.io/airqo-250220/airqo-stage-platform-frontend:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -151,8 +155,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=netmanager/.env env-platform-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/netmanager/stage-airqo-platform-frontend.yaml - kubectl set image deployment/airqo-stage-platform-frontend sta-platform-ui=gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-platform-frontend kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-platform-frontend sta-platform-ui=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-platform-frontend kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-platform-frontend:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy website ### website: @@ -220,16 +224,16 @@ jobs: --build-arg REACT_APP_BASE_NEWSLETTER_URL=${{ secrets.WEBSITE_REACT_APP_BASE_NEWSLETTER_URL }} \ --build-arg REACT_APP_WEBSITE_BASE_URL=${{ secrets.WEBSITE_STAGE_REACT_APP_WEBSITE_BASE_URL }} \ --build-arg REACT_APP_AUTHORIZATION_TOKEN=${{ secrets.WEBSITE_STAGE_REACT_APP_AUTHORIZATION_TOKEN }} \ - --tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} - docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest - docker push gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest + --tag ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} + docker push ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest + docker push ${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest - name: Deploy to App Engine run: |- cd website/ gcloud app deploy \ - --image-url=gcr.io/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest \ + --image-url=${{ env.REGISTRY_URL }}/${{ secrets.FRONTEND_PROJECT_ID }}/airqo-stage-website:latest \ --project=${{ secrets.FRONTEND_PROJECT_ID }} \ --quiet @@ -273,10 +277,10 @@ jobs: - name: Build and Push Docker Image run: | cd calibrate/ - docker build --tag gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-calibrate-app:latest - docker push gcr.io/airqo-250220/airqo-stage-calibrate-app:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -300,8 +304,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=calibrate/.env env-calibrate-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/calibrate/stage-airqo-calibrate-app.yaml - kubectl set image deployment/airqo-stage-calibrate-app sta-calibrate-app=gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-calibrate-app kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-calibrate-app sta-calibrate-app=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-calibrate-app kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-calibrate-app:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy next platform ### next-platform: @@ -334,10 +338,10 @@ jobs: - name: Build and Push Docker Image run: | cd platform/ - docker build --tag gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} . - docker push gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} - docker tag gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-next-platform:latest - docker push gcr.io/airqo-250220/airqo-stage-next-platform:latest + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} . + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:latest - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -361,8 +365,8 @@ jobs: kubectl create configmap --dry-run=client -o yaml --from-env-file=platform/.env env-next-platform-staging | kubectl replace -f - -n staging echo "=============== Deploy the application ===============" kubectl apply -f k8s/platform/stage-airqo-next-platform.yaml - kubectl set image deployment/airqo-stage-next-platform sta-next-platform=gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-next-platform kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-next-platform sta-next-platform=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-next-platform kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-next-platform:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging ### deploy docs ### docs: @@ -384,10 +388,10 @@ jobs: - name: Build and Push Docker Image run: | cd docs/ - docker build --tag gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} . - docker tag gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} gcr.io/airqo-250220/airqo-stage-docs:latest - docker push gcr.io/airqo-250220/airqo-stage-docs:latest - docker push gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} + docker build --tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} . + docker tag ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:latest + docker push ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} - name: Update corresponding helm values file uses: fjogeleit/yaml-update-action@main @@ -402,5 +406,5 @@ jobs: - name: Deploy to K8S run: | kubectl apply -f k8s/docs/stage-airqo-docs.yaml - kubectl set image deployment/airqo-stage-docs sta-docs=gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} -n staging - kubectl annotate deployment/airqo-stage-docs kubernetes.io/change-cause="Image updated to gcr.io/airqo-250220/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging + kubectl set image deployment/airqo-stage-docs sta-docs=${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} -n staging + kubectl annotate deployment/airqo-stage-docs kubernetes.io/change-cause="Image updated to ${{ env.REGISTRY_URL }}/${{ env.PROJECT_ID }}/airqo-stage-docs:${{ needs.image-tag.outputs.build_id }} on ${{ needs.image-tag.outputs.datetime }}" -n staging From dcc135fafe4f7ffaac50123709dc84f799df51c0 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 8 Nov 2022 15:41:45 +0000 Subject: [PATCH 4/5] Update docs staging image tag to stage-090ad16f-1667922055 --- k8s/docs/values-stage.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/k8s/docs/values-stage.yaml b/k8s/docs/values-stage.yaml index 74fa05e057..eb808738ec 100644 --- a/k8s/docs/values-stage.yaml +++ b/k8s/docs/values-stage.yaml @@ -45,15 +45,13 @@ resources: requests: cpu: 10m memory: 20Mi - + autoscaling: minReplicas: 1 maxReplicas: 2 targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - + nodeSelector: {} - tolerations: [] affinity: @@ -66,7 +64,7 @@ affinity: operator: In values: - general-purpose - + app: name: airqo-stage-docs label: sta-docs From f634eee43c948fb5fea10d6de9a3a3edf07d5c3b Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 8 Nov 2022 15:56:45 +0000 Subject: [PATCH 5/5] Update netmanger staging image tag to stage-45ddd0db-1667922355 --- k8s/netmanager/values-stage.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/k8s/netmanager/values-stage.yaml b/k8s/netmanager/values-stage.yaml index ef752637cc..15a270eb8b 100644 --- a/k8s/netmanager/values-stage.yaml +++ b/k8s/netmanager/values-stage.yaml @@ -3,15 +3,14 @@ # Declare variables to be passed into your templates. replicaCount: 2 - image: repository: gcr.io/airqo-250220/airqo-stage-platform-frontend tag: latest pullPolicy: Always imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" +nameOverride: '' +fullnameOverride: '' service: type: NodePort @@ -21,7 +20,7 @@ service: ingress: enabled: false - + nodeSelector: {} torelations: {} @@ -57,7 +56,7 @@ affinity: operator: In values: - high-memory - + app: name: airqo-stage-platform-frontend label: airqo-platform