Poll for changes every 15 minutes on repository without Github hook
This way the tests should be up to date instead of comparing with
out of date build when doing a global test.
Change-Id: I39e5dfcf781586db584916202200dce816ffaade
diff --git a/docs/owner.md b/docs/owner.md
index 1908d9e..c809851 100644
--- a/docs/owner.md
+++ b/docs/owner.md
@@ -30,6 +30,9 @@
it is no longer needed since the configuration can be changed using a
file in the repository (see next section).
* `enable_trigger` enable postsubmit test (enabled by default).
+* `poll` use polling to trigger post-submit test instead of waiting
+ for GitHub API to notify. Set to `True` by default if the
+ organization is not `bazelbuild`.
* `gerrit_project` specifies a project on the
[Bazel Gerrit server](https://bazel-review.googlesource.com) that
mirrors the GitHub project and will be used to trigger presubmit from
diff --git a/jenkins/build_defs/bazel-job.xml.tpl b/jenkins/build_defs/bazel-job.xml.tpl
index 7cd3169..165df19 100644
--- a/jenkins/build_defs/bazel-job.xml.tpl
+++ b/jenkins/build_defs/bazel-job.xml.tpl
@@ -22,11 +22,22 @@
{% endif %}
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers>
+ {% if variables.production == "true" %}
{% if variables.enable_trigger == "true" %}
<com.cloudbees.jenkins.GitHubPushTrigger>
<spec></spec>
</com.cloudbees.jenkins.GitHubPushTrigger>
{% endif %}
+ {% if variables.poll == "true" %}
+ <hudson.triggers.SCMTrigger>
+ <spec>0 * * * *
+15 * * * *
+30 * * * *
+45 * * * *</spec>
+ <ignorePostCommitHooks>false</ignorePostCommitHooks>
+ </hudson.triggers.SCMTrigger>
+ {% endif %}
+ {% endif %}
</triggers>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
diff --git a/jenkins/build_defs/jenkins_job.bzl b/jenkins/build_defs/jenkins_job.bzl
index 0d23b90..e5a1ade 100644
--- a/jenkins/build_defs/jenkins_job.bzl
+++ b/jenkins/build_defs/jenkins_job.bzl
@@ -113,6 +113,7 @@
config="//jenkins/build_defs:default.json",
test_platforms=["linux-x86_64"],
enable_trigger=True,
+ poll=None,
gerrit_project=None,
enabled=True,
pr_enabled=True,
@@ -121,6 +122,8 @@
sauce_enabled=False,
use_upstream_branch=False):
"""Create a generic github job configuration to build against Bazel head."""
+ if poll == None:
+ poll = org != "bazelbuild"
if not project:
project = name
@@ -131,6 +134,7 @@
"NAME": name,
"disabled": str(not enabled).lower(),
"enable_trigger": str(enable_trigger and github_enabled).lower(),
+ "poll": str(poll).lower(),
"github": str(github_enabled),
"GERRIT_PROJECT": str(gerrit_project) if gerrit_project else "",
"RUN_SEQUENTIAL": str(run_sequential).lower(),
diff --git a/jenkins/jobs/BUILD b/jenkins/jobs/BUILD
index 35d18fe..a3ebfed 100644
--- a/jenkins/jobs/BUILD
+++ b/jenkins/jobs/BUILD
@@ -179,14 +179,18 @@
]]
# Jobs from the google org
-[bazel_github_job(
- name = n,
- config = ":configs/%s.json" % n,
+bazel_github_job(
+ name = "re2",
+ config = ":configs/re2.json",
org = "google",
-) for n in [
- "re2",
- "protobuf",
-]]
+)
+
+bazel_github_job(
+ name = "protobuf",
+ config = ":configs/protobuf.json",
+ org = "google",
+ poll = False, # protobuf had added the robots
+)
# End of project list
job_lists(visibility = ["//jenkins:__pkg__"])