From 5cfb0179b535005f69e27c9695c91175e5023973 Mon Sep 17 00:00:00 2001 From: Guy Hannay Date: Tue, 26 Mar 2024 12:33:18 +0000 Subject: [PATCH 1/4] test: build --- Makefile | 10 +++++----- infrastructure/batch.tf | 2 +- infrastructure/ecr.tf | 12 +++--------- infrastructure/ecs.tf | 4 ++-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 5c0b7e89..d1ed0259 100644 --- a/Makefile +++ b/Makefile @@ -58,17 +58,17 @@ ECR_REPO_NAME=$(APP_NAME) IMAGE_TAG=$$(git rev-parse HEAD) tf_build_args=-var "image_tag=$(IMAGE_TAG)" -.PHONY: docker/login -docker/login: +.PHONY: docker_login +docker_login: aws ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin $(ECR_URL) .PHONY: docker_build -docker/build: +docker_build: cd frontend && \ docker build -t $(ECR_REPO_URL):$(IMAGE_TAG) . -.PHONY: docker/push -docker/push: +.PHONY: docker_push +docker_push: docker push $(IMAGE) .PHONY: docker_update_tag diff --git a/infrastructure/batch.tf b/infrastructure/batch.tf index 39842480..a08687c3 100644 --- a/infrastructure/batch.tf +++ b/infrastructure/batch.tf @@ -21,7 +21,7 @@ module "batch_job_defintiion" { region = var.region compute_environment_arn = [module.batch_compute.ec2_compute_environment_arn] state_bucket = var.state_bucket - image = module.ecr_pre_processing.ecr_repository_url + image = module.ecr.ecr_repository_url fargate_flag = false } diff --git a/infrastructure/ecr.tf b/infrastructure/ecr.tf index 0581d0eb..18c71122 100644 --- a/infrastructure/ecr.tf +++ b/infrastructure/ecr.tf @@ -1,13 +1,7 @@ -module "ecr_front_end" { +module "ecr" { source = "../../i-ai-core-infrastructure//modules/ecr" - project_name_prefix = var.project_name - container_name = "front-end" -} - -module "ecr_pre_processing" { - source = "../../i-ai-core-infrastructure//modules/ecr" - project_name_prefix = var.project_name - container_name = "pre-processing" + project_name = var.project_name + container_name_suffix = null } diff --git a/infrastructure/ecs.tf b/infrastructure/ecs.tf index e2accb2d..740d9e7f 100644 --- a/infrastructure/ecs.tf +++ b/infrastructure/ecs.tf @@ -1,9 +1,9 @@ module "ecs" { source = "../../i-ai-core-infrastructure//modules/ecs" project_name = var.project_name - image_tag = "dfcde6a235a58d4e708e53c9c2252477516c414b" + image_tag = "5586478ada171e6b4fc81c3c4142f2d125079bf3" prefix = "i-dot-ai" - ecr_repository_uri = module.ecr_front_end.ecr_repository_url + ecr_repository_uri = module.ecr.ecr_repository_url ecs_cluster_id = data.terraform_remote_state.platform.outputs.ecs_cluster_id health_check = { healthy_threshold = 3 From d9af773664d0c2aa23f20f8877430468446fc579 Mon Sep 17 00:00:00 2001 From: Guy Hannay Date: Tue, 26 Mar 2024 12:41:12 +0000 Subject: [PATCH 2/4] add: docker_echo --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index d1ed0259..d185fb1c 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,11 @@ docker_update_tag: MANIFEST=$$(aws ecr batch-get-image --repository-name $(ECR_REPO_NAME) --image-ids imageTag=$(IMAGE_TAG) --query 'images[].imageManifest' --output text) && \ aws ecr put-image --repository-name $(ECR_REPO_NAME) --image-tag $(tag) --image-manifest "$$MANIFEST" +# Ouputs the value that you're after - useful to get a value i.e. IMAGE_TAG out of the Makefile +.PHONY: docker_echo +docker_echo: + echo $($(value)) + CONFIG_DIR=../../consultation-analyser-infra-config TF_BACKEND_CONFIG=$(CONFIG_DIR)/backend.hcl From 6a458d95fa6c30d18bbe4a00a2a0f6b36d4974e8 Mon Sep 17 00:00:00 2001 From: Guy Hannay Date: Tue, 26 Mar 2024 12:48:18 +0000 Subject: [PATCH 3/4] edit: pull main --- .github/workflows/build-gh.yml | 6 +++--- .github/workflows/build-infra.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-gh.yml b/.github/workflows/build-gh.yml index 4489c75f..ec555d1e 100644 --- a/.github/workflows/build-gh.yml +++ b/.github/workflows/build-gh.yml @@ -30,7 +30,7 @@ jobs: echo "RUNNER_LABEL=self-hosted" >> $GITHUB_OUTPUT start-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml needs: set-vars with: EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }} @@ -45,7 +45,7 @@ jobs: needs: - set-vars - start-runner - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml with: APP_NAME: ${{ needs.set-vars.outputs.app-name }} RUNNER_LABEL: ${{ needs.set-vars.outputs.runner_label }} @@ -58,7 +58,7 @@ jobs: stop-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml if: needs.start-runner.outputs.use-persisted == 0 && always() needs: - set-vars diff --git a/.github/workflows/build-infra.yml b/.github/workflows/build-infra.yml index e78bd4d7..ce005894 100644 --- a/.github/workflows/build-infra.yml +++ b/.github/workflows/build-infra.yml @@ -34,7 +34,7 @@ jobs: echo "::add-mask::${AWS_REGION}" start-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml needs: set-vars with: EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }} @@ -50,7 +50,7 @@ jobs: needs: - set-vars - start-runner - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml with: APP_NAME: ${{ needs.set-vars.outputs.app-name }} RUNNER_LABEL: ${{ needs.start-runner.outputs.label }} @@ -67,7 +67,7 @@ jobs: - set-vars - start-runner - build-infra - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@feature/apply-terraform + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml if: needs.start-runner.outputs.use-persisted == 0 && always() with: RUNNER_LABEL: ${{ needs.start-runner.outputs.label }} From bd8e0e65a549245c6a23bea0dbc4d2a81069ba94 Mon Sep 17 00:00:00 2001 From: Guy Hannay Date: Tue, 26 Mar 2024 12:48:57 +0000 Subject: [PATCH 4/4] edit: pull main --- .github/workflows/build-gh.yml | 6 +++--- .github/workflows/build-infra.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-gh.yml b/.github/workflows/build-gh.yml index ec555d1e..bb86e112 100644 --- a/.github/workflows/build-gh.yml +++ b/.github/workflows/build-gh.yml @@ -30,7 +30,7 @@ jobs: echo "RUNNER_LABEL=self-hosted" >> $GITHUB_OUTPUT start-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@main needs: set-vars with: EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }} @@ -45,7 +45,7 @@ jobs: needs: - set-vars - start-runner - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/build-docker.yml@main with: APP_NAME: ${{ needs.set-vars.outputs.app-name }} RUNNER_LABEL: ${{ needs.set-vars.outputs.runner_label }} @@ -58,7 +58,7 @@ jobs: stop-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@main if: needs.start-runner.outputs.use-persisted == 0 && always() needs: - set-vars diff --git a/.github/workflows/build-infra.yml b/.github/workflows/build-infra.yml index ce005894..1e901c91 100644 --- a/.github/workflows/build-infra.yml +++ b/.github/workflows/build-infra.yml @@ -34,7 +34,7 @@ jobs: echo "::add-mask::${AWS_REGION}" start-runner: - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/start-runner.yml@main needs: set-vars with: EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }} @@ -50,7 +50,7 @@ jobs: needs: - set-vars - start-runner - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/apply-terraform.yml@main with: APP_NAME: ${{ needs.set-vars.outputs.app-name }} RUNNER_LABEL: ${{ needs.start-runner.outputs.label }} @@ -67,7 +67,7 @@ jobs: - set-vars - start-runner - build-infra - uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml + uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/stop-runner.yml@main if: needs.start-runner.outputs.use-persisted == 0 && always() with: RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}