Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Update deployment log links; remove old deployment workflows (#1882)
sarayourfrienda281dc472fbc
diff --git a/.github/workflows/deploy-production-api.yml b/.github/workflows/deploy-production-api.ymldeleted file mode 100644index 2087c068a..000000000--- a/.github/workflows/deploy-production-api.yml+++ /dev/null@@ -1,254 +0,0 @@-### !!!-# This file is automatically generated using Terraform.-# Do not update it manually. Changes must be made to-# `next/modules/generic/service/deploy_workflow.yml` in-# the `WordPress/openverse-infrastructure` repository.-# If changes need to be made, please request help from-# a maintainer to generate the updated version.-### !!!--name: "Deployment - production-api"--on:- workflow_dispatch:- inputs:- tag:- type: string- required: true- description: Image tag to deploy.- # When the workflow is called by the CI + CD pipeline, the actor appears- # as "github-actions[bot]". In those circumstances, this input, if- # provided must be the GitHub handle of the actual actor. When triggering- # this workflow manually, please leave this empty and it will fallback to- # the right actor.- actor:- type: string- default: ""- description: The actual GitHub user that triggered this dispatch. Leave blank to use workflow dispatcher.--# Only allow a single deployment workflow (service + environment) to happen at a time-# If you need to stop an in-progress deployment of a service to force another for-# the same environment, you'll need to manually cancel it-concurrency: ${{ github.workflow }}--jobs:- deploy:- name: Deploy production-api- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Validate initiation user- uses: actions/github-script@v6- with:- github-token: ${{ secrets.ACCESS_TOKEN }}- script: |- const { data: members } = await github.rest.teams.listMembersInOrg({- org: 'WordPress',- team_slug: 'openverse-maintainers',- });- const isAllowed = "${{ github.actor }}" === "github-actions[bot]" || members.some(m => m.login === "${{ github.actor }}")- if (!isAllowed) {- throw new Error(- "Only GitHub users in the @WordPress/openverse-maintainers "- + "team are allowed to run this workflow. If you need to run "- + "this workflow, please reach out to that group for help."- )- }-- - name: Set the Slack user- shell: python- env:- GH_SLACK_USERNAME_MAP: ${{ secrets.GH_SLACK_USERNAME_MAP }}- run: |- import json- import os- mapping = json.loads('${{ env.GH_SLACK_USERNAME_MAP }}')- github_user = "${{ inputs.actor || github.actor }}"- slack_id = mapping[github_user]- with open(os.getenv('GITHUB_ENV'), "a") as env_file:- env_file.write(f"SLACK_USER_ID={slack_id}")-- - name: Notify deployment start- uses: slackapi/[email protected]- if: success() || failure()- with:- payload: |- {- "text": "Starting deployment of production-api",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":spinning-cd: A deployment of *production-api* triggered by <@${{ env.SLACK_USER_ID }}> is starting using the `${{ inputs.tag }}` tag."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to monitor the deployment>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Validate `tag` input for Nginx- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-api_nginx',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api_nginx image.`- )- }-- - name: Validate `tag` input for Django- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-api',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api image.`- )- }-- - name: Configure AWS credentials- uses: aws-actions/configure-aws-credentials@v2- if: success() || failure()- with:- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- aws-region: us-east-1-- - name: Download task definition template and update family name- shell: bash- run: |- aws ecs describe-task-definition \- --task-definition production-api-template \- --query taskDefinition > task-definition.json-- # Remove template from the family name (the render action does not support this)- sed -i 's/"family": "production-api-template"/"family": "production-api"/g' task-definition.json-- - name: "Fill in the new nginx image ID in the Amazon ECS task definition"- id: "task-def-nginx"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: task-definition.json- container-name: nginx- image: "ghcr.io/wordpress/openverse-api_nginx:${{ inputs.tag }}"-- - name: "Fill in the new django image ID in the Amazon ECS task definition"- id: "task-def-django"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: ${{ steps.task-def-nginx.outputs.task-definition }}- container-name: django- image: "ghcr.io/wordpress/openverse-api:${{ inputs.tag }}"-- - name: Deploy Amazon ECS task definition- uses: aws-actions/amazon-ecs-deploy-task-definition@v1- with:- task-definition: ${{ steps.task-def-django.outputs.task-definition }}- service: production-api- cluster: production-default- wait-for-service-stability: true- wait-for-minutes: 10-- - name: Notify deployment finished- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of production-api successful",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":tadaco: The deployment of *production-api* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *succeeded*."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the completed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Notify deployment failure- if: failure()- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of production-api failed!",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":alert: The deployment of *production-api* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *failed* :alert:"- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the failed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOKdiff --git a/.github/workflows/deploy-production-nuxt.yml b/.github/workflows/deploy-production-nuxt.ymldeleted file mode 100644index a530c4df5..000000000--- a/.github/workflows/deploy-production-nuxt.yml+++ /dev/null@@ -1,218 +0,0 @@-### !!!-# This file is automatically generated using Terraform.-# Do not update it manually. Changes must be made to-# `next/modules/generic/service/deploy_workflow.yml` in-# the `WordPress/openverse-infrastructure` repository.-# If changes need to be made, please request help from-# a maintainer to generate the updated version.-### !!!--name: "Deployment - production-nuxt"--on:- workflow_dispatch:- inputs:- tag:- type: string- required: true- description: Image tag to deploy.- # When the workflow is called by the CI + CD pipeline, the actor appears- # as "github-actions[bot]". In those circumstances, this input, if- # provided must be the GitHub handle of the actual actor. When triggering- # this workflow manually, please leave this empty and it will fallback to- # the right actor.- actor:- type: string- default: ""- description: The actual GitHub user that triggered this dispatch. Leave blank to use workflow dispatcher.--# Only allow a single deployment workflow (service + environment) to happen at a time-# If you need to stop an in-progress deployment of a service to force another for-# the same environment, you'll need to manually cancel it-concurrency: ${{ github.workflow }}--jobs:- deploy:- name: Deploy production-nuxt- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Validate initiation user- uses: actions/github-script@v6- with:- github-token: ${{ secrets.ACCESS_TOKEN }}- script: |- const { data: members } = await github.rest.teams.listMembersInOrg({- org: 'WordPress',- team_slug: 'openverse-maintainers',- });- const isAllowed = "${{ github.actor }}" === "github-actions[bot]" || members.some(m => m.login === "${{ github.actor }}")- if (!isAllowed) {- throw new Error(- "Only GitHub users in the @WordPress/openverse-maintainers "- + "team are allowed to run this workflow. If you need to run "- + "this workflow, please reach out to that group for help."- )- }-- - name: Set the Slack user- shell: python- env:- GH_SLACK_USERNAME_MAP: ${{ secrets.GH_SLACK_USERNAME_MAP }}- run: |- import json- import os- mapping = json.loads('${{ env.GH_SLACK_USERNAME_MAP }}')- github_user = "${{ inputs.actor || github.actor }}"- slack_id = mapping[github_user]- with open(os.getenv('GITHUB_ENV'), "a") as env_file:- env_file.write(f"SLACK_USER_ID={slack_id}")-- - name: Notify deployment start- uses: slackapi/[email protected]- if: success() || failure()- with:- payload: |- {- "text": "Starting deployment of production-nuxt",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":spinning-cd: A deployment of *production-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> is starting using the `${{ inputs.tag }}` tag."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to monitor the deployment>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Validate `tag` input for Nuxt- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-frontend',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-frontend image.`- )- }-- - name: Configure AWS credentials- uses: aws-actions/configure-aws-credentials@v2- if: success() || failure()- with:- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- aws-region: us-east-1-- - name: Download task definition template and update family name- shell: bash- run: |- aws ecs describe-task-definition \- --task-definition production-nuxt-template \- --query taskDefinition > task-definition.json-- # Remove template from the family name (the render action does not support this)- sed -i 's/"family": "production-nuxt-template"/"family": "production-nuxt"/g' task-definition.json-- - name: "Fill in the new nuxt image ID in the Amazon ECS task definition"- id: "task-def-nuxt"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: task-definition.json- container-name: nuxt- image: "ghcr.io/wordpress/openverse-frontend:${{ inputs.tag }}"-- - name: Deploy Amazon ECS task definition- uses: aws-actions/amazon-ecs-deploy-task-definition@v1- with:- task-definition: ${{ steps.task-def-nuxt.outputs.task-definition }}- service: production-nuxt- cluster: production-default- wait-for-service-stability: true- wait-for-minutes: 10-- - name: Notify deployment finished- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of production-nuxt successful",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":tadaco: The deployment of *production-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *succeeded*."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the completed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Notify deployment failure- if: failure()- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of production-nuxt failed!",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":alert: The deployment of *production-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *failed* :alert:"- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the failed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOKdiff --git a/.github/workflows/deploy-staging-api.yml b/.github/workflows/deploy-staging-api.ymldeleted file mode 100644index 94c7eb8a7..000000000--- a/.github/workflows/deploy-staging-api.yml+++ /dev/null@@ -1,254 +0,0 @@-### !!!-# This file is automatically generated using Terraform.-# Do not update it manually. Changes must be made to-# `next/modules/generic/service/deploy_workflow.yml` in-# the `WordPress/openverse-infrastructure` repository.-# If changes need to be made, please request help from-# a maintainer to generate the updated version.-### !!!--name: "Deployment - staging-api"--on:- workflow_dispatch:- inputs:- tag:- type: string- required: true- description: Image tag to deploy.- # When the workflow is called by the CI + CD pipeline, the actor appears- # as "github-actions[bot]". In those circumstances, this input, if- # provided must be the GitHub handle of the actual actor. When triggering- # this workflow manually, please leave this empty and it will fallback to- # the right actor.- actor:- type: string- default: ""- description: The actual GitHub user that triggered this dispatch. Leave blank to use workflow dispatcher.--# Only allow a single deployment workflow (service + environment) to happen at a time-# If you need to stop an in-progress deployment of a service to force another for-# the same environment, you'll need to manually cancel it-concurrency: ${{ github.workflow }}--jobs:- deploy:- name: Deploy staging-api- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Validate initiation user- uses: actions/github-script@v6- with:- github-token: ${{ secrets.ACCESS_TOKEN }}- script: |- const { data: members } = await github.rest.teams.listMembersInOrg({- org: 'WordPress',- team_slug: 'openverse-maintainers',- });- const isAllowed = "${{ github.actor }}" === "github-actions[bot]" || members.some(m => m.login === "${{ github.actor }}")- if (!isAllowed) {- throw new Error(- "Only GitHub users in the @WordPress/openverse-maintainers "- + "team are allowed to run this workflow. If you need to run "- + "this workflow, please reach out to that group for help."- )- }-- - name: Set the Slack user- shell: python- env:- GH_SLACK_USERNAME_MAP: ${{ secrets.GH_SLACK_USERNAME_MAP }}- run: |- import json- import os- mapping = json.loads('${{ env.GH_SLACK_USERNAME_MAP }}')- github_user = "${{ inputs.actor || github.actor }}"- slack_id = mapping[github_user]- with open(os.getenv('GITHUB_ENV'), "a") as env_file:- env_file.write(f"SLACK_USER_ID={slack_id}")-- - name: Notify deployment start- uses: slackapi/[email protected]- if: success() || failure()- with:- payload: |- {- "text": "Starting deployment of staging-api",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":spinning-cd: A deployment of *staging-api* triggered by <@${{ env.SLACK_USER_ID }}> is starting using the `${{ inputs.tag }}` tag."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to monitor the deployment>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Validate `tag` input for Nginx- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-api_nginx',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api_nginx image.`- )- }-- - name: Validate `tag` input for Django- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-api',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-api image.`- )- }-- - name: Configure AWS credentials- uses: aws-actions/configure-aws-credentials@v2- if: success() || failure()- with:- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- aws-region: us-east-1-- - name: Download task definition template and update family name- shell: bash- run: |- aws ecs describe-task-definition \- --task-definition staging-api-template \- --query taskDefinition > task-definition.json-- # Remove template from the family name (the render action does not support this)- sed -i 's/"family": "staging-api-template"/"family": "staging-api"/g' task-definition.json-- - name: "Fill in the new nginx image ID in the Amazon ECS task definition"- id: "task-def-nginx"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: task-definition.json- container-name: nginx- image: "ghcr.io/wordpress/openverse-api_nginx:${{ inputs.tag }}"-- - name: "Fill in the new django image ID in the Amazon ECS task definition"- id: "task-def-django"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: ${{ steps.task-def-nginx.outputs.task-definition }}- container-name: django- image: "ghcr.io/wordpress/openverse-api:${{ inputs.tag }}"-- - name: Deploy Amazon ECS task definition- uses: aws-actions/amazon-ecs-deploy-task-definition@v1- with:- task-definition: ${{ steps.task-def-django.outputs.task-definition }}- service: staging-api- cluster: staging-default- wait-for-service-stability: true- wait-for-minutes: 10-- - name: Notify deployment finished- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of staging-api successful",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":tadaco: The deployment of *staging-api* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *succeeded*."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the completed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Notify deployment failure- if: failure()- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of staging-api failed!",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":alert: The deployment of *staging-api* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *failed* :alert:"- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the failed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOKdiff --git a/.github/workflows/deploy-staging-nuxt.yml b/.github/workflows/deploy-staging-nuxt.ymldeleted file mode 100644index e03e0a507..000000000--- a/.github/workflows/deploy-staging-nuxt.yml+++ /dev/null@@ -1,218 +0,0 @@-### !!!-# This file is automatically generated using Terraform.-# Do not update it manually. Changes must be made to-# `next/modules/generic/service/deploy_workflow.yml` in-# the `WordPress/openverse-infrastructure` repository.-# If changes need to be made, please request help from-# a maintainer to generate the updated version.-### !!!--name: "Deployment - staging-nuxt"--on:- workflow_dispatch:- inputs:- tag:- type: string- required: true- description: Image tag to deploy.- # When the workflow is called by the CI + CD pipeline, the actor appears- # as "github-actions[bot]". In those circumstances, this input, if- # provided must be the GitHub handle of the actual actor. When triggering- # this workflow manually, please leave this empty and it will fallback to- # the right actor.- actor:- type: string- default: ""- description: The actual GitHub user that triggered this dispatch. Leave blank to use workflow dispatcher.--# Only allow a single deployment workflow (service + environment) to happen at a time-# If you need to stop an in-progress deployment of a service to force another for-# the same environment, you'll need to manually cancel it-concurrency: ${{ github.workflow }}--jobs:- deploy:- name: Deploy staging-nuxt- runs-on: ubuntu-latest-- steps:- - name: Checkout repository- uses: actions/checkout@v3-- - name: Validate initiation user- uses: actions/github-script@v6- with:- github-token: ${{ secrets.ACCESS_TOKEN }}- script: |- const { data: members } = await github.rest.teams.listMembersInOrg({- org: 'WordPress',- team_slug: 'openverse-maintainers',- });- const isAllowed = "${{ github.actor }}" === "github-actions[bot]" || members.some(m => m.login === "${{ github.actor }}")- if (!isAllowed) {- throw new Error(- "Only GitHub users in the @WordPress/openverse-maintainers "- + "team are allowed to run this workflow. If you need to run "- + "this workflow, please reach out to that group for help."- )- }-- - name: Set the Slack user- shell: python- env:- GH_SLACK_USERNAME_MAP: ${{ secrets.GH_SLACK_USERNAME_MAP }}- run: |- import json- import os- mapping = json.loads('${{ env.GH_SLACK_USERNAME_MAP }}')- github_user = "${{ inputs.actor || github.actor }}"- slack_id = mapping[github_user]- with open(os.getenv('GITHUB_ENV'), "a") as env_file:- env_file.write(f"SLACK_USER_ID={slack_id}")-- - name: Notify deployment start- uses: slackapi/[email protected]- if: success() || failure()- with:- payload: |- {- "text": "Starting deployment of staging-nuxt",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":spinning-cd: A deployment of *staging-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> is starting using the `${{ inputs.tag }}` tag."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to monitor the deployment>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Validate `tag` input for Nuxt- uses: actions/github-script@v6- with:- script: |- let exists = undefined,- page = 0- while (!exists) {- page += 1- const { data: versions } =- await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({- package_type: 'container',- package_name: 'openverse-frontend',- org: 'WordPress',- page,- // max of `per_page`- per_page: 100,- })- if (!versions.length) {- break- }- exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))- }- if (!exists) {- throw new Error(- `'${{ inputs.tag }}' does not appear to be a valid tag for the ghcr.io/wordpress/openverse-frontend image.`- )- }-- - name: Configure AWS credentials- uses: aws-actions/configure-aws-credentials@v2- if: success() || failure()- with:- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- aws-region: us-east-1-- - name: Download task definition template and update family name- shell: bash- run: |- aws ecs describe-task-definition \- --task-definition staging-nuxt-template \- --query taskDefinition > task-definition.json-- # Remove template from the family name (the render action does not support this)- sed -i 's/"family": "staging-nuxt-template"/"family": "staging-nuxt"/g' task-definition.json-- - name: "Fill in the new nuxt image ID in the Amazon ECS task definition"- id: "task-def-nuxt"- uses: "aws-actions/amazon-ecs-render-task-definition@v1"- with:- task-definition: task-definition.json- container-name: nuxt- image: "ghcr.io/wordpress/openverse-frontend:${{ inputs.tag }}"-- - name: Deploy Amazon ECS task definition- uses: aws-actions/amazon-ecs-deploy-task-definition@v1- with:- task-definition: ${{ steps.task-def-nuxt.outputs.task-definition }}- service: staging-nuxt- cluster: staging-default- wait-for-service-stability: true- wait-for-minutes: 10-- - name: Notify deployment finished- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of staging-nuxt successful",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":tadaco: The deployment of *staging-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *succeeded*."- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the completed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK-- - name: Notify deployment failure- if: failure()- uses: slackapi/[email protected]- with:- payload: |- {- "text": "Deployment of staging-nuxt failed!",- "blocks": [- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": ":alert: The deployment of *staging-nuxt* triggered by <@${{ env.SLACK_USER_ID }}> using the `${{ inputs.tag }}` tag *failed* :alert:"- }- },- {- "type": "section",- "text": {- "type": "mrkdwn",- "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here to review the failed deployment workflow>."- }- }- ]- }- env:- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}- SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOKdiff --git a/documentation/general/deployment.md b/documentation/general/deployment.mdindex 62bb943c3..b4e7df9ef 100644--- a/documentation/general/deployment.md+++ b/documentation/general/deployment.md@@ -5,19 +5,23 @@ information regarding the ingestion server or our Airflow instance.## Real-time Deployment Information+```{note}+Deployment logs are currently held in a private repository but are linked here for the benefit of maintainers. If you need information regarding deployments generally or a specific deployment, please ping `@WordPress/openverse-maintainers` and someone can retrieve the information you need for you.+```+### Frontend-| Environment | Deployment Log | URL | Version Endpoint |-| ----------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------- |-| Staging | [Deployment Log](https://github.com/WordPress/openverse/actions/workflows/deploy-staging-nuxt.yml) | <https://staging.openverse.org> | [`/version.json`](https://staging.openverse.org/version.json) |-| Production | [Deployment Log](https://github.com/WordPress/openverse/actions/workflows/deploy-production-nuxt.yml) | <https://production.openverse.org> | [`/version.json`](https://production.openverse.org/version.json) |+| Environment | Deployment Log | URL | Version Endpoint |+| ----------- | -------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------- |+| Staging | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-staging-nuxt.yml) | <https://staging.openverse.org> | [`/version.json`](https://staging.openverse.org/version.json) |+| Production | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-production-nuxt.yml) | <https://production.openverse.org> | [`/version.json`](https://production.openverse.org/version.json) |### API-| Environment | Deployment Log | URL | Version Endpoint |-| ----------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------- |-| Staging | [Deployment Log](https://github.com/WordPress/openverse/actions/workflows/deploy-staging-api.yml) | <https://api-staging.openverse.engineering> | [`/version`](https://api-staging.openverse.engineering/version) |-| Production | [Deployment Log](https://github.com/WordPress/openverse/actions/workflows/deploy-production-api.yml) | <https://api.openverse.engineering> | [`/version`](https://api.openverse.engineering/version) |+| Environment | Deployment Log | URL | Version Endpoint |+| ----------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------- |+| Staging | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-staging-api.yml) | <https://api-staging.openverse.engineering> | [`/version`](https://api-staging.openverse.engineering/version) |+| Production | [Deployment Log](https://github.com/WordPress/openverse-infrastructure/actions/workflows/deploy-production-api.yml) | <https://api.openverse.engineering> | [`/version`](https://api.openverse.engineering/version) |## Overview