Skip to content

Commit

Permalink
Automate the adaptor release to Dockerhub process (#192)
Browse files Browse the repository at this point in the history
* Rename dockers folder to docker to be consistent with other adaptors

This will be required when using the release-adaptor-container-image
GitHub Actions workflow as it assumes the folder is called docker.

* Move adaptor Dockerfiles into the docker folder

This consolidates Dockerfiles into one place, keeping this adaptor
directory layout consistent with other adaptors.

This also allows us to use the release-adaptor-container-image
GitHub Actions shared workflow.

* Automate the adaptor release to Dockerhub process

This should speed up and simplify the process of releasing
  • Loading branch information
adrianclay authored Sep 9, 2024
1 parent 94a6433 commit d32b0a9
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 35 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
tags: "*"

jobs:
push_to_dockerhub:
strategy:
matrix:
image:
- {folder: spineroutelookup, dockerhub_name: nia-mhs-route}
- {folder: outbound, dockerhub_name: nia-mhs-outbound}
- {folder: inbound, dockerhub_name: nia-mhs-inbound}
uses: NHSDigital/integration-adaptor-actions/.github/workflows/release-adaptor-container-image.yml@main
with:
dockerhub_name: ${{matrix.image.dockerhub_name}}
folder: ${{matrix.image.folder}}

secrets: inherit
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pipeline {
expression { currentBuild.resultIsBetterOrEqualTo('SUCCESS') }
}
steps {
buildAndPushImage('${LOCAL_INBOUND_IMAGE_NAME}', '${INBOUND_IMAGE_NAME}', 'mhs/inbound/Dockerfile')
buildAndPushImage('${LOCAL_INBOUND_IMAGE_NAME}', '${INBOUND_IMAGE_NAME}', 'docker/inbound/Dockerfile')
}
}
}
Expand All @@ -84,7 +84,7 @@ pipeline {
expression { currentBuild.resultIsBetterOrEqualTo('SUCCESS') }
}
steps {
buildAndPushImage('${LOCAL_OUTBOUND_IMAGE_NAME}', '${OUTBOUND_IMAGE_NAME}', 'mhs/outbound/Dockerfile')
buildAndPushImage('${LOCAL_OUTBOUND_IMAGE_NAME}', '${OUTBOUND_IMAGE_NAME}', 'docker/outbound/Dockerfile')
}
}
}
Expand All @@ -110,7 +110,7 @@ pipeline {
expression { currentBuild.resultIsBetterOrEqualTo('SUCCESS') }
}
steps {
buildAndPushImage('${LOCAL_ROUTE_IMAGE_NAME}', '${ROUTE_IMAGE_NAME}', 'mhs/spineroutelookup/Dockerfile')
buildAndPushImage('${LOCAL_ROUTE_IMAGE_NAME}', '${ROUTE_IMAGE_NAME}', 'docker/spineroutelookup/Dockerfile')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following illustration shows the MHS adaptor in the wider systems context:
## Repository Contents
This repository contains the following directories:
- [common](common) - A Python package containing components and utilities that are common to several integration adaptors.
- [dockers](dockers) - Files used to create each of the base docker images that make up the MHS adaptor
- [docker](docker) - Files used to create each of the base docker images that make up the MHS adaptor
- [documentation](documentation) - Documentation and assets for the integration adaptors including workflows and two architecture exemplars based on AWS and Azure
- [integration-tests](integration-tests) - A package containing integration tests intended to pre-assure the MHS Adaptor
- [mhs](mhs) - A pre-assured implementation of a Message Handling Service (MHS), that encapsulates the details of Spine
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e
BUILD_TAG="${BUILD_TAG:-latest}"
docker build -t local/mhs-inbound:${BUILD_TAG} -f mhs/inbound/Dockerfile .
docker build -t local/mhs-outbound:${BUILD_TAG} -f mhs/outbound/Dockerfile .
docker build -t local/mhs-route:${BUILD_TAG} -f mhs/spineroutelookup/Dockerfile .
docker build -t local/mhs-inbound:${BUILD_TAG} -f docker/inbound/Dockerfile .
docker build -t local/mhs-outbound:${BUILD_TAG} -f docker/outbound/Dockerfile .
docker build -t local/mhs-route:${BUILD_TAG} -f docker/spineroutelookup/Dockerfile .
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ services:
- TIMEOUT=connect 0, client 0, server 0

sds-api-mock:
build: ./dockers/sds-api-mock
build: ./docker/sds-api-mock
ports:
- "8081:8080"
command:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 2 additions & 12 deletions mhs/mhs-adaptor-dev-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,6 @@ Make a note of the most recent Release within GitHub, and identify what the next

Create a new release within GitHub, specifying the tag as the version to use (e.g. 1.2.9), and the target being the commit you identified.
Click on the "Generate release notes" button and this will list all the current changes from the recent commit.
Click the "Publish release" button, this will start an automated GitHub Actions workflow to publish the images to Dockerhub for the new version.

CD into `released scripts` folder and update the `/release.sh`, changing the `BUILD_TAG` value to match the release created above.
Update the `CHANGELOG.md` file, copying the release information within the GitHub release.
Raise a PR for your changes.

Once your changes have been merged, log into DockerHub using the credentials stored within our AWS accounts Secrets Manager, secret name `nhsdev-dockerhub-credentials` in London region.
Go to AWS Management Console > Secrets Manager then find the option 'retrieve keys'.

If you have not created a release before then you will first need to create a new docker builder instance using `docker buildx create --use`.

Execute `./release.sh`.

Log out of DockerHub.
Update the `CHANGELOG.md` file, adding a new version header for all the changes being released. Raise a PR for your changes.
15 changes: 0 additions & 15 deletions release-scripts/release.sh

This file was deleted.

0 comments on commit d32b0a9

Please sign in to comment.