From 38dfd35b0fb5df58d92bd4940ae7302e01e93e2f Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Sun, 10 Nov 2024 13:00:53 +0000 Subject: [PATCH 1/4] [GHA] Use pip and venv to install buildbot for lit tests Installing a specific version of buildbot is more robust to future changes vs using whatever is packaged for Debian. --- .github/workflows/lit-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lit-tests.yml b/.github/workflows/lit-tests.yml index 0b55407a7..6af0fa417 100644 --- a/.github/workflows/lit-tests.yml +++ b/.github/workflows/lit-tests.yml @@ -15,8 +15,12 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y llvm-18-tools buildbot + sudo apt-get install -y llvm-18-tools sudo ln -s /usr/lib/llvm-18/build/utils/lit/lit.py /usr/bin/lit sudo ln -s /usr/bin/FileCheck-18 /usr/bin/FileCheck + python3 -m venv venv + source venv/bin/activate + pip install buildbot==3.11.7 + echo "PATH=$PATH" >> "$GITHUB_ENV" - name: Run lit tests run: /usr/lib/llvm-18/build/utils/lit/lit.py -v --xfail jenkins/test_build.py test From 9894c829d361e01346cd3aa3f407572289be897c Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Sun, 10 Nov 2024 09:56:38 +0000 Subject: [PATCH 2/4] Rename BUILDMASTER_TEST to BUILDBOT_TEST BUILDBOT_TEST is sufficiently descriptive (after all, 'buildbot' is the package name and the name of the binary invoked to create a buildmaster) and it's possible upstream may later remove the buildmaster terminology or alternatively we might move away from it downstream. As such, it seems prudent to use a name that would be unaffected. --- buildbot/osuosl/master/master.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildbot/osuosl/master/master.cfg b/buildbot/osuosl/master/master.cfg index 3552d1c79..9f2167695 100644 --- a/buildbot/osuosl/master/master.cfg +++ b/buildbot/osuosl/master/master.cfg @@ -26,10 +26,10 @@ c['buildbotNetUsageData'] = None import config reload(config) -# Detect if the BUILDMASTER_TEST environment variable is set and non-zero. -# This will be used to enable a local testing mode. -buildmaster_test = os.environ.get('BUILDMASTER_TEST') -test_mode = bool(buildmaster_test) and buildmaster_test != '0' +# Detect if the BUILDBOT_TEST environment variable is set and non-zero. This +# will be used to enable a local testing mode. +buildbot_test = os.environ.get('BUILDBOT_TEST') +test_mode = bool(buildbot_test) and buildbot_test != '0' config.options['Internal'] = {} config.options['Internal']['test_mode'] = str(test_mode) From 79b4f96a355166d166a0972cf6b362e5609213e6 Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Tue, 5 Nov 2024 11:57:22 +0000 Subject: [PATCH 3/4] Avoid UnifiedTreeBuilder producing step names over 50 characters in length Upstream buildbot releases error if a step name has over 50 characters long . UnifiedTreeBuilder can produce quite long step names that violate this, meaning it's difficult to spin up a local test environment (as in ) 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. --- zorg/buildbot/builders/UnifiedTreeBuilder.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/zorg/buildbot/builders/UnifiedTreeBuilder.py b/zorg/buildbot/builders/UnifiedTreeBuilder.py index 5d1f394d5..ace899bc4 100644 --- a/zorg/buildbot/builders/UnifiedTreeBuilder.py +++ b/zorg/buildbot/builders/UnifiedTreeBuilder.py @@ -204,8 +204,15 @@ def addNinjaSteps( step_name = "build-{}unified-tree".format(step_name) step_description.extend(["unified", "tree"]) + # Helper to for use truncating step names to 50 chars, needed due to + # . + def trunc50(name): + if len(name) > 50: + return name[:47] + "..." + return name + # Build the unified tree. - f.addStep(NinjaCommand(name=step_name, + f.addStep(NinjaCommand(name=trunc50(step_name), haltOnFailure=True, targets=targets, description=step_description, @@ -223,7 +230,7 @@ def addNinjaSteps( check_env = env or {} for check in checks: - f.addStep(LitTestCommand(name="test-%s-%s" % (step_name, check), + f.addStep(LitTestCommand(name=trunc50("test-%s-%s" % (step_name, check)), command=['ninja', check], description=[ "Test", "just", "built", "components", "for", @@ -237,7 +244,7 @@ def addNinjaSteps( # Install just built components if install_dir: # TODO: Run this step only if none of the prevous failed. - f.addStep(NinjaCommand(name="install-%sall" % step_name, + f.addStep(NinjaCommand(name=trunc50("install-%sall" % step_name), targets=["install"], description=["Install", "just", "built", "components"], env=env or {}, From 64ddf0033c2b9a8b07993a251f8e9581e64eae85 Mon Sep 17 00:00:00 2001 From: Alex Bradbury Date: Sun, 10 Nov 2024 14:36:47 +0000 Subject: [PATCH 4/4] [GHA] Run buildbot checkconfig in GitHub Actions This provides a stronger check that the buildbot configuration is correct than just running our minimal lit tests. --- .github/workflows/{lit-tests.yml => litmus-tests.yml} | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) rename .github/workflows/{lit-tests.yml => litmus-tests.yml} (75%) diff --git a/.github/workflows/lit-tests.yml b/.github/workflows/litmus-tests.yml similarity index 75% rename from .github/workflows/lit-tests.yml rename to .github/workflows/litmus-tests.yml index 6af0fa417..70f31969c 100644 --- a/.github/workflows/lit-tests.yml +++ b/.github/workflows/litmus-tests.yml @@ -7,7 +7,7 @@ permissions: jobs: check_zorg: - name: llvm-zorg lit tests + name: llvm-zorg litmus tests if: github.repository_owner == 'llvm' runs-on: ubuntu-24.04 steps: @@ -20,7 +20,11 @@ jobs: sudo ln -s /usr/bin/FileCheck-18 /usr/bin/FileCheck python3 -m venv venv source venv/bin/activate - pip install buildbot==3.11.7 + pip install buildbot{,-worker}==3.11.7 urllib3 echo "PATH=$PATH" >> "$GITHUB_ENV" - name: Run lit tests run: /usr/lib/llvm-18/build/utils/lit/lit.py -v --xfail jenkins/test_build.py test + - name: Run buildbot checkconfig + run: | + cd buildbot/osuosl/master + BUILDBOT_TEST=1 buildbot checkconfig