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