-
Notifications
You must be signed in to change notification settings - Fork 120
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
introduce ResolveServicesEnvironment and resolve service environment AFTER profiles have been applied #338
introduce ResolveServicesEnvironment and resolve service environment AFTER profiles have been applied #338
Conversation
2d20532
to
dc76fd1
Compare
dc76fd1
to
2f8259f
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.
A couple of type errors from GHA and one potential file leak from me but otherwise LGTM
types/project.go
Outdated
} | ||
|
||
// Do not defer to avoid it inside a loop | ||
file.Close() //nolint:errcheck |
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.
This will leak if we end up returning an error above - perhaps os.ReadFile
instead?
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.
+1, or if we just want to pass file name we should use envFile
variable directly
types/types.go
Outdated
@@ -357,12 +357,12 @@ type ThrottleDevice struct { | |||
// ShellCommand is a string or list of string args. | |||
// | |||
// When marshaled to YAML, nil command fields will be omitted if `omitempty` | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`) | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `”`) |
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.
The fun quotes are back 😂
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.
This is one of my favorite running gags of the moment 😂
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.
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `”`) | |
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`) |
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 few little things to fix before merging
types/project.go
Outdated
} | ||
|
||
// Do not defer to avoid it inside a loop | ||
file.Close() //nolint:errcheck |
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.
+1, or if we just want to pass file name we should use envFile
variable directly
types/types.go
Outdated
@@ -357,12 +357,12 @@ type ThrottleDevice struct { | |||
// ShellCommand is a string or list of string args. | |||
// | |||
// When marshaled to YAML, nil command fields will be omitted if `omitempty` | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`) | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `”`) |
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.
This is one of my favorite running gags of the moment 😂
types/types.go
Outdated
@@ -357,12 +357,12 @@ type ThrottleDevice struct { | |||
// ShellCommand is a string or list of string args. | |||
// | |||
// When marshaled to YAML, nil command fields will be omitted if `omitempty` | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`) | |||
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `”`) |
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.
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `”`) | |
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`) |
types/types.go
Outdated
// will serialize to an empty array (`[]`). | ||
// | ||
// When marshaled to JSON, the `omitempty` struct must NOT be specified. | ||
// If the command field is nil, it will be serialized as `null`. | ||
// Explicitly empty commands (i.e. `[]` or `''`) will serialize to an empty | ||
// Explicitly empty commands (i.e. `[]` or `”`) will serialize to an empty |
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.
// Explicitly empty commands (i.e. `[]` or `”`) will serialize to an empty | |
// Explicitly empty commands (i.e. `[]` or `''`) will serialize to an empty |
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.
this makes me crazy
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.
My LSP has turned to doing the same thing and now I have to fix it before I make my PRs 😭
ebf718b
to
b559569
Compare
…AFTER profiles have been applied Signed-off-by: Nicolas De Loof <[email protected]>
b559569
to
a30b5f7
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
This introduces
WithProfiles
so the loader can directly apply selected profiles, and moves env_file loading logic to a later phase, so we won't try to load for services which have been disabledAlso introduce load option
SkipResolveEnvFiles
to fully bypass this and processenv_files
in a later phasecloses docker/compose#8713