Skip to content

Commit dcf84ae

Browse files
authored
Merge pull request #71 from MITLibraries/dev
Dev-to-Stage: Update browsertrix-harvester Outputs
2 parents 12c8aad + 50382ce commit dcf84ae

File tree

2 files changed

+13
-31
lines changed

2 files changed

+13
-31
lines changed

files/makefile-cpu-arch.tpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dist-dev: check-arch ## Build docker container (intended for developer-based man
2626
docker buildx use $(ECR_NAME_DEV); \
2727
docker buildx build --platform $(CPU_ARCH) \
2828
--load \
29+
--tag $(ECR_URL_DEV):$$ARCH_TAG \
2930
--tag $(ECR_URL_DEV):make-$$ARCH_TAG \
3031
--tag $(ECR_URL_DEV):make-$(shell git describe --always) \
3132
--tag $(ECR_NAME_DEV):$$ARCH_TAG \
@@ -34,9 +35,11 @@ dist-dev: check-arch ## Build docker container (intended for developer-based man
3435
publish-dev: dist-dev ## Build, tag and push (intended for developer-based manual publish)
3536
@ARCH_TAG=$$(cat .arch_tag); \
3637
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(ECR_URL_DEV); \
38+
docker push $(ECR_URL_DEV):$$ARCH_TAG; \
3739
docker push $(ECR_URL_DEV):make-$$ARCH_TAG; \
3840
docker push $(ECR_URL_DEV):make-$(shell git describe --always); \
39-
docker push $(ECR_URL_DEV):make-$(shell echo $(CPU_ARCH) | cut -d'/' -f2)
41+
echo "Cleaning up dangling Docker images..."; \
42+
docker image prune -f --filter "dangling=true"
4043

4144
### If this is a Lambda repo, uncomment the two lines below ###
4245
# update-lambda-dev: ## Updates the lambda with whatever is the most recent image in the ecr (intended for developer-based manual update)
@@ -49,9 +52,9 @@ publish-dev: dist-dev ## Build, tag and push (intended for developer-based manua
4952
docker-clean: ## Clean up Docker detritus
5053
@ARCH_TAG=$$(cat .arch_tag); \
5154
echo "Cleaning up Docker leftovers (containers, images, builders)"; \
55+
docker rmi -f $(ECR_URL_DEV):$$ARCH_TAG; \
5256
docker rmi -f $(ECR_URL_DEV):make-$$ARCH_TAG; \
5357
docker rmi -f $(ECR_URL_DEV):make-$(shell git describe --always) || true; \
54-
docker rmi -f $(ECR_URL_DEV):make-$(shell echo $(CPU_ARCH) | cut -d'/' -f2) || true; \
5558
docker rmi -f $(ECR_NAME_DEV):$$ARCH_TAG || true; \
5659
docker buildx rm $(ECR_NAME_DEV) || true
5760
@rm -rf .arch_tag

timdex_ecrs.tf

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,10 @@ module "ecr_timdex_browsertrix" {
258258
app-repo = "timdex-infrastructure-browsertrix"
259259
}
260260
}
261-
# NEED TO FIX THE MISSPELLING!!!
262-
moved {
263-
from = module.ecr_timdex_broswertrix
264-
to = module.ecr_timdex_browsertrix
265-
}
261+
266262
# Outputs in dev
267263
output "browsertrix_dev_build_workflow" {
268-
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", {
264+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build-cpu-arch.tpl", {
269265
region = var.aws_region
270266
role = module.ecr_timdex_browsertrix.gha_role
271267
ecr = module.ecr_timdex_browsertrix.repository_name
@@ -274,28 +270,20 @@ output "browsertrix_dev_build_workflow" {
274270
)
275271
description = "Full contents of the dev-build.yml for the browsertrix-harvester repo"
276272
}
277-
# NEED TO FIX THE MISSPELLING!!!
278-
moved {
279-
from = output.broswertrix_dev_build_workflow
280-
to = output.browsertrix_dev_build_workflow
281-
}
273+
282274
output "browsertrix_makefile" {
283-
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", {
275+
value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile-cpu-arch.tpl", {
284276
ecr_name = module.ecr_timdex_browsertrix.repository_name
285277
ecr_url = module.ecr_timdex_browsertrix.repository_url
286278
function = ""
287279
}
288280
)
289281
description = "Full contents of the Makefile for the browsertrix-harvester repo (allows devs to push to Dev account only)"
290282
}
291-
# NEED TO FIX THE MISSPELLING!!!
292-
moved {
293-
from = output.broswertrix_makefile
294-
to = output.browsertrix_makefile
295-
}
283+
296284
# Outputs in stage
297285
output "browsertrix_stage_build_workflow" {
298-
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", {
286+
value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build-cpu-arch.tpl", {
299287
region = var.aws_region
300288
role = module.ecr_timdex_browsertrix.gha_role
301289
ecr = module.ecr_timdex_browsertrix.repository_name
@@ -304,14 +292,10 @@ output "browsertrix_stage_build_workflow" {
304292
)
305293
description = "Full contents of the stage-build.yml for the browsertrix-harvester repo"
306294
}
307-
# NEED TO FIX THE MISSPELLING!!!
308-
moved {
309-
from = output.broswertrix_stage_build_workflow
310-
to = output.browsertrix_stage_build_workflow
311-
}
295+
312296
# Outputs after promotion to prod
313297
output "browsertrix_prod_promote_workflow" {
314-
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", {
298+
value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote-cpu-arch.tpl", {
315299
region = var.aws_region
316300
role_stage = "${module.ecr_timdex_browsertrix.repo_name}-gha-stage"
317301
role_prod = "${module.ecr_timdex_browsertrix.repo_name}-gha-prod"
@@ -322,11 +306,6 @@ output "browsertrix_prod_promote_workflow" {
322306
)
323307
description = "Full contents of the prod-promote.yml for the browsertrix-harvester repo"
324308
}
325-
# NEED TO FIX THE MISSPELLING!!!
326-
moved {
327-
from = output.broswertrix_prod_promote_workflow
328-
to = output.browsertrix_prod_promote_workflow
329-
}
330309

331310

332311
## geo-harvester

0 commit comments

Comments
 (0)