Skip to content

Commit 4418f9b

Browse files
[PRM-713] Undone removal from re-registration service - will go in another ticket
1 parent ad5624d commit 4418f9b

File tree

1 file changed

+41
-0
lines changed
  • services/re-registration-service

1 file changed

+41
-0
lines changed

services/re-registration-service/tasks

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ function check_env {
4545
fi
4646
}
4747

48+
function set_image_tag() {
49+
if [[ -z "${GO_DEPENDENCY_LABEL_APP}" ]]; then
50+
export IMAGE_TAG=${GO_PIPELINE_LABEL:-$(git rev-parse HEAD | cut -c 1-8)}
51+
else
52+
export IMAGE_TAG=${GO_DEPENDENCY_LABEL_APP}
53+
fi
54+
}
55+
4856
function get_aws_account_id {
4957
AWS_ACCOUNT_ID=$(aws sts get-caller-identity | jq -r .Account)
5058
}
@@ -138,5 +146,38 @@ case "${command}" in
138146
run_localstack_local)
139147
docker-compose -f docker-compose.localstack-local.yaml up -d
140148
;;
149+
tf)
150+
check_env
151+
_assume_environment_role $NHS_ENVIRONMENT
152+
tf_init
153+
bash
154+
;;
155+
tf_plan)
156+
check_env
157+
_assume_environment_role $NHS_ENVIRONMENT
158+
tf_plan $2
159+
;;
160+
tf_apply)
161+
check_env
162+
_assume_environment_role $NHS_ENVIRONMENT
163+
tf_apply
164+
;;
165+
promote_docker_image)
166+
check_env
167+
set_image_tag
168+
promote_docker_image "$IMAGE_REPO_NAME:$IMAGE_TAG" "$NHS_ENVIRONMENT"
169+
;;
170+
wait_ecs)
171+
check_env
172+
_assume_environment_role $NHS_ENVIRONMENT
173+
aws ecs wait services-stable \
174+
--region $AWS_DEFAULT_REGION \
175+
--cluster $NHS_ENVIRONMENT-${NHS_SERVICE}-ecs-cluster \
176+
--service $NHS_ENVIRONMENT-${NHS_SERVICE}
177+
;;
178+
*)
179+
echo "Invalid command: '${command}'"
180+
exit 1
181+
;;
141182
esac
142183
set +e

0 commit comments

Comments
 (0)