Skip to content

Commit 2479051

Browse files
authored
chore(cicd): update aws-cli ecr get-login (#2052)
The [`get-login`](https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login.html) command we used previously in our buildspec has been deprecated in AWS CLI v2. This replaces it with the new [`get-login-password`](https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html). The new command doesn't automatically print a `docker login` command, so that has been added. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent d7214ac commit 2479051

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

internal/pkg/deploy/cloudformation/stack/testdata/pipeline/bb_template.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ Resources:
111111
Type: LINUX_CONTAINER
112112
ComputeType: BUILD_GENERAL1_SMALL
113113
PrivilegedMode: true
114-
Image: aws/codebuild/amazonlinux2-x86_64-standard:1.0
114+
Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
115+
EnvironmentVariables:
116+
- Name: AWS_ACCOUNT_ID
117+
Value: !Sub '${AWS::AccountId}'
115118
Source:
116119
Type: CODEPIPELINE
117120
BuildSpec: copilot/buildspec.yml

internal/pkg/deploy/cloudformation/stack/testdata/pipeline/cc_template.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ Resources:
106106
Type: LINUX_CONTAINER
107107
ComputeType: BUILD_GENERAL1_SMALL
108108
PrivilegedMode: true
109-
Image: aws/codebuild/amazonlinux2-x86_64-standard:1.0
109+
Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
110+
EnvironmentVariables:
111+
- Name: AWS_ACCOUNT_ID
112+
Value: !Sub '${AWS::AccountId}'
110113
Source:
111114
Type: CODEPIPELINE
112115
BuildSpec: copilot/buildspec.yml

internal/pkg/deploy/cloudformation/stack/testdata/pipeline/gh_template.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ Resources:
111111
Type: LINUX_CONTAINER
112112
ComputeType: BUILD_GENERAL1_SMALL
113113
PrivilegedMode: true
114-
Image: aws/codebuild/amazonlinux2-x86_64-standard:1.0
114+
Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
115+
EnvironmentVariables:
116+
- Name: AWS_ACCOUNT_ID
117+
Value: !Sub '${AWS::AccountId}'
115118
Source:
116119
Type: CODEPIPELINE
117120
BuildSpec: copilot/buildspec.yml

internal/pkg/deploy/cloudformation/stack/testdata/pipeline/ghv1_template.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ Resources:
106106
Type: LINUX_CONTAINER
107107
ComputeType: BUILD_GENERAL1_SMALL
108108
PrivilegedMode: true
109-
Image: aws/codebuild/amazonlinux2-x86_64-standard:1.0
109+
Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
110+
EnvironmentVariables:
111+
- Name: AWS_ACCOUNT_ID
112+
Value: !Sub '${AWS::AccountId}'
110113
Source:
111114
Type: CODEPIPELINE
112115
BuildSpec: copilot/buildspec.yml

templates/cicd/buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ phases:
115115
for env in $envs; do
116116
repo=$(cat $CODEBUILD_SRC_DIR/infrastructure/$workload-$env.params.json | jq '.Parameters.ContainerImage' | sed 's/"//g');
117117
region=$(echo $repo | cut -d'.' -f4);
118-
$(aws ecr get-login --no-include-email --region $region);
118+
$(aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$region.amazonaws.com);
119119
docker tag $image_id $repo;
120120
docker push $repo;
121121
done;

templates/cicd/pipeline_cfn.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ Resources:
115115
Type: LINUX_CONTAINER
116116
ComputeType: BUILD_GENERAL1_SMALL
117117
PrivilegedMode: true
118-
Image: aws/codebuild/amazonlinux2-x86_64-standard:1.0
118+
Image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
119+
EnvironmentVariables:
120+
- Name: AWS_ACCOUNT_ID
121+
Value: !Sub '${AWS::AccountId}'
119122
Source:
120123
Type: CODEPIPELINE
121124
BuildSpec: copilot/buildspec.yml

0 commit comments

Comments
 (0)