@@ -100,8 +100,8 @@ def helm_handler(event, context):
100
100
101
101
def get_oci_cmd (repository , version ):
102
102
# Generates OCI command based on pattern. Public ECR vs Private ECR are treated differently.
103
- private_ecr_pattern = 'oci://(?P<registry>\d+.dkr.ecr.(?P<region>[a-z0-9\-]+).amazonaws.com)*'
104
- public_ecr_pattern = 'oci://(?P<registry>public.ecr.aws)*'
103
+ private_ecr_pattern = 'oci://(?P<registry>\d+\ .dkr\ .ecr\ .(?P<region>[a-z0-9\-]+)\ .amazonaws\ .com)*'
104
+ public_ecr_pattern = 'oci://(?P<registry>public\ .ecr\ .aws)*'
105
105
106
106
private_registry = re .match (private_ecr_pattern , repository ).groupdict ()
107
107
public_registry = re .match (public_ecr_pattern , repository ).groupdict ()
@@ -115,7 +115,7 @@ def get_oci_cmd(repository, version):
115
115
elif public_registry ['registry' ] is not None :
116
116
logger .info ("Found AWS public repository, will use default region as deployment" )
117
117
region = os .environ .get ('AWS_REGION' , 'us-east-1' )
118
-
118
+
119
119
if is_ecr_public_available (region ):
120
120
cmnd = [
121
121
f"aws ecr-public get-login-password --region us-east-1 | " \
@@ -124,7 +124,7 @@ def get_oci_cmd(repository, version):
124
124
else :
125
125
# `aws ecr-public get-login-password` and `helm registry login` not required as ecr public is not available in current region
126
126
# see https://helm.sh/docs/helm/helm_registry_login/
127
- cmnd = [f"helm pull { repository } --version { version } --untar" ]
127
+ cmnd = [f"helm pull { repository } --version { version } --untar" ]
128
128
else :
129
129
logger .error ("OCI repository format not recognized, falling back to helm pull" )
130
130
cmnd = [f"helm pull { repository } --version { version } --untar" ]
@@ -144,7 +144,7 @@ def get_chart_from_oci(tmpdir, repository = None, version = None):
144
144
output = subprocess .check_output (cmnd , stderr = subprocess .STDOUT , cwd = tmpdir , shell = True )
145
145
logger .info (output )
146
146
147
- # effectively returns "$tmpDir/$lastPartOfOCIUrl", because this is how helm pull saves OCI artifact.
147
+ # effectively returns "$tmpDir/$lastPartOfOCIUrl", because this is how helm pull saves OCI artifact.
148
148
# Eg. if we have oci://9999999999.dkr.ecr.us-east-1.amazonaws.com/foo/bar/pet-service repository, helm saves artifact under $tmpDir/pet-service
149
149
return os .path .join (tmpdir , repository .rpartition ('/' )[- 1 ])
150
150
except subprocess .CalledProcessError as exc :
0 commit comments