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"] = ""