docker: Fix crash when performing log in to ECR with an invalid URL.

Closes #4383
This commit is contained in:
Rickard von Essen 2017-01-11 20:21:13 +01:00
parent 377f451a9e
commit 112f5abdae
No known key found for this signature in database
GPG Key ID: E0C0327388876CBA
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error) {
exp := regexp.MustCompile("(?:http://|https://|)([0-9]*)\\.dkr\\.ecr\\.(.*)\\.amazonaws\\.com.*")
splitUrl := exp.FindStringSubmatch(ecrUrl)
if len(splitUrl) != 3 {
return "", "", fmt.Errorf("Failed to parse the ECR URL: %s it should be on the form <account number>.dkr.ecr.<region>.amazonaws.com", ecrUrl)
}
accountId := splitUrl[1]
region := splitUrl[2]