Remove push refs to gerrit feature

This is in preparation to move to separate merger process, which
will not have access to the trigger.  Similar functionality can
be obtained using the new replication feature, and docs have been
updated to that effect.

Change-Id: I9397f7eb8466af464c8e7adb02d0a8d3eff04f9f
This commit is contained in:
James E. Blair 2014-01-23 10:55:08 -08:00
parent fa846f368a
commit 01c2e63057
6 changed files with 42 additions and 59 deletions

View File

@ -1,3 +1,10 @@
Since 2.0.0:
* The push_change_refs option which specified that Zuul refs should be
pushed to Gerrit has been removed. Similar functionality may be
obtained using the replication feature. See the Triggers
documentation for details.
Since 1.3.0:
* The Jenkins launcher is replaced with Gearman launcher. An internal

View File

@ -49,32 +49,11 @@ and checking it out. The parameters that provide this information are
described in :ref:`launchers`.
These references need to be made available via a Git repository that
is available to Jenkins. You may accomplish this by either allowing
Zuul to push the references back to Gerrit, in which case you may
simply use the Gerrit Git repository. If you do not have access to
the Gerrit repository, or would prefer Zuul not push its refs there,
you may directly serve the Git repositories that Zuul uses, and
configure Jenkins to use those. Instructions for each of these
alternatives are in the following sections.
Pushing to Gerrit
"""""""""""""""""
If you want to push Zuul refs back to Gerrit, set the following
permissions for your project (or ``All-Projects``) in Gerrit (where
``CI Tools`` is a group of which the user you created above is a
member)::
[access "refs/zuul/*"]
create = group CI Tools
push = +force CI Tools
pushMerge = group CI Tools
forgeAuthor = group CI Tools
[access "refs/for/refs/zuul/*"]
pushMerge = group CI Tools
And set ``push_change_refs`` to ``true`` in the ``zuul`` section of
zuul.conf.
is available to Jenkins. You may accomplish this by either serving
Zuul's git repositories directly, allowing Zuul to push the references
back to Gerrit, or pushing the references to a third location.
Instructions for each of these alternatives are in the following
sections.
Serving Zuul Git Repos
""""""""""""""""""""""
@ -102,6 +81,33 @@ depending on what the state of Zuul's repository is when the clone
happens). They are, however, suitable for automated systems that
respond to Zuul triggers.
Pushing to Gerrit
"""""""""""""""""
If you want to push Zuul refs back to Gerrit, set the following
permissions for your project (or ``All-Projects``) in Gerrit (where
``CI Tools`` is a group of which the user you created above is a
member)::
[access "refs/zuul/*"]
create = group CI Tools
push = +force CI Tools
pushMerge = group CI Tools
forgeAuthor = group CI Tools
[access "refs/for/refs/zuul/*"]
pushMerge = group CI Tools
And set the following in ``zuul.conf``:
[replication]
url1=ssh://user@review.example.com:29418/
Pushing to Another Location
"""""""""""""""""""""""""""
Simply set one or more destination URLs in the ``replication`` section
of zuul.conf as above.
Timer
-----

View File

@ -110,12 +110,6 @@ zuul
Optional: Value to pass to `git config user.name`.
``git_user_name=zuul``
**push_change_refs**
Boolean value (``true`` or ``false``) that determines if Zuul should
push change refs to the git origin server for the git repositories in
git_dir.
``push_change_refs=true``
**report_times**
Boolean value (``true`` or ``false``) that determines if Zuul should
include elapsed times for each job in the textual report.

View File

@ -11,7 +11,6 @@ layout_config=layout.yaml
git_dir=/tmp/zuul-test/git
git_user_email=zuul@example.com
git_user_name=zuul
push_change_refs=true
url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
job_name_in_report=true
zuul_url=http://zuul.example.com/p

View File

@ -147,14 +147,11 @@ class Repo(object):
class Merger(object):
log = logging.getLogger("zuul.Merger")
def __init__(self, trigger, working_root, push_refs, sshkey, email,
username, replicate_urls):
self.trigger = trigger
def __init__(self, working_root, sshkey, email, username, replicate_urls):
self.repos = {}
self.working_root = working_root
if not os.path.exists(working_root):
os.makedirs(working_root)
self.push_refs = push_refs
if sshkey:
self._makeSSHWrapper(sshkey)
self.email = email
@ -307,19 +304,6 @@ class Merger(object):
refspecs = replicate_refspecs.get(i.change.project, [])
refspecs.append('%s:%s' % (ref, ref))
replicate_refspecs[i.change.project] = refspecs
if self.push_refs:
# Push the results upstream to the zuul ref after
# they are created.
try:
repo.push(ref, ref)
complete = self.trigger.waitForRefSha(i.change.project,
ref)
except:
self.log.exception("Unable to push %s" % ref)
return False
if not complete:
self.log.error("Ref %s did not show up in repo" % ref)
return False
project_branches.append((i.change.project, i.change.branch))
self.replicateRefspecs(replicate_refspecs)
return commit

View File

@ -367,11 +367,6 @@ class Scheduler(threading.Thread):
else:
merge_name = None
if self.config.has_option('zuul', 'push_change_refs'):
push_refs = self.config.getboolean('zuul', 'push_change_refs')
else:
push_refs = False
replicate_urls = []
if self.config.has_section('replication'):
for k, v in self.config.items('replication'):
@ -385,10 +380,8 @@ class Scheduler(threading.Thread):
# TODO: The merger should have an upstream repo independent of
# triggers, and then each trigger should provide a fetch
# location.
self.merger = merger.Merger(self.triggers['gerrit'],
merge_root, push_refs,
sshkey, merge_email, merge_name,
replicate_urls)
self.merger = merger.Merger(merge_root, sshkey, merge_email,
merge_name, replicate_urls)
for project in self.layout.projects.values():
url = self.triggers['gerrit'].getGitUrl(project)
self.merger.addProject(project, url)