Taragolis commented on code in PR #29165:
URL: https://github.com/apache/airflow/pull/29165#discussion_r1086995734


##########
tests/system/providers/amazon/aws/example_sagemaker.py:
##########
@@ -161,8 +161,12 @@ def _build_and_upload_docker_image(preprocess_script, 
repository_uri):
 
         docker_build_and_push_commands = f"""
             cp /root/.aws/credentials /tmp/credentials &&
+            # login to public ecr repo containing amazonlinux image
+            docker login --username {username} --password {password} 
public.ecr.aws

Review Comment:
   Just a question do we actually need to login to public ECR? Or it is also 
has some limitation?
   
   ```console
   
   ❯ docker pull public.ecr.aws/amazonlinux/amazonlinux:latest
   latest: Pulling from amazonlinux/amazonlinux
   1b843b796f14: Pull complete 
   Digest: 
sha256:6fef13bccd69e4e70a257ba03c6476e8c8007510478d574f69ce9f80751ee9be
   Status: Downloaded newer image for 
public.ecr.aws/amazonlinux/amazonlinux:latest
   public.ecr.aws/amazonlinux/amazonlinux:latest
   ```
   



##########
tests/system/providers/amazon/aws/example_sagemaker.py:
##########
@@ -161,8 +161,12 @@ def _build_and_upload_docker_image(preprocess_script, 
repository_uri):
 
         docker_build_and_push_commands = f"""
             cp /root/.aws/credentials /tmp/credentials &&
+            # login to public ecr repo containing amazonlinux image
+            docker login --username {username} --password {password} 
public.ecr.aws
             docker build --platform=linux/amd64 -f {dockerfile.name} -t 
{repository_uri} /tmp &&
             rm /tmp/credentials &&
+
+            # login again, this time to the private repo we created to hold 
that specific image
             aws ecr get-login-password --region {ecr_region} |
             docker login --username {username} --password {password} 
{repository_uri} &&
             docker push {repository_uri}

Review Comment:
   BTW, might be useful as follow up. About month ago I added for further 
integration with docker EcrHook (Private)
   
   
https://github.com/apache/airflow/blob/bfbe2cb6fc39ccc24a13befa28e63beccbbf37b0/airflow/providers/amazon/aws/hooks/ecr.py#L67-L78
   
   Potentially you could obtain credentials as
   
   ```python
   creds = EcrHook(aws_conn_id=None, 
region_name=ecr_region).get_temporary_credentials()[0]
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to