Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support both : and = as compose envvar separators #197

Merged
merged 3 commits into from
Oct 21, 2016

Conversation

ngtuna
Copy link
Contributor

@ngtuna ngtuna commented Oct 10, 2016

fix #196 #173

@ngtuna
Copy link
Contributor Author

ngtuna commented Oct 13, 2016

could you check it? @surajssd

Copy link
Member

@kadel kadel left a comment

Choose a reason for hiding this comment

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

I've added few comments, but those can be addressed is separate PRs.

LGTM

for k, v := range e {
var character string
for _, e := range envars {
//FIXME:(tuna) if envvar string contains both = and :, then = will be first pick up. Consider the case: URL=http://examples.com
Copy link
Member

Choose a reason for hiding this comment

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

One suggestion how to solve this problem. As both : and = are invalid characters for env variable names, we can detect which one is first in string and consider it to be separator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct 👍 . I will update accordingly.

} else if strings.Contains(e, ":") {
character = ":"
} else {
logrus.Errorf("Invalid environment variable format, only : and = separators are supported")
Copy link
Member

Choose a reason for hiding this comment

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

just variable name without : or ; is also valid see: https://docs.docker.com/compose/compose-file/#/environment
This is something that we should also consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added ec3aa3d

Copy link
Member

@kadel kadel left a comment

Choose a reason for hiding this comment

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

But there is one think that this PR should include, and that is test for it.

@ngtuna
Copy link
Contributor Author

ngtuna commented Oct 18, 2016

But there is one think that this PR should include, and that is test for it.

Yes. I will add follow-up commit

@surajssd
Copy link
Member

@ngtuna I have problem building this branch, can you guys tell me what am I missing?

$ git remote show tuna
* remote tuna
  Fetch URL: https://github.com/ngtuna/kompose
  Push  URL: https://github.com/ngtuna/kompose
  HEAD branch: master
  Remote branches:
    clean-code        tracked
    envvar_colon      tracked
    global-flag       tracked
[SNIP]
    userguide         tracked
  Local branches configured for 'git pull':
    envvar_colon    merges with remote envvar_colon
    project-context merges with remote project-context
    update-objects  merges with remote update-objects
  Local refs configured for 'git push':
    envvar_colon    pushes to envvar_colon    (up to date)
    master          pushes to master          (fast-forwardable)
    project-context pushes to project-context (up to date)
    update-objects  pushes to update-objects  (up to date)
$ git fetch tuna
$ git checkout envvar_colon 
Switched to branch 'envvar_colon'
Your branch is up-to-date with 'tuna/envvar_colon'.

$ git pull
Already up-to-date.
$ build-kompose 
+ cd /home/hummer/go/src/github.com/kubernetes-incubator/kompose
+ go build -tags experimental -o kompose ./cli/main/
# github.com/kubernetes-incubator/kompose/pkg/loader/bundle
pkg/loader/bundle/bundle.go:95: cannot use p (type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
# github.com/kubernetes-incubator/kompose/pkg/loader/compose
pkg/loader/compose/compose.go:101: cannot use proto (type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
pkg/loader/compose/compose.go:110: cannot use proto (type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
# github.com/kubernetes-incubator/kompose/pkg/transformer/kubernetes
pkg/transformer/kubernetes/k8sutils.go:248: cannot use service (type "github.com/skippbox/kompose/pkg/kobject".ServiceConfig) as type "github.com/kubernetes-incubator/kompose/pkg/kobject".ServiceConfig in argument to transformer.ConfigAnnotations
pkg/transformer/kubernetes/k8sutils.go:274: cannot use service (type "github.com/skippbox/kompose/pkg/kobject".ServiceConfig) as type "github.com/kubernetes-incubator/kompose/pkg/kobject".ServiceConfig in argument to transformer.ConfigAnnotations
pkg/transformer/kubernetes/kubernetes.go:188: cannot use port.Protocol (type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
pkg/transformer/kubernetes/kubernetes.go:207: cannot use port.Protocol (type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
# github.com/skippbox/kompose/pkg/transformer/kubernetes
../../skippbox/kompose/pkg/transformer/kubernetes/k8sutils.go:248: cannot use service (type "github.com/kubernetes-incubator/kompose/pkg/kobject".ServiceConfig) as type "github.com/skippbox/kompose/pkg/kobject".ServiceConfig in argument to transformer.ConfigAnnotations
../../skippbox/kompose/pkg/transformer/kubernetes/k8sutils.go:274: cannot use service (type "github.com/kubernetes-incubator/kompose/pkg/kobject".ServiceConfig) as type "github.com/skippbox/kompose/pkg/kobject".ServiceConfig in argument to transformer.ConfigAnnotations
../../skippbox/kompose/pkg/transformer/kubernetes/kubernetes.go:188: cannot use port.Protocol (type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value
../../skippbox/kompose/pkg/transformer/kubernetes/kubernetes.go:207: cannot use port.Protocol (type "github.com/kubernetes-incubator/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol) as type "github.com/skippbox/kompose/vendor/k8s.io/kubernetes/pkg/api".Protocol in field value

@kadel
Copy link
Member

kadel commented Oct 19, 2016

@surajssd this is because @ngtuna's branch is not yet rebased to current master. It still uses old import path github.com/skippbox/kompose

@surajssd
Copy link
Member

oh okay

@ngtuna
Copy link
Contributor Author

ngtuna commented Oct 20, 2016

Hey @kadel @surajssd I made rebase and added test. Please take a look.

@surajssd
Copy link
Member

@ngtuna I tried pulling and building it and it LGTM

Copy link
Member

@kadel kadel left a comment

Choose a reason for hiding this comment

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

LGTM

@kadel kadel added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 21, 2016
@ngtuna
Copy link
Contributor Author

ngtuna commented Oct 21, 2016

merging

@ngtuna ngtuna merged commit 019f90c into kubernetes:master Oct 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parsing environment variables with :
3 participants