From efc0a467c2147d669dfa1f18fe02792285797f8c Mon Sep 17 00:00:00 2001 From: Pauline <4224001+paulineribeyre@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:44:06 -0600 Subject: [PATCH] continue on error --- files/scripts/ecr-access-job.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/files/scripts/ecr-access-job.py b/files/scripts/ecr-access-job.py index b8b4e2925..da1bb2dd2 100644 --- a/files/scripts/ecr-access-job.py +++ b/files/scripts/ecr-access-job.py @@ -145,10 +145,13 @@ def update_access_in_ecr(repo_to_account_ids: List[dict], ecr_role_arn: str) -> # which the script was run most recently. eg QA and Staging can't use the same ECR repos. # Appending is not possible since this code will eventually rely on Arborist for authorization information # and we'll need to overwrite in order to remove expired access. - response = ecr.set_repository_policy( - repositoryName=repo, - policyText=json.dumps(policy), - ) + try: + ecr.set_repository_policy( + repositoryName=repo, + policyText=json.dumps(policy), + ) + except Exception as e: + print(f"Unable to allow AWS accounts {account_ids} to use ECR repository '{repo}' - skipping it: {e}") def main() -> None: