Skip to content

Commit 94246f3

Browse files
gloursndeloof
authored andcommitted
pass QuietOption when starting dependencies from run command
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 9630cc5 commit 94246f3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

cmd/compose/run.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
231231
}
232232
buildForDeps = &bo
233233
}
234-
return startDependencies(ctx, backend, *project, buildForDeps, options.Service, options.ignoreOrphans)
234+
return startDependencies(ctx, backend, *project, buildForDeps, options)
235235
}, dockerCli.Err())
236236
if err != nil {
237237
return err
@@ -298,22 +298,23 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
298298
return err
299299
}
300300

301-
func startDependencies(ctx context.Context, backend api.Service, project types.Project, buildOpts *api.BuildOptions, requestedServiceName string, ignoreOrphans bool) error {
301+
func startDependencies(ctx context.Context, backend api.Service, project types.Project, buildOpts *api.BuildOptions, options runOptions) error {
302302
dependencies := types.Services{}
303303
var requestedService types.ServiceConfig
304304
for name, service := range project.Services {
305-
if name != requestedServiceName {
305+
if name != options.Service {
306306
dependencies[name] = service
307307
} else {
308308
requestedService = service
309309
}
310310
}
311311

312312
project.Services = dependencies
313-
project.DisabledServices[requestedServiceName] = requestedService
313+
project.DisabledServices[options.Service] = requestedService
314314
err := backend.Create(ctx, &project, api.CreateOptions{
315315
Build: buildOpts,
316-
IgnoreOrphans: ignoreOrphans,
316+
IgnoreOrphans: options.ignoreOrphans,
317+
QuietPull: options.quietPull,
317318
})
318319
if err != nil {
319320
return err

pkg/e2e/compose_run_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,13 @@ func TestLocalComposeRun(t *testing.T) {
160160

161161
c.RunDockerComposeCmd(t, "-f", "./fixtures/dependencies/deps-not-required.yaml", "down", "--remove-orphans")
162162
})
163+
164+
t.Run("--quiet-pull", func(t *testing.T) {
165+
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/compose.yaml", "down", "--rmi", "all")
166+
res.Assert(t, icmd.Success)
167+
168+
res = c.RunDockerComposeCmd(t, "-f", "./fixtures/run-test/compose.yaml", "run", "--quiet-pull", "back")
169+
assert.Assert(t, !strings.Contains(res.Combined(), "Pull complete"), res.Combined())
170+
assert.Assert(t, strings.Contains(res.Combined(), "Pulled"), res.Combined())
171+
})
163172
}

0 commit comments

Comments
 (0)