-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
restore setEnvWithDotEnv #11974
restore setEnvWithDotEnv #11974
Conversation
258b86e
to
68d5d03
Compare
Signed-off-by: Nicolas De Loof <[email protected]>
// isOrphaned is a predicate to select containers without a matching service definition in compose project | ||
func isOrphaned(project *types.Project) containerPredicate { | ||
services := append(project.ServiceNames(), project.DisabledServiceNames()...) | ||
return func(c moby.Container) bool { | ||
// One-off container | ||
v, ok := c.Labels[api.OneoffLabel] |
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.
question: what is the oneOffLabel?
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 used to distinguish containers created by docker compose run
vs actual services created by up
@@ -37,7 +37,7 @@ func TestLocalComposeRun(t *testing.T) { | |||
"Hello one more time") | |||
lines = Lines(res.Stdout()) | |||
assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout()) | |||
assert.Assert(t, !strings.Contains(res.Combined(), "orphan")) | |||
assert.Assert(t, strings.Contains(res.Combined(), "orphan")) |
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.
question: was this a bug before your chnages? :o
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.
more or less. We only considered "orphans" for service container not declared in current compose model. This PR also consider stopped run
containers as orphaned
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
What I did
restore
setEnvWithDotEnv
to load .env into os.Env so the many places we rely on os.LookupEnv aren't borkenthis also restore support for configuring buildx using env var set in .env
includes e2e test + a tiny fix to include (stopped) one-off containers as "orphans"
Related issue
closes #11967
(not mandatory) A picture of a cute animal, if possible in relation to what you did