Skip to content

Commit

Permalink
Merge pull request #1697 from nkubala/default-repo-fix
Browse files Browse the repository at this point in the history
Fix default-repo handling for images with non-alphabetic characters
  • Loading branch information
dgageot authored Feb 28, 2019
2 parents 7792e90 + 64583c9 commit 60173f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/skaffold/util/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const maxLength = 255

const gcr = "gcr.io"
const escapeChars = "[/._:@]"
const prefixRegexStr = "gcr.io/[a-zA-Z]+/"
const prefixRegexStr = "gcr.io/[a-zA-Z0-9-_]+/"

var escapeRegex = regexp.MustCompile(escapeChars)
var prefixRegex = regexp.MustCompile(prefixRegexStr)
Expand Down
6 changes: 6 additions & 0 deletions pkg/skaffold/util/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ func TestImageReplaceDefaultRepo(t *testing.T) {
defaultRepo: "aws_account_id.dkr.ecr.region.amazonaws.com",
expectedImage: "aws_account_id.dkr.ecr.region.amazonaws.com/gcr_io_herewehaveanincrediblylongregistryname_herewealsohaveanabnormallylongimagename_doubtyouveseenanimagethislong_butyouneverknowdoyouimeanpeopledosomecrazystuffoutthere_goodluckpushingthistoanyregistrymyfrien",
},
{
name: "normal GCR concatenation with numbers and other characters",
image: "gcr.io/k8s-skaffold/skaffold-example",
defaultRepo: "gcr.io/k8s-skaffold",
expectedImage: "gcr.io/k8s-skaffold/skaffold-example",
},
}

for _, test := range tests {
Expand Down

0 comments on commit 60173f6

Please sign in to comment.