grim/convey

Parents aaf0c394ff02
Children 7d242a198aa8
Fix some issues with docker.ParseImage where an image like convey/workspace
was being parsed to registry: convey, image: workspace. This has been updated
to require a . or a : in the string before the first / or for it to be set to
localhost. This won't catch everything, but it should get the majority of
cases. Fixes #157.
--- a/ChangeLog Sun Jan 14 05:12:00 2018 -0600
+++ b/ChangeLog Sun Jan 14 06:03:40 2018 -0600
@@ -1,4 +1,7 @@
0.12.1dev:
+ * Fixed an issue in docker.ParseImage where something like convey/workspace
+ would in correctly determine the registry to be convey and the image to be
+ workspace.
* Changed the way subcommands are run. Fixed #153
* Added `run` sub-command.
* Deprecated `--graphviz`, use `graphviz` instead.
--- a/docker/util.go Sun Jan 14 05:12:00 2018 -0600
+++ b/docker/util.go Sun Jan 14 06:03:40 2018 -0600
@@ -30,10 +30,13 @@
name := ""
tag := ""
+ // split the image into two pieces on the first /
parts := strings.SplitN(image, "/", 2)
if len(parts) == 2 {
- registry = parts[0]
- image = parts[1]
+ if strings.Contains(parts[0], ".") || strings.Contains(parts[0], ":") || parts[0] == "localhost" {
+ registry = parts[0]
+ image = parts[1]
+ }
}
parts = strings.SplitN(image, ":", 2)
--- a/docker/util_test.go Sun Jan 14 05:12:00 2018 -0600
+++ b/docker/util_test.go Sun Jan 14 06:03:40 2018 -0600
@@ -46,6 +46,21 @@
name: "python",
tag: "3",
}, {
+ input: "convey/workspace",
+ registry: "",
+ name: "convey/workspace",
+ tag: "",
+ }, {
+ input: "localhost/convey/workspace",
+ registry: "localhost",
+ name: "convey/workspace",
+ tag: "",
+ }, {
+ input: "localhost:5000/convey/workspace",
+ registry: "localhost:5000",
+ name: "convey/workspace",
+ tag: "",
+ }, {
input: "registry.docker.io/python:3",
registry: "registry.docker.io",
name: "python",