mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
Merge pull request #1010 from masarakki/image-with-hostname
enable to specify image with hostname
This commit is contained in:
commit
64a0658fbd
@ -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]
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user