Skip to content

Commit

Permalink
fix login issues
Browse files Browse the repository at this point in the history
  • Loading branch information
EC2 Default User committed Aug 16, 2022
1 parent a07a20d commit 046f545
Showing 1 changed file with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"REGION=$(aws configure get region)\n",
"account=$(aws sts get-caller-identity --query Account --output text)\n",
"docker login --username AWS --password $(aws ecr get-login-password --region us-west-2) 763104351884.dkr.ecr.us-west-2.amazonaws.com\n",
"aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${account}.dkr.ecr.${REGION}.amazonaws.com"
"!$(aws ecr get-login --region $region --registry-ids $account_id --no-include-email)"
]
},
{
Expand Down Expand Up @@ -242,21 +242,10 @@
"ecr_image = '{}.dkr.ecr.{}.amazonaws.com/{}:latest'.format(account[0], region, algorithm_name)\n",
"print('ecr_image: {}'.format(ecr_image))\n",
"\n",
"ecr_client = boto3.client('ecr')\n",
"try:\n",
" response = ecr_client.describe_repositories(\n",
" repositoryNames=[\n",
" algorithm_name,\n",
" ],\n",
" )\n",
" print(\"Repo exists...\")\n",
"except Exception as e:\n",
" create_repo = ecr_client.create_repository(repositoryName=algorithm_name)\n",
" print(\"Created repo...\")\n",
"\n",
"docker_login_str = !(aws ecr get-login --region {REGION} --no-include-email)\n",
"!{docker_login_str[0]}\n",
" \n",
"repository_query = !(aws ecr describe-repositories --repository-names $algorithm_name)\n",
"if repository_query[0] == '':\n",
" !(aws ecr create-repository --repository-name $algorithm_name)\n",
"\n",
"!docker tag {algorithm_name} {ecr_image}\n",
"!docker push {ecr_image}"
]
Expand Down

0 comments on commit 046f545

Please sign in to comment.