From f9ebf743aec02f0bc0b0db46ea6236dec64fbbf8 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Mon, 11 Dec 2023 13:17:53 +0100 Subject: [PATCH] chore(workflows): only update macro index --- .github/workflows/prod-build.yml | 113 ------------------------------ .github/workflows/stage-build.yml | 113 ------------------------------ 2 files changed, 226 deletions(-) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index e2041def7700..db2a8f5684e1 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -283,122 +283,9 @@ jobs: yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json - - name: Update search index - if: ${{ ! vars.SKIP_BUILD }} - env: - DEPLOYER_ELASTICSEARCH_URL: ${{ secrets.DEPLOYER_PROD_ELASTICSEARCH_URL }} - run: | - cd deployer - poetry run deployer search-index ../client/build - - - name: Authenticate with GCP - if: ${{ ! vars.SKIP_BUILD }} - uses: google-github-actions/auth@v2 - with: - token_format: access_token - service_account: deploy-prod-content@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com - workload_identity_provider: projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions - - - name: Setup gcloud - if: ${{ ! vars.SKIP_BUILD }} - uses: google-github-actions/setup-gcloud@v1 - - - name: Sync build - if: ${{ ! vars.SKIP_BUILD }} - run: |- - gsutil -q -m -h "Cache-Control: public, max-age=3600" cp -r client/build/static gs://${{ vars.GCP_BUCKET_NAME }}/main/ - gsutil -q -m -h "Cache-Control: public, max-age=3600" rsync -cdrj html,json,txt -y "^static/|^plain.html$" client/build gs://${{ vars.GCP_BUCKET_NAME }}/main - - - name: Authenticate with GCP - if: ${{ ! vars.SKIP_FUNCTION }} - uses: google-github-actions/auth@v2 - with: - token_format: access_token - service_account: deploy-prod-prod-mdn-ingress@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com - workload_identity_provider: projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions - - - name: Setup gcloud - if: ${{ ! vars.SKIP_FUNCTION }} - uses: google-github-actions/setup-gcloud@v1 - with: - install_components: "beta" - - - name: Generate redirects map - if: ${{ ! vars.SKIP_FUNCTION }} - working-directory: cloud-function - env: - CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files - CONTENT_TRANSLATED_ROOT: ${{ github.workspace }}/mdn/translated-content/files - run: |- - npm ci - npm run build-redirects - - - name: Deploy Function - if: ${{ ! vars.SKIP_FUNCTION }} - run: |- - for region in europe-west1 us-west1 asia-east1; do - gcloud beta functions deploy mdn-prod-prod-$region \ - --gen2 \ - --runtime=nodejs18 \ - --region=$region \ - --source=cloud-function \ - --trigger-http \ - --allow-unauthenticated \ - --entry-point=mdnHandler \ - --concurrency=100 \ - --min-instances=10 \ - --max-instances=1000 \ - --memory=2GB \ - --timeout=60s \ - --set-env-vars="ORIGIN_MAIN=developer.mozilla.org" \ - --set-env-vars="ORIGIN_LIVE_SAMPLES=live.mdnplay.dev" \ - --set-env-vars="ORIGIN_PLAY=mdnplay.dev" \ - --set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \ - --set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \ - --set-env-vars="BSA_ENABLED=true" \ - --set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \ - --set-env-vars="SENTRY_ENVIRONMENT=prod" \ - --set-env-vars="SENTRY_TRACES_SAMPLE_RATE=${{ vars.SENTRY_TRACES_SAMPLE_RATE }}" \ - --set-env-vars="SENTRY_RELEASE=${{ github.sha }}" \ - --set-secrets="KEVEL_SITE_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-kevel-site-id/versions/latest" \ - --set-secrets="KEVEL_NETWORK_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-kevel-network-id/versions/latest" \ - --set-secrets="SIGN_SECRET=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-sign-secret/versions/latest" \ - --set-secrets="BSA_ZONE_KEYS=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/prod-bsa-zone-keys/versions/latest" \ - 2>&1 | sed "s/^/[$region] /" & - pids+=($!) - done - - for pid in "${pids[@]}"; do - wait $pid - done - - - name: Update AI Help index - run: yarn ai-help update-index - env: - CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files - OPENAI_KEY: ${{ secrets.OPENAI_KEY }} - SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} - SUPABASE_URL: ${{ secrets.SUPABASE_URL }} - - name: Update AI Help index with macros run: yarn ai-help-macros update-index env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }} SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} SUPABASE_URL: ${{ secrets.SUPABASE_URL }} - - - name: Slack Notification - if: failure() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: mdn-notifications - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://avatars.slack-edge.com/2020-11-17/1513880588420_fedd7f0e9456888e69ff_96.png - SLACK_TITLE: ":rotating_light: Prod :rotating_light:" - SLACK_MESSAGE: "Build failed :collision:" - SLACK_FOOTER: "Powered by prod-build.yml" - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - - name: Invalidate Google Cloud CDN - if: ${{ github.event.inputs.invalidate }} - run: gcloud compute url-maps invalidate-cdn-cache ${{ secrets.GCP_LOAD_BALANCER_NAME }} --path "/*" --async diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index 5d8daebc6a7f..de99b025d34e 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -276,122 +276,9 @@ jobs: yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json yarn tool whatsdeployed $CONTENT_TRANSLATED_ROOT --output client/build/_whatsdeployed/translated-content.json - - name: Update search index - if: ${{ ! vars.SKIP_BUILD }} - env: - DEPLOYER_ELASTICSEARCH_URL: ${{ secrets.DEPLOYER_STAGE_ELASTICSEARCH_URL }} - run: | - cd deployer - poetry run deployer search-index ../client/build - - - name: Authenticate with GCP - if: ${{ ! vars.SKIP_BUILD }} - uses: google-github-actions/auth@v2 - with: - token_format: access_token - service_account: deploy-stage-content@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com - workload_identity_provider: projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions - - - name: Setup gcloud - if: ${{ ! vars.SKIP_BUILD }} - uses: google-github-actions/setup-gcloud@v1 - - - name: Sync build - if: ${{ ! vars.SKIP_BUILD }} - run: |- - gsutil -q -m -h "Cache-Control: public, max-age=3600" cp -r client/build/static gs://${{ vars.GCP_BUCKET_NAME }}/main/ - gsutil -q -m -h "Cache-Control: public, max-age=3600" rsync -cdrj html,json,txt -y "^static/|^plain.html$" client/build gs://${{ vars.GCP_BUCKET_NAME }}/main - - - name: Authenticate with GCP - if: ${{ ! vars.SKIP_FUNCTION }} - uses: google-github-actions/auth@v2 - with: - token_format: access_token - service_account: deploy-stage-nonprod-mdn-ingre@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com - workload_identity_provider: projects/${{ secrets.WIP_PROJECT_ID }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions - - - name: Setup gcloud - if: ${{ ! vars.SKIP_FUNCTION }} - uses: google-github-actions/setup-gcloud@v1 - with: - install_components: "beta" - - - name: Generate redirects map - if: ${{ ! vars.SKIP_FUNCTION }} - working-directory: cloud-function - env: - CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files - CONTENT_TRANSLATED_ROOT: ${{ github.workspace }}/mdn/translated-content/files - run: | - npm ci - npm run build-redirects - - - name: Deploy Function - if: ${{ ! vars.SKIP_FUNCTION }} - run: |- - for region in europe-west1 us-west1 asia-east1; do - gcloud beta functions deploy mdn-nonprod-stage-$region \ - --gen2 \ - --runtime=nodejs18 \ - --region=$region \ - --source=cloud-function \ - --trigger-http \ - --allow-unauthenticated \ - --entry-point=mdnHandler \ - --concurrency=100 \ - --min-instances=1 \ - --max-instances=100 \ - --memory=2GB \ - --timeout=60s \ - --set-env-vars="ORIGIN_MAIN=developer.allizom.org" \ - --set-env-vars="ORIGIN_LIVE_SAMPLES=live.mdnyalp.dev" \ - --set-env-vars="ORIGIN_PLAY=mdnyalp.dev" \ - --set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \ - --set-env-vars="SOURCE_API=https://api.developer.allizom.org/" \ - --set-env-vars="BSA_ENABLED=true" \ - --set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \ - --set-env-vars="SENTRY_ENVIRONMENT=stage" \ - --set-env-vars="SENTRY_TRACES_SAMPLE_RATE=${{ vars.SENTRY_TRACES_SAMPLE_RATE }}" \ - --set-env-vars="SENTRY_RELEASE=${{ github.sha }}" \ - --set-secrets="KEVEL_SITE_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-kevel-site-id/versions/latest" \ - --set-secrets="KEVEL_NETWORK_ID=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-kevel-network-id/versions/latest" \ - --set-secrets="SIGN_SECRET=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-sign-secret/versions/latest" \ - --set-secrets="BSA_ZONE_KEYS=projects/${{ secrets.GCP_PROJECT_NAME }}/secrets/stage-bsa-zone-keys/versions/latest" \ - 2>&1 | sed "s/^/[$region] /" & - pids+=($!) - done - - for pid in "${pids[@]}"; do - wait $pid - done - - - name: Update AI Help index - run: yarn ai-help update-index - env: - CONTENT_ROOT: ${{ github.workspace }}/mdn/content/files - OPENAI_KEY: ${{ secrets.OPENAI_KEY }} - SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} - SUPABASE_URL: ${{ secrets.SUPABASE_URL }} - - name: Update AI Help index with macros run: yarn ai-help-macros update-index env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }} SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} SUPABASE_URL: ${{ secrets.SUPABASE_URL }} - - - name: Slack Notification - if: failure() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: mdn-notifications - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://avatars.slack-edge.com/2020-11-17/1513880588420_fedd7f0e9456888e69ff_96.png - SLACK_TITLE: "Stage" - SLACK_MESSAGE: "Build failed :collision:" - SLACK_FOOTER: "Powered by stage-build.yml" - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - - name: Invalidate CDN - if: ${{ github.event.inputs.invalidate }} - run: gcloud compute url-maps invalidate-cdn-cache ${{ secrets.GCP_LOAD_BALANCER_NAME }} --path "/*" --async