Skip to content

Commit 2a37a78

Browse files
authored
Prevent UnifiedTreeBuilder producing step names over 50 characters in length (#293)
Upstream buildbot releases error if a step name has over 50 characters long <buildbot/buildbot#3414>. UnifiedTreeBuilder can produce quite long step names that violate this, meaning it's difficult to spin up a local test environment (as in <#289>) without local hacks to workaround this. In this patch, we simply truncate step names at creation time. This means llvm-zorg's buildbot config can be used with an unmodified upstream buildbot package.
1 parent e22dfe0 commit 2a37a78

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

zorg/buildbot/builders/UnifiedTreeBuilder.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,15 @@ def addNinjaSteps(
204204
step_name = "build-{}unified-tree".format(step_name)
205205
step_description.extend(["unified", "tree"])
206206

207+
# Helper to for use truncating step names to 50 chars, needed due to
208+
# <https://github.com/buildbot/buildbot/issues/3414>.
209+
def trunc50(name):
210+
if len(name) > 50:
211+
return name[:47] + "..."
212+
return name
213+
207214
# Build the unified tree.
208-
f.addStep(NinjaCommand(name=step_name,
215+
f.addStep(NinjaCommand(name=trunc50(step_name),
209216
haltOnFailure=True,
210217
targets=targets,
211218
description=step_description,
@@ -223,7 +230,7 @@ def addNinjaSteps(
223230
check_env = env or {}
224231

225232
for check in checks:
226-
f.addStep(LitTestCommand(name="test-%s-%s" % (step_name, check),
233+
f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check)),
227234
command=['ninja', check],
228235
description=[
229236
"Test", "just", "built", "components", "for",
@@ -237,7 +244,7 @@ def addNinjaSteps(
237244
# Install just built components
238245
if install_dir:
239246
# TODO: Run this step only if none of the prevous failed.
240-
f.addStep(NinjaCommand(name="install-%sall" % step_name,
247+
f.addStep(NinjaCommand(name=trunc50("install-%sall" % step_name),
241248
targets=["install"],
242249
description=["Install", "just", "built", "components"],
243250
env=env or {},

0 commit comments

Comments
 (0)