Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Update docker/cli with upstream changes #244

Merged
merged 1 commit into from
Jul 2, 2018

Conversation

vdemeester
Copy link
Contributor

@vdemeester vdemeester commented Jun 25, 2018

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.

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]

@codecov
Copy link

codecov bot commented Jun 25, 2018

Codecov Report

Merging #244 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33a86eb...89348a1. Read the comment docs.

Copy link
Member

@mat007 mat007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits…

delimiter, delimiter, substitution, substitution,
)

var pattern = regexp.MustCompile(patternString)
Copy link
Member

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>))")
)

?

}
}
services = append(services, service)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty line

value, found := mapping(substitution)
if !found {
return "", true, &composetemplate.InvalidTemplateError{
Template: fmt.Sprintf("required variable %s is missing a value", substitution),
Copy link
Member

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",

Gopkg.toml Outdated
@@ -1,25 +1,3 @@

# Gopkg.toml example
#
Copy link
Contributor

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 😅

"testing"
)

func TestRender(t *testing.T) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

case e == "", e == "0", e == "false":
return false
case strings.HasPrefix(e, "!"):
return isEnabled(e[1:])
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

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) {
Copy link
Contributor

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 😅

@vdemeester vdemeester force-pushed the rewrite-cli-integration branch 6 times, most recently from 647690a to 17036b6 Compare June 29, 2018 12:39
@@ -30,14 +29,9 @@ required = ["github.com/wadey/gocovmerge"]
name = "gopkg.in/yaml.v2"
version = "2.2.1"

[[override]]
[[constraint]]
Copy link
Contributor Author

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 😛

Namespace: opts.deployNamespace,
Config: opts.deployKubeConfig,
return stack.RunDeploy(dockerCli, flags, rendered, deployOrchestrator, options.Deploy{
Composefiles: []string{"-"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

Copy link
Contributor

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?

Copy link
Contributor Author

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: {}
Copy link
Contributor

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: {}
Copy link
Contributor

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: {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

@@ -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{
Copy link
Contributor

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 😄

@vdemeester vdemeester force-pushed the rewrite-cli-integration branch 3 times, most recently from 7d4a901 to 6de9091 Compare July 2, 2018 12:53
Name: internal.AppNameFromDir(appname),
Namespace: "default", // FIXME
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty line

func objectMeta(appname string) metav1.ObjectMeta {
return metav1.ObjectMeta{
Name: internal.AppNameFromDir(appname),
Namespace: "default", // FIXME
Copy link
Contributor

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.

@vdemeester vdemeester force-pushed the rewrite-cli-integration branch 2 times, most recently from 7b1a982 to de108fd Compare July 2, 2018 13:12
Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐒

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]>
@silvin-lubecki silvin-lubecki merged commit a558ab7 into docker:master Jul 2, 2018
@vdemeester vdemeester deleted the rewrite-cli-integration branch July 2, 2018 13:47
@silvin-lubecki
Copy link
Contributor

🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants