-
Notifications
You must be signed in to change notification settings - Fork 253
Description
In AWS ECR, repositories naming results in followed image style references.
$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$ECR_NAME:$TAG
Our team needs some flexibility in the way our ECRs are named. We do not want to have ECRs named based based solely on the forge rock component name (i.e. we don't want an ECR named ds).
Our preferred names would be something like the following:
12345678.dkr.ecr.us-east-1.amazonaws.com/wizbang-ds:v0.0.1-0.1
Given an ECR named wizbang-ds I was unable to convince the forgeops image subcommand to produce output that I could use. When I provided a parameter of --image-repo 12345678.dkr.ecr.us-east-1.amazonaws.com/wizbang-ds forgeops attempted to use 12345678.dkr.ecr.us-east-1.amazonaws.com/wizbang-ds/ds:v0.0.1-0.1 as the fully qualified name which does not work with ECR.
Patching as follows solved my problem and I feel is a better system because when a user sets --image-repo they don't need the forgeops tool to add /{image_name}.
diff --git a/lib/python/releases.py b/lib/python/releases.py
index fbc8179..59971a1 100644
--- a/lib/python/releases.py
+++ b/lib/python/releases.py
@@ -199,7 +199,7 @@ def set_image(image_name, tag, repo=None):
repo: string
"""
data = { 'image': {} }
- data['image']['repository'] = f"{repo}/{image_name}" if repo else image_name
+ data['image']['repository'] = f"{repo}" if repo else image_name
if tag:
data['image']['tag'] = tag
return dataWith the patch above, my scripting can use the following:
forgeops image \
--env-name "$fgo_env" \
--image-repo "$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/wizbang-$component" \
--tag "$tag" \
"$component"Please consider using this approach in the future or suggest another way to achive the same result with the existing forgeops tool.