From 69e863e715a65e19da60fe7ccff3f96cfc705851 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 13 Nov 2026 11:42:24 +0100 Subject: [PATCH] Fixed docs job name for series branches Docs Jenkins jobs are named after docs branches (e.g. 3.27), but the bot used the PR base branch (e.g. 3.27.x), triggering a non-existent job and getting HTTP 404. This happened when a PR on a series branch was linked to a documentation PR, or the trigger comment asked for docs. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lars Erik Wik --- tests/test_bot.py | 23 +++++++++++++++++++++++ tom/jenkins.py | 8 +++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/test_bot.py b/tests/test_bot.py index 9c1bb80..41ab20d 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -247,6 +247,29 @@ def test_slow_docs_build(): ) +def test_slow_docs_build_series_branch(): + github_requests, jenkins_requests = _trigger_build( + repo="core", + prs={"documentation": 42, "core": 43}, + comment="@cf-bottom build yeah?", + base_branch="3.27.x", + ) + # Docs jobs drop the .x suffix, BASE_BRANCH keeps it + jenkins_requests.post.assert_called_once_with( + "https://ci.cfengine.com/job/build-and-deploy-docs-3.27/buildWithParameters/api/json", + data={ + "CORE_REV": "43", + "DOCS_REV": "42", + "BASE_BRANCH": "3.27.x", + "BUILD_DESC": "Test PR Title @test-trusted-author (core#43 documentation#42 3.27.x)", + "DOCS_BRANCH": "pr", + "CONFIGURATIONS_FILTER": "", + }, + headers={"Jenkins-Crumb": "test-jenkins-crumb"}, + auth=ANY, + ) + + from unittest.mock import MagicMock, patch, ANY from tom.bot import Bot from tom.jenkins import Jenkins diff --git a/tom/jenkins.py b/tom/jenkins.py index ddd8847..faf43ac 100644 --- a/tom/jenkins.py +++ b/tom/jenkins.py @@ -64,15 +64,17 @@ def trigger( if repo in ["core", "enterprise", "nova", "masterfiles"] ) job = "pr-pipeline" + # Docs jobs are named after docs branches, e.g. 3.27 (not 3.27.x) + docs_branch = branch[:-2] if branch.endswith(".x") else branch if docs: if need_slow_build: - job = "build-and-deploy-docs-{}".format(branch) + job = "build-and-deploy-docs-{}".format(docs_branch) no_tests = True # but allow for override if specified else: - job = "fast-build-and-deploy-docs-{}".format(branch) + job = "fast-build-and-deploy-docs-{}".format(docs_branch) else: if "documentation" in prs.keys(): - job = "build-and-deploy-docs-{}".format(branch) + job = "build-and-deploy-docs-{}".format(docs_branch) no_tests = False # clear configurations filter out so all default packages are generated and tested params["CONFIGURATIONS_FILTER"] = ""