From 608377e17c0c61a5d87561fd65d5044c44c988f5 Mon Sep 17 00:00:00 2001 From: masarakki Date: Wed, 13 May 2015 00:37:20 +0900 Subject: [PATCH] enable to specify image with hostname --- shared/build/util.go | 5 ++++- shared/build/util_test.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/build/util.go b/shared/build/util.go index 3829e99e..e4b20670 100644 --- a/shared/build/util.go +++ b/shared/build/util.go @@ -68,7 +68,10 @@ func parseImageName(image string) (owner, name, tag string) { } parts := strings.Split(name, "/") - if len(parts) == 2 { + if len := len(parts); len == 3 { + owner = fmt.Sprintf("%s/%s", parts[0], parts[1]) + name = parts[2] + } else if len == 2 { owner = parts[0] name = parts[1] } diff --git a/shared/build/util_test.go b/shared/build/util_test.go index ae19b154..7d5f8b6d 100644 --- a/shared/build/util_test.go +++ b/shared/build/util_test.go @@ -15,6 +15,8 @@ func TestParseImageName(t *testing.T) { {"johnsmith", "redis", "latest", "johnsmith/redis"}, // image name with no owner specified {"bradrydzewski", "redis", "2.8", "redis:2.8"}, + // image name with hostname + {"docker.example.com/johnsmith", "redis", "latest", "docker.example.com/johnsmith/redis"}, // image name with ownly name specified {"bradrydzewski", "redis2", "latest", "redis2"}, // image name that is a known alias