Add per-job URL patterns.
Add the option to specify the URL pattern left in Gerrit, per-job. Example: a job that builds documentation and uploads it to a staging site can leave the URL of the staging site iff the job succeeds. Change-Id: I34841e61e9116fd8d4de7ac09d8f9cfe36fe78ec Reviewed-on: https://review.openstack.org/18264 Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Approved: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
f2626eb384
commit
6aea36dd35
|
@ -18,6 +18,8 @@ Zuul has three configuration files:
|
||||||
Examples of each of the three files can be found in the etc/ directory
|
Examples of each of the three files can be found in the etc/ directory
|
||||||
of the source distribution.
|
of the source distribution.
|
||||||
|
|
||||||
|
.. _zuulconf:
|
||||||
|
|
||||||
zuul.conf
|
zuul.conf
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
|
@ -377,6 +379,18 @@ each job as it builds a list from the project specification.
|
||||||
**success-message (optional)**
|
**success-message (optional)**
|
||||||
The message that should be reported to Gerrit if the job fails.
|
The message that should be reported to Gerrit if the job fails.
|
||||||
|
|
||||||
|
**failure-pattern (optional)**
|
||||||
|
The URL that should be reported to Gerrit if the job fails.
|
||||||
|
Defaults to the Jenkins build URL or the url_pattern configured in
|
||||||
|
zuul.conf. May be supplied as a string pattern with substitutions
|
||||||
|
as described in url_pattern in :ref:`zuulconf`.
|
||||||
|
|
||||||
|
**success-pattern (optional)**
|
||||||
|
The URL that should be reported to Gerrit if the job succeeds.
|
||||||
|
Defaults to the Jenkins build URL or the url_pattern configured in
|
||||||
|
zuul.conf. May be supplied as a string pattern with substitutions
|
||||||
|
as described in url_pattern in :ref:`zuulconf`.
|
||||||
|
|
||||||
**hold-following-changes (optional)**
|
**hold-following-changes (optional)**
|
||||||
This is a boolean that indicates that changes that follow this
|
This is a boolean that indicates that changes that follow this
|
||||||
change in a dependent change pipeline should wait until this job
|
change in a dependent change pipeline should wait until this job
|
||||||
|
|
|
@ -314,6 +314,8 @@ class Job(object):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.failure_message = None
|
self.failure_message = None
|
||||||
self.success_message = None
|
self.success_message = None
|
||||||
|
self.failure_pattern = None
|
||||||
|
self.success_pattern = None
|
||||||
self.parameter_function = None
|
self.parameter_function = None
|
||||||
self.hold_following_changes = False
|
self.hold_following_changes = False
|
||||||
self.voting = True
|
self.voting = True
|
||||||
|
@ -329,6 +331,8 @@ class Job(object):
|
||||||
def copy(self, other):
|
def copy(self, other):
|
||||||
self.failure_message = other.failure_message
|
self.failure_message = other.failure_message
|
||||||
self.success_message = other.success_message
|
self.success_message = other.success_message
|
||||||
|
self.failure_pattern = other.failure_pattern
|
||||||
|
self.success_pattern = other.success_pattern
|
||||||
self.parameter_function = other.parameter_function
|
self.parameter_function = other.parameter_function
|
||||||
self.hold_following_changes = other.hold_following_changes
|
self.hold_following_changes = other.hold_following_changes
|
||||||
self.voting = other.voting
|
self.voting = other.voting
|
||||||
|
|
|
@ -114,6 +114,12 @@ class Scheduler(threading.Thread):
|
||||||
m = config_job.get('success-message', None)
|
m = config_job.get('success-message', None)
|
||||||
if m:
|
if m:
|
||||||
job.success_message = m
|
job.success_message = m
|
||||||
|
m = config_job.get('failure-pattern', None)
|
||||||
|
if m:
|
||||||
|
job.failure_pattern = m
|
||||||
|
m = config_job.get('success-pattern', None)
|
||||||
|
if m:
|
||||||
|
job.success_pattern = m
|
||||||
m = config_job.get('hold-following-changes', False)
|
m = config_job.get('hold-following-changes', False)
|
||||||
if m:
|
if m:
|
||||||
job.hold_following_changes = True
|
job.hold_following_changes = True
|
||||||
|
@ -706,16 +712,23 @@ class BasePipelineManager(object):
|
||||||
"rebase your change and upload a new patchset."
|
"rebase your change and upload a new patchset."
|
||||||
else:
|
else:
|
||||||
if self.sched.config.has_option('zuul', 'url_pattern'):
|
if self.sched.config.has_option('zuul', 'url_pattern'):
|
||||||
pattern = self.sched.config.get('zuul', 'url_pattern')
|
url_pattern = self.sched.config.get('zuul', 'url_pattern')
|
||||||
else:
|
else:
|
||||||
pattern = None
|
url_pattern = None
|
||||||
for job in self.pipeline.getJobs(changeish):
|
for job in self.pipeline.getJobs(changeish):
|
||||||
build = changeish.current_build_set.getBuild(job.name)
|
build = changeish.current_build_set.getBuild(job.name)
|
||||||
result = build.result
|
result = build.result
|
||||||
if result == 'SUCCESS' and job.success_message:
|
pattern = url_pattern
|
||||||
result = job.success_message
|
if result == 'SUCCESS':
|
||||||
elif result == 'FAILURE' and job.failure_message:
|
if job.success_message:
|
||||||
result = job.failure_message
|
result = job.success_message
|
||||||
|
if job.success_pattern:
|
||||||
|
pattern = job.success_pattern
|
||||||
|
elif result == 'FAILURE':
|
||||||
|
if job.failure_message:
|
||||||
|
result = job.failure_message
|
||||||
|
if job.failure_pattern:
|
||||||
|
pattern = job.failure_pattern
|
||||||
url = None
|
url = None
|
||||||
if build.url:
|
if build.url:
|
||||||
if pattern:
|
if pattern:
|
||||||
|
|
Loading…
Reference in New Issue