diff options
author | Zuul <zuul@review.openstack.org> | 2017-10-27 21:30:11 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-10-27 21:30:11 +0000 |
commit | 5fe4f4aedf4b824e08df6615e12981c3fc12f350 (patch) | |
tree | c8d9c0b47d972461f2ffcc5fdb961250e4e48cb2 | |
parent | ea84b06d4b19b2575b9429002345c814087c8287 (diff) | |
parent | 6828656bab2ba1ce262800d205b624418ce4d52e (diff) | |
download | zuul-5fe4f4aedf4b824e08df6615e12981c3fc12f350.tar.gz |
Merge "Remove implied run" into feature/zuulv3
-rw-r--r-- | doc/source/user/config.rst | 51 | ||||
-rwxr-xr-x | tests/base.py | 2 | ||||
-rw-r--r-- | zuul/configloader.py | 6 | ||||
-rw-r--r-- | zuul/model.py | 14 |
4 files changed, 32 insertions, 41 deletions
diff --git a/doc/source/user/config.rst b/doc/source/user/config.rst index 80c913673..001993288 100644 --- a/doc/source/user/config.rst +++ b/doc/source/user/config.rst @@ -781,42 +781,55 @@ Here is an example of two job definitions: .. attr:: pre-run - The name of a playbook or list of playbooks without file - extension to run before the main body of a job. The full path - to the playbook in the repo where the job is defined is - expected. + The name of a playbook or list of playbooks to run before the + main body of a job. The full path to the playbook in the repo + where the job is defined is expected. When a job inherits from a parent, the child's pre-run playbooks are run after the parent's. See :ref:`job` for more information. + .. warning:: + + If the path as specified does not exist, Zuul will try + appending the extensions ``.yaml`` and ``.yml``. This + behavior is deprecated and will be removed in the future all + playbook paths should include the file extension. + .. attr:: post-run - The name of a playbook or list of playbooks without file - extension to run after the main body of a job. The full path to - the playbook in the repo where the job is defined is expected. + The name of a playbook or list of playbooks to run after the + main body of a job. The full path to the playbook in the repo + where the job is defined is expected. When a job inherits from a parent, the child's post-run playbooks are run before the parent's. See :ref:`job` for more information. + .. warning:: + + If the path as specified does not exist, Zuul will try + appending the extensions ``.yaml`` and ``.yml``. This + behavior is deprecated and will be removed in the future all + playbook paths should include the file extension. + .. attr:: run - The name of the main playbook for this job. This parameter is - not normally necessary, as it defaults to a playbook with the - same name as the job inside of the ``playbooks/`` directory - (e.g., the ``foo`` job would default to ``playbooks/foo``. - However, if a playbook with a different name is needed, it can - be specified here. The file extension is not required, but the - full path within the repo is. When a child inherits from a - parent, a playbook with the name of the child job is implicitly - searched first, before falling back on the playbook used by the - parent job (unless the child job specifies a ``run`` attribute, - in which case that value is used). Example: + The name of the main playbook for this job. If it is not + supplied, the parent's playbook will be used (and likewise up + the inheritance chain). The full path within the repo is + required. Example: .. code-block:: yaml - run: playbooks/<name of the job> + run: playbooks/job-playbook.yaml + + .. warning:: + + If the path as specified does not exist, Zuul will try + appending the extensions ``.yaml`` and ``.yml``. This + behavior is deprecated and will be removed in the future all + playbook paths should include the file extension. .. attr:: roles diff --git a/tests/base.py b/tests/base.py index 2da4d4728..2a2f164b9 100755 --- a/tests/base.py +++ b/tests/base.py @@ -2230,8 +2230,6 @@ class ZuulTestCase(BaseTestCase): files={'README': ''}, branch='master', tag='init') if 'job' in item: - jobname = item['job']['name'] - files['playbooks/%s.yaml' % jobname] = '' if 'run' in item['job']: files['%s.yaml' % item['job']['run']] = '' for fn in zuul.configloader.as_list( diff --git a/zuul/configloader.py b/zuul/configloader.py index 2cb23d99b..ec2c1e0ae 100644 --- a/zuul/configloader.py +++ b/zuul/configloader.py @@ -612,12 +612,6 @@ class JobParser(object): run = model.PlaybookContext(job.source_context, conf['run'], job.roles, secrets) job.run = (run,) - else: - if not project_pipeline: - run_name = os.path.join('playbooks', job.name) - run = model.PlaybookContext(job.source_context, run_name, - job.roles, secrets) - job.implied_run = (run,) for k in JobParser.simple_attributes: a = k.replace('-', '_') diff --git a/zuul/model.py b/zuul/model.py index 30d4b26c9..8a44785e4 100644 --- a/zuul/model.py +++ b/zuul/model.py @@ -856,7 +856,6 @@ class Job(object): source_line=None, inheritance_path=(), parent_data=None, - implied_run=(), ) self.inheritable_attributes = {} @@ -914,10 +913,6 @@ class Job(object): def setBase(self): self.inheritance_path = self.inheritance_path + (repr(self),) - def setRun(self): - if not self.run: - self.run = self.implied_run - def addRoles(self, roles): newroles = [] # Start with a copy of the existing roles, but if any of them @@ -1036,11 +1031,6 @@ class Job(object): if other._get('roles') is not None: self.addRoles(other.roles) - # We only want to update implied run for inheritance, not - # variance. - if self.name != other.name: - other_implied_run = self.freezePlaybooks(other.implied_run) - self.implied_run = other_implied_run + self.implied_run if other._get('run') is not None: other_run = self.freezePlaybooks(other.run) self.run = other_run @@ -2551,11 +2541,7 @@ class Layout(object): else: frozen_job.applyVariant(variant) frozen_job.name = variant.name - # Set the implied run based on the last top-level job - # definition, before we start applying project-pipeline - # variants. frozen_job.name = jobname - frozen_job.setRun() # Whether the change matches any of the project pipeline # variants matched = False |