Drop Jenkins.getBestBuildURL() method
The ability to configure success and failure URL patterns (cf.
'success-pattern' and 'failure-pattern') obsoletes the need to
guess-by-fetching an appropriate link for the build status, which can be
extremely expensive. (Wikimedia's Zuul instance makes three HTTP requests per
invocation -- 'testReport', which 302s to 'testReport/', which 404s, and then
'consoleFull', which often runs to hundreds of kilobytes.)
Also corrects a small typo in README.rst.
Change-Id: Ib222f544c98253152a5e787ec0cdf28fa2d80cf6
Reviewed-on: https://review.openstack.org/28128
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
diff --git a/README.rst b/README.rst
index 183a9a2..b66305e 100644
--- a/README.rst
+++ b/README.rst
@@ -17,4 +17,4 @@
# Do your commits
$ git review
- # Enter your username if promped
+ # Enter your username if prompted
diff --git a/zuul/launcher/jenkins.py b/zuul/launcher/jenkins.py
index 1e58bce..7ac92c3 100644
--- a/zuul/launcher/jenkins.py
+++ b/zuul/launcher/jenkins.py
@@ -23,7 +23,6 @@
import time
import urllib # for extending jenkins lib
import urllib2 # for extending jenkins lib
-import urlparse
from uuid import uuid4
import jenkins
@@ -378,21 +377,6 @@
self.log.error("Build %s has not started but "
"was not found in queue" % build)
- def getBestBuildURL(self, url):
- try:
- test_url = urlparse.urljoin(url, 'testReport')
- self.jenkins.jenkins_open(urllib2.Request(test_url))
- return test_url
- except:
- pass
- try:
- console_url = urlparse.urljoin(url, 'consoleFull')
- self.jenkins.jenkins_open(urllib2.Request(console_url))
- return console_url
- except:
- pass
- return url
-
def setBuildDescription(self, build, description):
if not build.number:
return
@@ -412,8 +396,6 @@
self.log.debug("Found build %s" % build)
del self.builds[uuid]
if url:
- build.base_url = url
- url = self.getBestBuildURL(url)
build.url = url
build.result = status
build.number = number
diff --git a/zuul/model.py b/zuul/model.py
index 0517450..eb8bc26 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -450,7 +450,6 @@
def __init__(self, job, uuid):
self.job = job
self.uuid = uuid
- self.base_url = None
self.url = None
self.number = None
self.result = None
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index f5d1298..3cd1025 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -922,17 +922,13 @@
result = job.failure_message
if job.failure_pattern:
pattern = job.failure_pattern
- url = None
- if build.url:
- if pattern:
- url = pattern.format(change=changeish,
- pipeline=self.pipeline,
- job=job,
- build=build)
- else:
- url = build.url
- if not url:
- url = job.name
+ if pattern:
+ url = pattern.format(change=changeish,
+ pipeline=self.pipeline,
+ job=job,
+ build=build)
+ else:
+ url = build.url or job.name
if not job.voting:
voting = ' (non-voting)'
else:
@@ -960,10 +956,10 @@
change = build.build_set.change
for build in build.build_set.getBuilds():
- if build.base_url:
+ if build.url:
concurrent_builds += """\
<li>
- <a href="{build.base_url}">
+ <a href="{build.url}">
{build.job.name} #{build.number}</a>: {build.result}
</li>
""".format(build=build)
@@ -979,7 +975,7 @@
if other_build:
other_builds += """\
<li>
- Preceded by: <a href="{build.base_url}">
+ Preceded by: <a href="{build.url}">
{build.job.name} #{build.number}</a>
</li>
""".format(build=other_build)
@@ -990,7 +986,7 @@
if other_build:
other_builds += """\
<li>
- Succeeded by: <a href="{build.base_url}">
+ Succeeded by: <a href="{build.url}">
{build.job.name} #{build.number}</a>
</li>
""".format(build=other_build)