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

restore support for --memory #10492

Merged
merged 1 commit into from Apr 25, 2023
Merged

restore support for --memory #10492

merged 1 commit into from Apr 25, 2023

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Apr 24, 2023

What I did

restore support for build --memory on classic builder.
This flag was hidden as initial design only supported buildkit, but as we introduced support for classic builder, there's no reason not so enable use of this flag

$ DOCKER_BUILDKIT=0 docker compose build --memory 6M 
Sending build context to Docker daemon  37.85kB
Step 1/3 : FROM ubuntu
 ---> bab8ce5c00ca
...
Successfully built 9c5ac36ea508
Successfully tagged truc-test:latest

$ DOCKER_BUILDKIT=1 docker compose build --memory 6M 
WARNING --memory is ignored as not supported in buildkit.
[+] Building 0.3s (6/6) FINISHED     

Related issue
closes #10488

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage: 62.50% and project coverage change: -40.35 ⚠️

Comparison is base (7b0ed13) 59.90% compared to head (e33986a) 19.55%.

❗ Current head e33986a differs from pull request most recent head 64f1c8e. Consider uploading reports for the commit 64f1c8e to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##               v2   #10492       +/-   ##
===========================================
- Coverage   59.90%   19.55%   -40.35%     
===========================================
  Files         105      104        -1     
  Lines        9056     9102       +46     
===========================================
- Hits         5425     1780     -3645     
- Misses       3066     7135     +4069     
+ Partials      565      187      -378     
Impacted Files Coverage Δ
cmd/compose/alpha.go 0.00% <0.00%> (-70.38%) ⬇️
cmd/compose/build.go 0.00% <0.00%> (-71.43%) ⬇️
cmd/compose/compose.go 1.35% <0.00%> (-72.64%) ⬇️
pkg/api/api.go 0.00% <ø> (-43.40%) ⬇️
pkg/api/proxy.go 0.00% <0.00%> (-39.68%) ⬇️
pkg/compose/build.go 4.24% <0.00%> (-71.47%) ⬇️
pkg/compose/build_classic.go 0.00% <0.00%> (-51.95%) ⬇️
cmd/compose/viz.go 18.36% <18.36%> (ø)
pkg/compose/viz.go 100.00% <100.00%> (ø)

... and 72 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ndeloof ndeloof requested review from a team, nicksieger, StefanScherer, ulyssessouza, glours, milas and laurazard and removed request for a team April 24, 2023 09:04
@ndeloof ndeloof force-pushed the build_memory branch 3 times, most recently from 98b6a28 to e5c9941 Compare April 24, 2023 12:50
Copy link
Contributor

@milas milas left a comment

Choose a reason for hiding this comment

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

LGTM, just went pedantic on the text as usual 😅

@@ -125,8 +123,7 @@ func buildCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *
cmd.Flags().BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the image")
cmd.Flags().Bool("no-rm", false, "Do not remove intermediate containers after a successful build. DEPRECATED")
cmd.Flags().MarkHidden("no-rm") //nolint:errcheck
cmd.Flags().StringVarP(&opts.memory, "memory", "m", "", "Set memory limit for the build container. Not supported on buildkit yet.")
cmd.Flags().MarkHidden("memory") //nolint:errcheck
cmd.Flags().VarP(&opts.memory, "memory", "m", "Set memory limit for the build container. Not supported on buildkit yet.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmd.Flags().VarP(&opts.memory, "memory", "m", "Set memory limit for the build container. Not supported on buildkit yet.")
cmd.Flags().VarP(&opts.memory, "memory", "m", "Set memory limit for the build container. Not supported by BuildKit.")

@@ -102,6 +102,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
}
return nil
}

if options.Memory != 0 {
fmt.Fprintln(s.stderr(), "WARNING --memory is ignored as not supported in buildkit.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Fprintln(s.stderr(), "WARNING --memory is ignored as not supported in buildkit.")
fmt.Fprintln(s.stderr(), "WARNING: --memory is not supported by BuildKit and will be ignored.")

@ndeloof ndeloof force-pushed the build_memory branch 3 times, most recently from 2b3b704 to e33986a Compare April 25, 2023 13:19
@ndeloof ndeloof enabled auto-merge (rebase) April 25, 2023 13:19
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof merged commit d01ef58 into docker:v2 Apr 25, 2023
22 checks passed
@ndeloof ndeloof deleted the build_memory branch December 20, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compose build --memory
3 participants