Skip to content

Commit

Permalink
Don't assume anything about the image name on private registries.
Browse files Browse the repository at this point in the history
On the docker hub the format is fixed at user/repo but in a private
registry you can have `my.repo/group/project/image/subimage` fine.

Fixes concourse#81
  • Loading branch information
ashb authored and ggeorgiev committed Jun 8, 2017
1 parent cd7ba69 commit 8747879
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ const officialRegistry = "registry-1.docker.io"
func parseRepository(repository string) (string, string) {
segs := strings.Split(repository, "/")

if len(segs) > 1 && (strings.Contains(segs[0], ":") || strings.Contains(segs[0], ".")) {
// In a private regsitry pretty much anything is valid.
return segs[0], strings.Join(segs[1:], "/")
}
switch len(segs) {
case 3:
return segs[0], segs[1] + "/" + segs[2]
case 2:
if strings.Contains(segs[0], ":") || strings.Contains(segs[0], ".") {
return segs[0], segs[1]
} else {
return officialRegistry, segs[0] + "/" + segs[1]
}
return officialRegistry, segs[0] + "/" + segs[1]
case 1:
return officialRegistry, "library/" + segs[0]
}
Expand Down

0 comments on commit 8747879

Please sign in to comment.