-
Notifications
You must be signed in to change notification settings - Fork 177
Update docker/cli
with upstream changes
#244
Update docker/cli
with upstream changes
#244
Conversation
Codecov Report
@@ Coverage Diff @@
## master #244 +/- ##
=======================================
Coverage 49.32% 49.32%
=======================================
Files 40 40
Lines 2966 2966
=======================================
Hits 1463 1463
Misses 1295 1295
Partials 208 208 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits…
internal/renderer/render.go
Outdated
delimiter, delimiter, substitution, substitution, | ||
) | ||
|
||
var pattern = regexp.MustCompile(patternString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
var (
delimiter = "\\$"
substitution = "[_a-z][._a-z0-9]*(?::?[-?][^}]*)?"
pattern = regexp.MustCompile(delimiter + "(?i:(?P<escaped>" + delimiter + ")|(?P<named>" + substitution + ")|{(?P<braced>" + substitution + ")}|(?P<invalid>))")
)
?
internal/renderer/render.go
Outdated
} | ||
} | ||
services = append(services, service) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: empty line
internal/renderer/render.go
Outdated
value, found := mapping(substitution) | ||
if !found { | ||
return "", true, &composetemplate.InvalidTemplateError{ | ||
Template: fmt.Sprintf("required variable %s is missing a value", substitution), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
Template: "required variable " + substitution + " is missing a value",
c391c36
to
9a5b7ad
Compare
Gopkg.toml
Outdated
@@ -1,25 +1,3 @@ | |||
|
|||
# Gopkg.toml example | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should keep this part, I always need it when I update the vendoring 😅
cmd/docker-app/render_test.go
Outdated
"testing" | ||
) | ||
|
||
func TestRender(t *testing.T) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
internal/renderer/render.go
Outdated
case e == "", e == "0", e == "false": | ||
return false | ||
case strings.HasPrefix(e, "!"): | ||
return isEnabled(e[1:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should inverse the result no?
e = strings.ToLower(e) | ||
switch { | ||
case e == "", e == "0", e == "false": | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the case e == ""
, it means if someone uses x-enabled
with empty value, it will be disabled:
node:
x-enabled:
-> disabled
I think we should error out here. Enabling/Disabling a node should be explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linking to #261
return value, true, nil | ||
} | ||
|
||
func processEnabled(config *composetypes.Config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way I don't see any unit test on this "x-enabled" feature 😅
647690a
to
17036b6
Compare
@@ -30,14 +29,9 @@ required = ["github.com/wadey/gocovmerge"] | |||
name = "gopkg.in/yaml.v2" | |||
version = "2.2.1" | |||
|
|||
[[override]] | |||
[[constraint]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it's now depending on docker/cli
master 😛
17036b6
to
7e0415a
Compare
7e0415a
to
afa27ab
Compare
cmd/docker-app/deploy.go
Outdated
Namespace: opts.deployNamespace, | ||
Config: opts.deployKubeConfig, | ||
return stack.RunDeploy(dockerCli, flags, rendered, deployOrchestrator, options.Deploy{ | ||
Composefiles: []string{"-"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a // FIXME
or // TODO
so we can try to fix it in a follow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -6,3 +6,7 @@ services: | |||
- -c | |||
- cat bar bam | |||
image: alpine:latest | |||
networks: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
@@ -10,3 +10,7 @@ services: | |||
image: alpine:latest | |||
other: | |||
image: nginx | |||
networks: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
@@ -10,3 +10,7 @@ services: | |||
image: alpine:latest | |||
other: | |||
image: nginx | |||
networks: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
internal/renderer/helm.go
Outdated
@@ -273,34 +274,30 @@ func makeStack(appname string, targetDir string, data []byte, stackVersion strin | |||
} | |||
os.Mkdir(filepath.Join(targetDir, "templates"), 0755) | |||
var stack interface{} | |||
typeMeta := metav1.TypeMeta{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Seams to be replicated in helmRender
, it should be factorized 😄
7d4a901
to
6de9091
Compare
internal/renderer/helm.go
Outdated
Name: internal.AppNameFromDir(appname), | ||
Namespace: "default", // FIXME | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: empty line
internal/renderer/helm.go
Outdated
func objectMeta(appname string) metav1.ObjectMeta { | ||
return metav1.ObjectMeta{ | ||
Name: internal.AppNameFromDir(appname), | ||
Namespace: "default", // FIXME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be removed, as the "default" namespace is unlikely to be the user's default namespace.
7b1a982
to
de108fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐒
de108fd
to
90bc232
Compare
This is still depending on a fork, but with way less differents commits (several changes have been already upstreamed) and with an up-to-date `docker/cli`. One big change to notice is the `enabled` becomes `x-enabled` (using *extras* field of the composefile format), and thus does not require any change to the composefile struct. Signed-off-by: Vincent Demeester <[email protected]>
90bc232
to
89348a1
Compare
🎉 |
This is still depending on a fork, but with way less differents
commits (several changes have been already upstreamed) and with an
up-to-date
docker/cli
.One big change to notice is the
enabled
becomesx-enabled
(using extras field of the composefile format), and thusdoes not require any change to the composefile struct.
Depends on docker/cli#1128
Includes docker/cli#1126 and docker/cli#1123
The only non-upstream(ed) commit yet is vdemeester/docker-cli@13760a1
Signed-off-by: Vincent Demeester [email protected]