-
Notifications
You must be signed in to change notification settings - Fork 770
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
Conversation
could you check it? @surajssd |
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'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 |
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.
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.
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.
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") |
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.
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.
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.
added ec3aa3d
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.
But there is one think that this PR should include, and that is test for it.
Yes. I will add follow-up commit |
@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 |
oh okay |
@ngtuna I tried pulling and building it and it LGTM |
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
merging |
fix #196 #173