Skip to content

Commit

Permalink
fix: case where image got port number and not tag
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentDcmps committed Nov 23, 2024
1 parent f7a4ded commit c5cda2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/docker/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,8 @@ func TestParseDockerImage(t *testing.T) {
Repo string
Tag string
}{
{"host:5000/library/hello-world", "host:5000/library/hello-world", "latest"},
{"host:5000/library/hello-world:1.0", "host:5000/library/hello-world", "1.0"},
{"library/hello-world:1.0", "library/hello-world", "1.0"},
{"library/hello-world", "library/hello-world", "latest"},
{"library/hello-world:latest", "library/hello-world", "latest"},
Expand Down
3 changes: 3 additions & 0 deletions drivers/docker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func parseDockerImage(image string) (repo, tag string) {
} else if t := repoTag[idx+1:]; !strings.Contains(t, "/") {
repo = repoTag[:idx]
tag = t
} else if t := repoTag[idx+1:]; strings.Contains(t, "/") {
repo = image
tag = "latest"
}

if tag != "" {
Expand Down

0 comments on commit c5cda2e

Please sign in to comment.