Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ Resources:
- "ecr:CompleteLayerUpload"
- "ecr:BatchCheckLayerAvailability"
- "ecr:PutImage"
- "ecr:BatchGetImage"
- "ecr:GetDownloadUrlForLayer"
Resource:
- "*"
- Effect: Allow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,35 @@ def determine_build_image(codebuild_id, scope, target, map_params):
.get('image')
)
if isinstance(specific_image, dict):
repo_arn = _ecr.Repository.from_repository_arn(
scope,
f'custom_repo_{codebuild_id}',
specific_image.get('repository_arn', ''),
)
return _codebuild.LinuxBuildImage.from_ecr_repository(
repo_arn,
specific_image.get('tag', 'latest'),
)
repository_name = specific_image.get('repository_name', '')
repository_arn = specific_image.get('repository_arn', '')

# If repository name is specified we construct arn

if repository_name:
constructed_repository_arn = f"arn:aws:ecr:{ADF_DEPLOYMENT_REGION}:{ADF_DEPLOYMENT_ACCOUNT_ID}:{repository_name}"
repo_arn = _ecr.Repository.from_repository_arn(
scope,
f'custom_repo_{codebuild_id}',
constructed_repository_arn
)
return _codebuild.LinuxBuildImage.from_ecr_repository(
repo_arn,
specific_image.get('tag', 'latest'),
)
elif repository_arn:
# We take the full ECR Arn - Default Behaviour
repo_arn = _ecr.Repository.from_repository_arn(
scope,
f'custom_repo_{codebuild_id}',
specific_image.get('repository_arn', ''),
)
return _codebuild.LinuxBuildImage.from_ecr_repository(
repo_arn,
specific_image.get('tag', 'latest'),
)
raise Exception(f"Repository arn or Repository name is not specified")

return CodeBuild.get_image_by_name(specific_image)

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@

# CodeBuild
CODEBUILD_IMAGE_PROPS = {
"repository_arn": str, # arn:aws:ecr:region:111111111111:repository/test
Optional("repository_arn"): str, # arn:aws:ecr:region:111111111111:repository/test
Optional("repository_name"): str, # hello-world
Optional("tag"): str, # defaults to latest
}
CODEBUILD_PROPS = {
Expand Down