Skip to content

Commit

Permalink
Merge branch 'test/end-to-end-infra' into feature/release-infra-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ghannay10 committed Mar 26, 2024
2 parents 7320e70 + bd8e0e6 commit 440a9a6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@main
needs: set-vars
with:
EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }}
Expand All @@ -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@main
with:
APP_NAME: ${{ needs.set-vars.outputs.app-name }}
RUNNER_LABEL: ${{ needs.set-vars.outputs.runner_label }}
Expand All @@ -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@main
if: needs.start-runner.outputs.use-persisted == 0 && always()
needs:
- set-vars
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
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@main
needs: set-vars
with:
EC2_INSTANCE_TYPE: ${{ needs.set-vars.outputs.ec2-instance-type }}
Expand All @@ -66,7 +66,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@main
with:
APP_NAME: ${{ needs.set-vars.outputs.app-name }}
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
Expand All @@ -83,7 +83,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@main
if: needs.start-runner.outputs.use-persisted == 0 && always()
with:
RUNNER_LABEL: ${{ needs.start-runner.outputs.label }}
Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,29 @@ 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
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
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/batch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 3 additions & 9 deletions infrastructure/ecr.tf
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions infrastructure/ecs.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 440a9a6

Please sign in to comment.