Skip to content

Commit

Permalink
Merge pull request #6 from alphagov/update-deployment
Browse files Browse the repository at this point in the history
Update deployment
  • Loading branch information
mike29736 authored Dec 21, 2023
2 parents 727d7dc + 5499632 commit f44a772
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Deploy

run-name: Deploy ${{ inputs.gitRef || github.ref_name }} to integration
run-name: Deploy ${{ inputs.gitRef || github.event.release.tag_name }} to ${{ inputs.environment || 'production' }}

on:
workflow_dispatch:
Expand All @@ -9,26 +9,33 @@ on:
description: 'Commit, tag or branch name to deploy'
required: true
type: string
environment:
description: 'Environment to deploy to'
required: true
type: choice
options:
- production
default: 'production'
release:
types: [released]

jobs:
build-and-publish-image:
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref_name, 'v')
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')
name: Build and publish image
uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-image.yml@main
with:
gitRef: ${{ inputs.gitRef || github.ref_name }}
gitRef: ${{ inputs.gitRef || github.event.release.tag_name }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_GOVUK_ECR_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_GOVUK_ECR_SECRET_ACCESS_KEY }}
trigger-deploy:
name: Trigger deploy to integration
name: Trigger deploy to ${{ inputs.environment || 'production' }}
needs: build-and-publish-image
uses: alphagov/govuk-infrastructure/.github/workflows/deploy.yml@main
with:
imageTag: ${{ needs.build-and-publish-image.outputs.imageTag }}
environment: integration
environment: ${{ inputs.environment || 'production' }}
secrets:
WEBHOOK_TOKEN: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_TOKEN }}
WEBHOOK_URL: ${{ secrets.GOVUK_ARGO_EVENTS_WEBHOOK_URL }}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ In production, it's run from a scheduled task via its `./collect` executable.

`bundle exec rspec`

### Docs

[Deployments](docs/deployments.md)

## Licence

[MIT License](LICENCE.txt)
24 changes: 24 additions & 0 deletions docs/deployments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deployments

## Target environment

This project only runs in production and only has the one target environment for deployments.

For this reason, deployment promotion between environments has no meaning for this project.

## How deployment works

Since the project is run from a scheduled task (a K8s `CronJob`), its deployment process differs slightly from that of our apps and some details might prove useful to be aware of if they're not already familiar to you.

Everytime it's run on its schedule, a new Pod will pull a new copy of this project's Docker image from ECR. This differs from the way apps work in that an app's long-running Pods are reprovisioned with the new image once, during the deployment itself.

As with our other projects, when changes are merged, a new release tag is created and in turn, the changes will be deployed automatically.

## Deploying to integration

Because the scheduled task only usually runs in production, some changes are required to enable a version to be deployed to integration (e.g. for testing),

* "integration" will have to be added to the list of target environments in [this repository's deploy workflow](https://github.com/alphagov/govuk-sli-collector/blob/main/.github/workflows/deploy.yml)
* [the production Helm charts configuration](https://github.com/alphagov/govuk-helm-charts/blob/1adc5596a3fa5df5b030c8248c338ec0293a4ea7/charts/app-config/values-production.yaml#L1275) will have to be copied into [the equivalent integration file](https://github.com/alphagov/govuk-helm-charts/blob/1adc5596a3fa5df5b030c8248c338ec0293a4ea7/charts/app-config/values-integration.yaml)

(If you only need integration temporarily, don't forget to revert these changes when you're done.)

0 comments on commit f44a772

Please sign in to comment.