Skip to content

Commit 88e0b77

Browse files
sandbox tag
1 parent 1efe487 commit 88e0b77

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

.github/actions/build-proxies/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ runs:
2727
then
2828
echo "INSTANCE=$PROXYGEN_API_NAME" >> $GITHUB_ENV
2929
echo "TARGET=https://suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
30+
echo "SANDBOX_TAG = latest" >> $GITHUB_ENV
3031
else
3132
echo "TARGET=https://pr$PR_NUMBER.suppliers.dev.nhsnotify.national.nhs.uk" >> $GITHUB_ENV
3233
echo "INSTANCE=$PROXYGEN_API_NAME-PR-$PR_NUMBER" >> $GITHUB_ENV
34+
echo "SANDBOX_TAG = pr$PR_NUMBER" >> $GITHUB_ENV
3335
fi
3436
3537
@@ -71,6 +73,11 @@ runs:
7173
run: |
7274
make build-json-oas-spec APIM_ENV=sandbox
7375
76+
- name: Set docker tag
77+
shell: bash
78+
run: |
79+
jq --arg newtag "$SANDBOX_TAG" '.["x-nhsd-apim"].target.containers[0].image.tag = $newtag' build/notify-supplier.json > build/notify-supplier_target.json && mv build/notify-supplier_target.json build/notify-supplier.json
80+
7481
- name: Deploy to Internal Dev Sandbox
7582
shell: bash
7683
run: |

.github/actions/build-sandbox/action.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,23 @@ runs:
4747
envsubst < ./.github/proxygen-settings.yaml > ${HOME}/.proxygen/settings.yaml
4848
envsubst < ./.github/proxygen-settings.yaml | cat
4949
50+
- name: Setup Proxy Name and target
51+
shell: bash
52+
run: |
53+
54+
if [ -z $PR_NUMBER ]
55+
then
56+
echo "SANDBOX_TAG = latest" >> $GITHUB_ENV
57+
else
58+
echo "SANDBOX_TAG = pr$PR_NUMBER" >> $GITHUB_ENV
59+
fi
60+
5061
- name: Build and publish sandbox Docker image
5162
shell: bash
5263
working-directory: ./sandbox
5364
run: |
5465
proxygen docker get-login | bash
55-
docker build -t nhs-notify-supplier:latest .
56-
IMAGE_ID=$(docker images -q nhs-notify-supplier:latest)
57-
docker tag $IMAGE_ID 958002497996.dkr.ecr.eu-west-2.amazonaws.com/nhs-notify-supplier:latest
58-
docker push 958002497996.dkr.ecr.eu-west-2.amazonaws.com/nhs-notify-supplier:latest
66+
docker build -t nhs-notify-supplier:$SANDBOX_TAG .
67+
IMAGE_ID=$(docker images -q nhs-notify-supplier:$SANDBOX_TAG)
68+
docker tag $IMAGE_ID 958002497996.dkr.ecr.eu-west-2.amazonaws.com/nhs-notify-supplier:$SANDBOX_TAG
69+
docker push 958002497996.dkr.ecr.eu-west-2.amazonaws.com/nhs-notify-supplier:$SANDBOX_TAG

specification/api/components/x-nhsd-apim/target-sandbox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ containers:
44
- name: nhs-notify-supplier
55
image:
66
name: nhs-notify-supplier
7-
tag: latest
7+
tag: pr99
88
environment:
99
LOG_LEVEL: info
1010
NODE_ENV: development

0 commit comments

Comments
 (0)