summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-07-15 14:04:10 +0000
committerGerrit Code Review <review@openstack.org>2020-07-15 14:04:10 +0000
commit156861a149938e233d9df5ca20edc766716851ee (patch)
tree87bae9a165cabe4281f4d8e3a34e798b0bdeb432 /jenkins_jobs
parenta21a64ec72a1b32f9508c231f4e8d3597b794656 (diff)
parent67c2decc3afc5ce97537ee8ed21528969ded058d (diff)
downloadpython-jenkins-job-builder-156861a149938e233d9df5ca20edc766716851ee.tar.gz
python-jenkins-job-builder-156861a149938e233d9df5ca20edc766716851ee.tar.xz
python-jenkins-job-builder-156861a149938e233d9df5ca20edc766716851ee.zip
Merge "Implement GitHub PR Comment Build Plugin"
Diffstat (limited to 'jenkins_jobs')
-rw-r--r--jenkins_jobs/modules/project_multibranch.py67
1 files changed, 66 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/project_multibranch.py b/jenkins_jobs/modules/project_multibranch.py
index 1024e41e..4a2923e5 100644
--- a/jenkins_jobs/modules/project_multibranch.py
+++ b/jenkins_jobs/modules/project_multibranch.py
@@ -1254,7 +1254,27 @@ def property_strategies(xml_parent, data):
max-survivability (optional)
Requires the :jenkins-plugins:`Pipeline Multibranch Plugin
<workflow-multibranch>`
-
+ * **trigger-build-on-pr-comment** (str): The comment body to
+ trigger a new build for a PR job when it is received. This
+ is compiled as a case insensitive regular expression, so
+ use ``".*"`` to trigger a build on any comment whatsoever.
+ (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
+ * **trigger-build-on-pr-review** (bool): This property will
+ cause a job for a pull request ``(PR-*)`` to be triggered
+ immediately when a review is made on the PR in GitHub.
+ This has no effect on jobs that are not for pull requests.
+ (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
+ * **trigger-build-on-pr-update** (bool): This property will
+ cause a job for a pull request ``(PR-*)`` to be triggered
+ immediately when the PR title or description is edited in
+ GitHub. This has no effect on jobs that are not for pull
+ requests. (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
* **named-branches** (dict): Named branches get different properties.
Comprised of a list of defaults and a list of property strategy
exceptions for use with specific branches.
@@ -1271,6 +1291,27 @@ def property_strategies(xml_parent, data):
max-survivability (optional)
Requires the :jenkins-plugins:`Pipeline Multibranch Plugin
<workflow-multibranch>`
+ * **trigger-build-on-pr-comment** (str): The comment body to
+ trigger a new build for a PR job when it is received. This
+ is compiled as a case insensitive regular expression, so
+ use ``".*"`` to trigger a build on any comment whatsoever.
+ (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
+ * **trigger-build-on-pr-review** (bool): This property will
+ cause a job for a pull request ``(PR-*)`` to be triggered
+ immediately when a review is made on the PR in GitHub.
+ This has no effect on jobs that are not for pull requests.
+ (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
+ * **trigger-build-on-pr-update** (bool): This property will
+ cause a job for a pull request ``(PR-*)`` to be triggered
+ immediately when the PR title or description is edited in
+ GitHub. This has no effect on jobs that are not for pull
+ requests. (optional)
+ Requires the :jenkins-plugins:`GitHub PR Comment Build Plugin
+ <github-pr-comment-build>`
* **exceptions** (list): A list of branch names and the property
strategies to be used on that branch, instead of any listed
@@ -1436,6 +1477,7 @@ def apply_property_strategies(props_elem, props_list):
basic_property_strategies = "jenkins.branch"
workflow_multibranch = "org.jenkinsci.plugins.workflow.multibranch"
+ pr_comment_build = "com.adobe.jenkins.github__pr__comment__build"
# Valid options for the pipeline branch durability override.
pbdo_map = collections.OrderedDict(
[
@@ -1445,6 +1487,13 @@ def apply_property_strategies(props_elem, props_list):
]
)
+ pcb_bool_opts = collections.OrderedDict(
+ [
+ ("trigger-build-on-pr-review", ".TriggerPRReviewBranchProperty"),
+ ("trigger-build-on-pr-update", ".TriggerPRUpdateBranchProperty"),
+ ]
+ )
+
for dbs_list in props_list:
if dbs_list.get("suppress-scm-triggering", False):
@@ -1465,3 +1514,19 @@ def apply_property_strategies(props_elem, props_list):
{"plugin": "workflow-multibranch"},
)
XML.SubElement(pbdo_elem, "hint").text = pbdo_map.get(pbdo_val)
+
+ tbopc_val = dbs_list.get("trigger-build-on-pr-comment", None)
+ if tbopc_val:
+ tbopc_elem = XML.SubElement(
+ props_elem,
+ "".join([pr_comment_build, ".TriggerPRCommentBranchProperty"]),
+ {"plugin": "github-pr-comment-build"},
+ )
+ XML.SubElement(tbopc_elem, "commentBody").text = tbopc_val
+ for opt in pcb_bool_opts:
+ if dbs_list.get(opt, False):
+ XML.SubElement(
+ props_elem,
+ "".join([pr_comment_build, pcb_bool_opts.get(opt)]),
+ {"plugin": "github-pr-comment-build"},
+ )