Fix ecr authorization token issue (#17645)

Signed-off-by: Vincent Ni <kangqini@amazon.com>
This commit is contained in:
Vincent Ni 2022-10-17 20:09:58 -07:00 committed by GitHub
parent b6bdb4b57f
commit 9c0275deb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,9 +127,12 @@ func (a *awsAuthCredential) getAuthorization(url string) (string, string, string
return "", "", "", nil, err
}
regIds := []*string{&id}
var input *awsecrapi.GetAuthorizationTokenInput
if id != "" {
input = &awsecrapi.GetAuthorizationTokenInput{RegistryIds: []*string{&id}}
}
svc := a.awssvc
result, err := svc.GetAuthorizationToken(&awsecrapi.GetAuthorizationTokenInput{RegistryIds: regIds})
result, err := svc.GetAuthorizationToken(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
return "", "", "", nil, fmt.Errorf("%s: %s", aerr.Code(), aerr.Error())