From 75001aee99bc02401e70be0247dbd8959d9b347e Mon Sep 17 00:00:00 2001 From: Adrian Clay Date: Tue, 19 Sep 2023 15:57:34 +0100 Subject: [PATCH] Get the `./release.sh` script working, and document how to use it (#142) * Update release script to generate multiple architecture builds * Update CHANGELOG.md * Create instructions on how to create a release * Also update the `mhs-base` images Switch over to buildx to generate arm architecture image. Document that these exist within the dev notes. Bump to version 1.0.3 --- CHANGELOG.md | 6 +++++ dockers/mhs-base/inbound/VERSION | 2 +- dockers/mhs-base/inbound/release.sh | 10 +++----- dockers/mhs-base/outbound/VERSION | 2 +- dockers/mhs-base/outbound/release.sh | 10 +++----- dockers/mhs-base/sds/VERSION | 2 +- dockers/mhs-base/sds/release.sh | 10 +++----- mhs/mhs-adaptor-dev-notes.md | 29 ++++++++++++++++++++++++ release-scripts/release.sh | 34 +++++++++------------------- 9 files changed, 58 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51d2a4d40..60bc9dbc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.2.7] - 2023-09-18 + +### Fixed + +Fix issue where inbound messages containing multibyte UTF-8 characters are mangled. + ## [1.2.2] - 2022-04-21 ### Changed diff --git a/dockers/mhs-base/inbound/VERSION b/dockers/mhs-base/inbound/VERSION index e6d5cb833..e4c0d46e5 100644 --- a/dockers/mhs-base/inbound/VERSION +++ b/dockers/mhs-base/inbound/VERSION @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/dockers/mhs-base/inbound/release.sh b/dockers/mhs-base/inbound/release.sh index 224869323..e2017fab3 100755 --- a/dockers/mhs-base/inbound/release.sh +++ b/dockers/mhs-base/inbound/release.sh @@ -8,10 +8,6 @@ IMAGE=nia-mhs-inbound-base docker run --rm -v "$PWD":/app treeder/bump patch version=`cat VERSION` echo "version: $version" -# run build -docker build -t $USERNAME/$IMAGE:latest -f Dockerfile . -# tag it -docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$version -# push it -docker push $USERNAME/$IMAGE:latest -docker push $USERNAME/$IMAGE:$version \ No newline at end of file + +# Build, tag, push +docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push \ No newline at end of file diff --git a/dockers/mhs-base/outbound/VERSION b/dockers/mhs-base/outbound/VERSION index e6d5cb833..e4c0d46e5 100644 --- a/dockers/mhs-base/outbound/VERSION +++ b/dockers/mhs-base/outbound/VERSION @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/dockers/mhs-base/outbound/release.sh b/dockers/mhs-base/outbound/release.sh index a2fdaeb41..b7ee2e98b 100755 --- a/dockers/mhs-base/outbound/release.sh +++ b/dockers/mhs-base/outbound/release.sh @@ -8,10 +8,6 @@ IMAGE=nia-mhs-outbound-base docker run --rm -v "$PWD":/app treeder/bump patch version=`cat VERSION` echo "version: $version" -# run build -docker build -t $USERNAME/$IMAGE:latest -f Dockerfile . -# tag it -docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$version -# push it -docker push $USERNAME/$IMAGE:latest -docker push $USERNAME/$IMAGE:$version \ No newline at end of file + +# Build, tag, push +docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push \ No newline at end of file diff --git a/dockers/mhs-base/sds/VERSION b/dockers/mhs-base/sds/VERSION index e6d5cb833..e4c0d46e5 100644 --- a/dockers/mhs-base/sds/VERSION +++ b/dockers/mhs-base/sds/VERSION @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/dockers/mhs-base/sds/release.sh b/dockers/mhs-base/sds/release.sh index 227b73a90..8630d76d6 100755 --- a/dockers/mhs-base/sds/release.sh +++ b/dockers/mhs-base/sds/release.sh @@ -8,10 +8,6 @@ IMAGE=nia-sds-base docker run --rm -v "$PWD":/app treeder/bump patch version=`cat VERSION` echo "version: $version" -# run build -docker build -t $USERNAME/$IMAGE:latest -f Dockerfile . -# tag it -docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$version -# push it -docker push $USERNAME/$IMAGE:latest -docker push $USERNAME/$IMAGE:$version \ No newline at end of file + +# Build, tag, push +docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push \ No newline at end of file diff --git a/mhs/mhs-adaptor-dev-notes.md b/mhs/mhs-adaptor-dev-notes.md index 638bd8b15..648efc519 100644 --- a/mhs/mhs-adaptor-dev-notes.md +++ b/mhs/mhs-adaptor-dev-notes.md @@ -157,3 +157,32 @@ https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-fire Any content POSTed to `/` on port 80 will result in the request configuration for the `Interaction-Id` header in `data/interactions.json` being loaded and the content sent as the body of the request to Spine. Adding entries to `interactions.json` will allow you to define new supported interactions. + +## Creating a release + +### Releasing the main images + +First identify which is the most recent commit within GitHub which contains only changes which are marked as Done within Jira. +You can also review what commits have gone in by using the git log command or IDE. + +Make a note of the most recent Release within GitHub, and identify what the next version number to use will be. + +Create a new release within GitHub, specifying the tag as the version to use (e.g. 1.2.7), 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. + +From the root of this repository, 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 > Service Manager then find the option 'retrieve keys'. + +Execute `./release.sh`. + +Log out of DockerHub. + +### Releasing the base images + +There exists three base images, within the folder `dockers/mhs-base`. + +Releasing these requires you to be logged into Dockerhub as per above, and then within each folder runnning the respective `release.sh` script. \ No newline at end of file diff --git a/release-scripts/release.sh b/release-scripts/release.sh index 2116e42e9..962e62b01 100755 --- a/release-scripts/release.sh +++ b/release-scripts/release.sh @@ -1,28 +1,16 @@ -#!/bin/bash +#!/bin/bash -export BUILD_TAG=1.2.2 +set -e -cd .. - -./build.sh +export BUILD_TAG=1.2.7 -docker tag local/mhs-inbound:${BUILD_TAG} nhsdev/nia-mhs-inbound:${BUILD_TAG} -docker tag local/mhs-outbound:${BUILD_TAG} nhsdev/nia-mhs-outbound:${BUILD_TAG} -docker tag local/mhs-route:${BUILD_TAG} nhsdev/nia-mhs-route:${BUILD_TAG} +git fetch +git checkout $BUILD_TAG -if [ "$1" == "-y" ]; -then - - BRANCH=$(git rev-parse --abbrev-ref HEAD) - if [[ "$BRANCH" != "develop" ]]; then - echo 'Can only run this on the develop branch'; - exit 1; - fi +cd .. - echo "Tagging and pushing Docker image and git tag" - docker push nhsdev/nia-mhs-inbound:${BUILD_TAG} - docker push nhsdev/nia-mhs-outbound:${BUILD_TAG} - docker push nhsdev/nia-mhs-route:${BUILD_TAG} - git tag -a ${BUILD_TAG} -m "Release ${BUILD_TAG}" - git push origin ${BUILD_TAG} -fi +# These are buildx versions of what is inside of `build.sh` +BASE_IMAGE_TAG="${BASE_IMAGE_TAG:-latest}" +docker buildx build --build-arg BASE_IMAGE_TAG=$BASE_IMAGE_TAG -f mhs/inbound/Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag nhsdev/nia-mhs-inbound:${BUILD_TAG} --push +docker buildx build --build-arg BASE_IMAGE_TAG=$BASE_IMAGE_TAG -f mhs/outbound/Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag nhsdev/nia-mhs-outbound:${BUILD_TAG} --push +docker buildx build --build-arg BASE_IMAGE_TAG=$BASE_IMAGE_TAG -f mhs/spineroutelookup/Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag nhsdev/nia-mhs-route:${BUILD_TAG} --push \ No newline at end of file