You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ma...@apache.org on 2021/07/22 00:14:44 UTC

[incubator-mxnet] branch v1.x updated: Add support for awscli v2, use docker credentials already saved from docker_cache.py run. (#20458)

This is an automated email from the ASF dual-hosted git repository.

manuseth pushed a commit to branch v1.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.x by this push:
     new de20a29  Add support for awscli v2, use docker credentials already saved from docker_cache.py run. (#20458)
de20a29 is described below

commit de20a29174553c5f8c2e055a6f3ac40b5e1b2357
Author: Joe Evans <jo...@gmail.com>
AuthorDate: Wed Jul 21 17:12:58 2021 -0700

    Add support for awscli v2, use docker credentials already saved from docker_cache.py run. (#20458)
---
 ci/Jenkinsfile_docker_cache | 2 +-
 ci/docker_cache.py          | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ci/Jenkinsfile_docker_cache b/ci/Jenkinsfile_docker_cache
index 19003c7..c6ec4f4 100644
--- a/ci/Jenkinsfile_docker_cache
+++ b/ci/Jenkinsfile_docker_cache
@@ -38,7 +38,7 @@ core_logic: {
         timeout(time: total_timeout, unit: 'MINUTES') {
           utils.init_git()
           sh "ci/docker_cache.py --docker-registry ${env.DOCKER_ECR_REGISTRY}"
-          sh "cd ci && $(aws ecr get-login --region ${env.DOCKER_ECR_REGION} --no-include-email) && DOCKER_CACHE_REGISTRY=${env.DOCKER_ECR_REGISTRY} docker-compose -f docker/docker-compose.yml build --parallel && DOCKER_CACHE_REGISTRY=${env.DOCKER_ECR_REGISTRY} docker-compose -f docker/docker-compose.yml push"
+          sh "cd ci && DOCKER_CACHE_REGISTRY=${env.DOCKER_ECR_REGISTRY} docker-compose -f docker/docker-compose.yml build --parallel && DOCKER_CACHE_REGISTRY=${env.DOCKER_ECR_REGISTRY} docker-compose -f docker/docker-compose.yml push"
         }
       }
     }
diff --git a/ci/docker_cache.py b/ci/docker_cache.py
index 600a15e..dc24ba4 100755
--- a/ci/docker_cache.py
+++ b/ci/docker_cache.py
@@ -119,7 +119,12 @@ def _ecr_login(registry):
     assert(regionMatch)
     region = regionMatch.group(1)
     logging.info("Logging into ECR region %s using aws-cli..", region)
-    os.system("$(aws ecr get-login --region "+region+" --no-include-email)")
+    # first check version of aws-cli
+    aws_cli_output = subprocess.check_output(["aws","--version"])
+    if aws_cli_output.decode('utf-8').startswith("aws-cli/2"):
+        os.system("aws ecr get-login-password --region "+region+" | docker login --username AWS --password-stdin "+registry)
+    else:
+        os.system("$(aws ecr get-login --region "+region+" --no-include-email)")
     ECR_LOGGED_IN = True
 
 def _upload_image(registry, docker_tag, image_id) -> None: