Skip to content

Commit

Permalink
Get the ./release.sh script working, and document how to use it (#142)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
adrianclay authored Sep 19, 2023
1 parent ac970e4 commit 75001ae
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 47 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dockers/mhs-base/inbound/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
10 changes: 3 additions & 7 deletions dockers/mhs-base/inbound/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

# Build, tag, push
docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push
2 changes: 1 addition & 1 deletion dockers/mhs-base/outbound/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
10 changes: 3 additions & 7 deletions dockers/mhs-base/outbound/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

# Build, tag, push
docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push
2 changes: 1 addition & 1 deletion dockers/mhs-base/sds/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
10 changes: 3 additions & 7 deletions dockers/mhs-base/sds/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

# Build, tag, push
docker buildx build -f Dockerfile . --platform linux/arm64/v8,linux/amd64 --tag $USERNAME/$IMAGE:latest --tag $USERNAME/$IMAGE:$version --push
29 changes: 29 additions & 0 deletions mhs/mhs-adaptor-dev-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
34 changes: 11 additions & 23 deletions release-scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 75001ae

Please sign in to comment.