Skip to content

Commit

Permalink
Merge pull request #869 from arnaldo2792/create-ecr-repos
Browse files Browse the repository at this point in the history
Makefile: add target to create ECR repositories for each agent
  • Loading branch information
arnaldo2792 authored Sep 13, 2023
2 parents 1bb86de + 848465e commit 3465019
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ PUSH_IMAGES = $(addprefix push-, $(IMAGES))
tag-images $(TAG_IMAGES) push-images $(PUSH_IMAGES) print-image-names \
help

# Store targets to create the ECR repos
CREATE_REPOS = $(addprefix create-repo-, $(IMAGES))

export DOCKER_BUILDKIT=1
export CARGO_HOME = $(TOP)/.cargo

Expand Down Expand Up @@ -221,3 +224,17 @@ endif

mdlint:
docker run --rm -v "$$(pwd)":/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.md"

# Define a target to create the ECR repos, if they don't exist for the configured credentials
create-repos: $(CREATE_REPOS)
$(CREATE_REPOS): REPO = $(@:create-repo-%=%)
$(CREATE_REPOS):
@if ! 2>&1 1>/dev/null aws ecr describe-repositories --repository-names $(REPO); then \
echo "Creating repository $(REPO)"; \
if ! 2>&1 1>/dev/null aws ecr create-repository --repository-name=$(REPO); then \
echo "Failed to create repository $(REPO)"; exit 1; \
fi; \
echo "Created repository $(REPO)"; \
else \
echo "Repository already $(REPO) exists"; \
fi

0 comments on commit 3465019

Please sign in to comment.