@@ -79,6 +79,10 @@ def group(label, command, instances, platforms, **kwargs):
79
79
"""
80
80
# Use the 1st character of the group name (should be an emoji)
81
81
label1 = label [0 ]
82
+ # if the emoji is in the form ":emoji:", pick the entire slug
83
+ if label .startswith (':' ) and ':' in label [1 :]:
84
+ label1 = label [:label .index (':' , 1 )+ 1 ]
85
+
82
86
steps = []
83
87
commands = command
84
88
if isinstance (command , str ):
@@ -276,7 +280,7 @@ def __init__(self, with_build_step=True, **kwargs):
276
280
if with_build_step :
277
281
build_cmds , self .shared_build = shared_build ()
278
282
self .build_group_per_arch (
279
- "🏗️ Build" , build_cmds , depends_on_build = False , set_key = True
283
+ "🏗️ Build" , build_cmds , depends_on_build = False , set_key = self . shared_build
280
284
)
281
285
else :
282
286
self .shared_build = None
@@ -314,9 +318,25 @@ def _adapt_group(self, group):
314
318
for step in group ["steps" ]:
315
319
step ["command" ] = prepend + step ["command" ]
316
320
if self .shared_build is not None :
317
- step ["depends_on" ] = self .build_key (
318
- get_arch_for_instance (step ["agents" ]["instance" ])
319
- )
321
+ if "depends_on" not in step :
322
+ step ["depends_on" ] = []
323
+ elif isinstance (step ["depends_on" ], str ):
324
+ step ["depends_on" ] = [step ["depends_on" ]]
325
+ elif isinstance (step ["depends_on" ], list ):
326
+ pass
327
+ else :
328
+ raise ValueError (
329
+ f"depends_on should be a string or a list but is { type (step ['depends_on' ])} "
330
+ )
331
+
332
+ step ["depends_on" ].append (self .shared_build )
333
+ step ["depends_on" ] = [
334
+ self .build_key (
335
+ dep , get_arch_for_instance (step ["agents" ]["instance" ])
336
+ )
337
+ for dep in step ["depends_on" ]
338
+ ]
339
+
320
340
return group
321
341
322
342
def build_group (self , * args , ** kwargs ):
@@ -332,17 +352,17 @@ def build_group(self, *args, **kwargs):
332
352
group (* args , ** combined ), depends_on_build = depends_on_build
333
353
)
334
354
335
- def build_key (self , arch ):
355
+ def build_key (self , key , arch ):
336
356
"""Return the Buildkite key for the build step, for the specified arch"""
337
- return self . shared_build .replace ("$(uname -m)" , arch ).replace (".tar.gz" , "" )
357
+ return key .replace ("$(uname -m)" , arch ).replace (".tar.gz" , "" )
338
358
339
359
def build_group_per_arch (self , label , * args , ** kwargs ):
340
360
"""
341
361
Build a group, parametrizing over the architectures only.
342
362
343
363
kwargs consumed by this method and not passed down to `group`:
344
364
- `depends_on_build` (default: `True`): Whether the steps in this group depend on the artifacts from the shared compilation steps
345
- - `set_key`: If True , causes the generated steps to have a "key" field
365
+ - `set_key`: If a string , causes the generated steps to have a "key" field replacing "$(uname -m)" with arch and removing trailing tar.gz
346
366
"""
347
367
depends_on_build = kwargs .pop ("depends_on_build" , True )
348
368
set_key = kwargs .pop ("set_key" , None )
@@ -351,7 +371,7 @@ def build_group_per_arch(self, label, *args, **kwargs):
351
371
if set_key :
352
372
for step in grp ["steps" ]:
353
373
step ["key" ] = self .build_key (
354
- get_arch_for_instance (step ["agents" ]["instance" ])
374
+ set_key , get_arch_for_instance (step ["agents" ]["instance" ])
355
375
)
356
376
return self .add_step (grp , depends_on_build = depends_on_build )
357
377
0 commit comments