File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,8 @@ def get_argparser():
140
140
141
141
argparser .add_argument (
142
142
"--build-memory-limit" ,
143
- help = "Total Memory that can be used by the docker build process" ,
143
+ # Removed argument, but we still want to support printing an error message if this is passed
144
+ help = argparse .SUPPRESS
144
145
)
145
146
146
147
argparser .add_argument (
@@ -434,12 +435,10 @@ def make_r2d(argv=None):
434
435
sys .exit (1 )
435
436
436
437
if args .build_memory_limit :
437
- # if the string only contains numerals we assume it should be an int
438
- # and specifies a size in bytes
439
- if args .build_memory_limit .isnumeric ():
440
- r2d .build_memory_limit = int (args .build_memory_limit )
441
- else :
442
- r2d .build_memory_limit = args .build_memory_limit
438
+ # We no longer support build_memory_limit, it must be set in the builder instance
439
+ print ("--build-memory-limit is no longer supported" , file = sys .stderr )
440
+ print ("Use `docker buildx create` to create a custom builder with appropriate memory limits instead" , file = sys .stderr )
441
+ sys .exit (- 1 )
443
442
444
443
if args .environment and not r2d .run :
445
444
print ("To specify environment variables, you also need to run " "the container" )
Original file line number Diff line number Diff line change @@ -165,13 +165,20 @@ def _default_log_level(self):
165
165
build_memory_limit = ByteSpecification (
166
166
0 ,
167
167
help = """
168
- Total memory that can be used by the docker image building process .
168
+ Unsupported .
169
169
170
- Set to 0 for no limits.
170
+ When using docker, please use `docker buildx create` to create a new buildkit
171
+ builder with appropriate limits instead.
171
172
""" ,
172
173
config = True ,
173
174
)
174
175
176
+ @observe ("build_memory_limit" )
177
+ def build_memory_limit_changed (self , change ):
178
+ print ("Setting build_memory_limit is not supported" , file = sys .stderr )
179
+ print ("Use `docker buildx create` to create a custom builder with appropriate memory limits instead" , file = sys .stderr )
180
+ sys .exit (- 1 )
181
+
175
182
volumes = Dict (
176
183
{},
177
184
help = """
@@ -856,6 +863,7 @@ def build(self):
856
863
for l in picked_buildpack .build (
857
864
docker_client ,
858
865
self .output_image_spec ,
866
+ # This is deprecated, but passing it anyway to not break backwards compatibility
859
867
self .build_memory_limit ,
860
868
build_args ,
861
869
self .cache_from ,
Original file line number Diff line number Diff line change @@ -50,11 +50,8 @@ def test_mem_limit():
50
50
"""
51
51
Test various ways of passing --build-memory-limit
52
52
"""
53
- r2d = make_r2d (["--build-memory-limit" , "1024" , "." ])
54
- assert int (r2d .build_memory_limit ) == 1024
55
-
56
- r2d = make_r2d (["--build-memory-limit" , "3K" , "." ])
57
- assert int (r2d .build_memory_limit ) == 1024 * 3
53
+ with pytest .raises (SystemExit ):
54
+ r2d = make_r2d (["--build-memory-limit" , "1024" , "." ])
58
55
59
56
60
57
def test_run_required ():
You can’t perform that action at this time.
0 commit comments