diff --git a/.github/workflows/push_docker_image.yml b/.github/workflows/push_docker_image.yml deleted file mode 100644 index a519c833718..00000000000 --- a/.github/workflows/push_docker_image.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Publish Docker images on-demand -on: - workflow_dispatch: - inputs: - image: - description: 'Image to push (options: "api", "api_nginx", or "ingestion_server")' - required: true - commit: - description: Commit that the image is built from - required: true - -concurrency: ${{ github.workflow }}-${{ inputs.image }}-${{ inputs.commit }} - -jobs: - push: - name: Publish requested Docker image - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v3 - with: - registry: https://ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Determine successful run ID - id: determine-run-id - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.ACCESS_TOKEN }} - script: | - const [owner, repo] = '${{ github.repository }}'.split('/') - const { data: runs } = await github.rest.actions.listWorkflowRunsForRepo({ - owner, - repo, - branch: 'main', - event: 'push', - status: 'success', - head_sha: '${{ github.event.inputs.commit }}', - }) - const runId = runs.workflow_runs.find((run) => run.name === 'CI + CD').id - core.setOutput('run_id', runId) - - - name: Download image `${{ github.event.inputs.image }}` - uses: actions/download-artifact@v4 - with: - name: ${{ github.event.inputs.image }} - path: /tmp - github_token: ${{ secrets.ACCESS_TOKEN }} - repository: ${{ github.repository }} - run_id: ${{ steps.determine-run-id.outputs.run_id }} - - - name: Load and tag image `${{ github.event.inputs.image }}` - env: - INPUT_IMAGE: ${{ github.event.inputs.image }} - run: | - docker load --input "/tmp/$INPUT_IMAGE.tar" - docker tag "openverse-$INPUT_IMAGE" \ - "ghcr.io/wordpress/openverse-$INPUT_IMAGE:${{ github.event.inputs.commit }}" - docker push --all-tags "ghcr.io/wordpress/openverse-$INPUT_IMAGE" diff --git a/documentation/_static/publish_action_example.png b/documentation/_static/publish_action_example.png deleted file mode 100644 index 1eb86490a57..00000000000 Binary files a/documentation/_static/publish_action_example.png and /dev/null differ diff --git a/documentation/general/deployment.md b/documentation/general/deployment.md index 9125bf2b91c..6c53108102a 100644 --- a/documentation/general/deployment.md +++ b/documentation/general/deployment.md @@ -60,9 +60,11 @@ workflow is completely automated and auditable via GitHub Workflows.** 1. Build and publish the docker image(s) for the application and tag appropriately for the deployment. - - This happens inside the - [`ci_cd.yml` workflow](https://github.com/WordPress/openverse/blob/2646c5ead465603b42c70f58a190f7b50861d698/.github/workflows/ci_cd.yml#L866) + - This happens for every commit on the `main` branch inside the + [`ci_cd.yml` workflow](https://github.com/WordPress/openverse/blob/ce5424f2dfce97772ebd887f09e8943f89c56171/.github/workflows/ci_cd.yml#L905) rather than the deployment workflows. + - If wishing to publish from a non-`main` branch, use the + [`perform_deploy` input on the `ci_cd.yml` workflow](https://github.com/WordPress/openverse/blob/ce5424f2dfce97772ebd887f09e8943f89c56171/.github/workflows/ci_cd.yml#L16). 2. Download the template task definition from AWS for the environment and application being deployed. Render a new task definition based on the template, changing the following: diff --git a/documentation/general/index.md b/documentation/general/index.md index fb23bf58f17..76fb15ce097 100644 --- a/documentation/general/index.md +++ b/documentation/general/index.md @@ -8,7 +8,6 @@ general_setup quickstart run test -publish zero_downtime_database_management deployment logging diff --git a/documentation/general/publish.md b/documentation/general/publish.md deleted file mode 100644 index 3892450f562..00000000000 --- a/documentation/general/publish.md +++ /dev/null @@ -1,68 +0,0 @@ -# Publish - -The production API and ingestion server Docker images are published to -[Github Container Registry](https://ghcr.io). They can be found here: - -- API: - [ghcr.io/wordpress/openverse-api](https://ghcr.io/wordpress/openverse-api) -- Ingestion server: - [ghcr.io/wordpress/openverse-ingestion_server](https://ghcr.io/wordpress/openverse-ingestion_server) - -These images are published under two conditions: on release, or manually. - -## On release - -When a new release is cut, the -[CI/CD action will run](https://github.com/WordPress/openverse-api/actions/workflows/ci_cd.yml?query=event%3Arelease). -The final step of this action uploads the Docker images to their respective -registries with the following tags: - -- Release reference name, typically the git tag (e.g. `v2.4.2`) -- `latest` -- The commit SHA of the tagged commit (e.g. - `b25879b84ec9d7b650be689c03384937a93eb06d`) - -In some cases, releases may not alter the Docker image. For instance, in a -release where only the API was changed, the ingestion server image would have -the same Docker image hash. In these instances, the new tags are added to the -existing image. - -## Manually - -The Docker image for a particular service can also be published manually. This -process is initiated by the -[Publish Docker images on-demand](https://github.com/WordPress/openverse-api/actions/workflows/push_docker_image.yml) -action. The workflow file for this action can be found here: -[`push_docker_image.yml`](https://github.com/WordPress/openverse-api/blob/main/.github/workflows/push_docker_image.yml). - -This action **will only publish & tag a service's image with the commit SHA** -(i.e. it will not tag with `latest` or the git reference name). This is useful -for cases where one or more Docker images need to be tested on a staging -environment before being merged and cut with a release. This action also -**requires that the CI/CD workflow has previously run on the specified commit**. -This typically requires a PR in order to initiate. - -Note that this action can only run on commits that had successful CI/CD runs in -the last 90 days -[due to GitHub's default artifact retention policy](https://docs.github.com/en/organizations/managing-organization-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization). - -### Steps - -_Note: -[GitHub's documentation provides screenshots for the various steps](https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch)_ - -1. Navigate to the `openverse` "Actions" tab in GitHub: - [github.com/WordPress/openverse/actions](https://github.com/WordPress/openverse/actions). -2. Select the "Publish Docker images on-demand" workflow. -3. Click the "Run workflow" button. - 1. (Optional) change the branch _that the workflow is running from_ (this - does not change anything about the target commit) - 2. For the `image` parameter, specify either `api` or `ingestion_server`. - 3. For the `commit` parameter, specify the commit that the built Docker image - artifact should be pulled from. -4. Click the green "Run workflow" button. - -The newest run should appear in the Action list, and its status can be tracked -from there. - -![Example Screenshot](/_static/publish_action_example.png)