Require a base job

This makes base jobs required and allows for a per-tenant default.

Story: 2001110
Task: 4793
Change-Id: I26ffddad8358c156cfac749ce98af70f3447f671
changes/10/491610/2
James E. Blair 5 years ago
parent 0fb72dce11
commit 2bab6e7361
  1. 9
      doc/source/admin/tenants.rst
  2. 7
      doc/source/glossary.rst
  3. 23
      doc/source/user/config.rst
  4. 4
      tests/fixtures/config/ansible/git/common-config/zuul.yaml
  5. 24
      tests/fixtures/config/base-jobs/git/common-config/zuul.yaml
  6. 13
      tests/fixtures/config/base-jobs/git/org_project/.zuul.yaml
  7. 1
      tests/fixtures/config/base-jobs/git/org_project/README
  8. 2
      tests/fixtures/config/base-jobs/git/org_project/playbooks/my-job.yaml
  9. 2
      tests/fixtures/config/base-jobs/git/org_project/playbooks/other-job.yaml
  10. 9
      tests/fixtures/config/base-jobs/main.yaml
  11. 4
      tests/fixtures/config/conflict-config/git/common-config/zuul.yaml
  12. 4
      tests/fixtures/config/data-return/git/common-config/zuul.yaml
  13. 4
      tests/fixtures/config/dependency-graph/git/common-config/zuul.yaml
  14. 4
      tests/fixtures/config/disk-accountant/git/common-config/zuul.yaml
  15. 4
      tests/fixtures/config/duplicate-pipeline/git/common-config/zuul.yaml
  16. 4
      tests/fixtures/config/git-driver/git/common-config/zuul.yaml
  17. 4
      tests/fixtures/config/implicit-roles/git/common-config/zuul.yaml
  18. 4
      tests/fixtures/config/in-repo/git/common-config/zuul.yaml
  19. 4
      tests/fixtures/config/inventory/git/common-config/zuul.yaml
  20. 4
      tests/fixtures/config/merges/git/common-config/zuul.yaml
  21. 5
      tests/fixtures/config/multi-driver/git/org_common-config/zuul.yaml
  22. 4
      tests/fixtures/config/multi-tenant-semaphore/git/common-config/zuul.yaml
  23. 4
      tests/fixtures/config/multi-tenant/git/common-config/zuul.yaml
  24. 1
      tests/fixtures/config/openstack/git/project-config/zuul.yaml
  25. 4
      tests/fixtures/config/pre-playbook/git/common-config/zuul.yaml
  26. 4
      tests/fixtures/config/push-reqs/git/org_common-config/zuul.yaml
  27. 4
      tests/fixtures/config/requirements/email/git/common-config/zuul.yaml
  28. 4
      tests/fixtures/config/requirements/newer-than/git/common-config/zuul.yaml
  29. 4
      tests/fixtures/config/requirements/older-than/git/common-config/zuul.yaml
  30. 4
      tests/fixtures/config/requirements/reject-username/git/common-config/zuul.yaml
  31. 4
      tests/fixtures/config/requirements/reject/git/common-config/zuul.yaml
  32. 4
      tests/fixtures/config/requirements/state/git/common-config/zuul.yaml
  33. 4
      tests/fixtures/config/requirements/username/git/common-config/zuul.yaml
  34. 4
      tests/fixtures/config/requirements/vote1/git/common-config/zuul.yaml
  35. 4
      tests/fixtures/config/requirements/vote2/git/common-config/zuul.yaml
  36. 4
      tests/fixtures/config/roles/git/common-config/zuul.yaml
  37. 4
      tests/fixtures/config/semaphore/git/common-config/zuul.yaml
  38. 4
      tests/fixtures/config/semaphore/zuul-reconfiguration.yaml
  39. 1
      tests/fixtures/config/shadow/git/local-config/zuul.yaml
  40. 4
      tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
  41. 4
      tests/fixtures/config/split-config/git/common-config/zuul.d/jobs.yaml
  42. 4
      tests/fixtures/config/sql-driver/git/common-config/zuul.yaml
  43. 4
      tests/fixtures/config/streamer/git/common-config/zuul.yaml
  44. 4
      tests/fixtures/config/success-url/git/common-config/zuul.yaml
  45. 4
      tests/fixtures/config/templated-project/git/common-config/zuul.d/jobs.yaml
  46. 4
      tests/fixtures/config/tenant-parser/git/common-config/zuul.yaml
  47. 4
      tests/fixtures/config/unprotected-branches/git/org_common-config/zuul.yaml
  48. 4
      tests/fixtures/config/zuul-connections-multiple-gerrits/git/common-config/zuul.yaml
  49. 4
      tests/fixtures/config/zuul-connections-same-gerrit/git/common-config/zuul.yaml
  50. 4
      tests/fixtures/config/zuultrigger/parent-change-enqueued/git/common-config/zuul.yaml
  51. 4
      tests/fixtures/config/zuultrigger/project-change-merged/git/common-config/zuul.yaml
  52. 4
      tests/fixtures/layouts/autohold.yaml
  53. 5
      tests/fixtures/layouts/basic-github.yaml
  54. 9
      tests/fixtures/layouts/crd-github.yaml
  55. 6
      tests/fixtures/layouts/dependent-github.yaml
  56. 4
      tests/fixtures/layouts/dequeue-github.yaml
  57. 4
      tests/fixtures/layouts/disable_at.yaml
  58. 4
      tests/fixtures/layouts/dont-ignore-ref-deletes.yaml
  59. 4
      tests/fixtures/layouts/files-github.yaml
  60. 4
      tests/fixtures/layouts/footer-message.yaml
  61. 4
      tests/fixtures/layouts/idle.yaml
  62. 4
      tests/fixtures/layouts/ignore-dependencies.yaml
  63. 4
      tests/fixtures/layouts/inheritance.yaml
  64. 4
      tests/fixtures/layouts/irrelevant-files.yaml
  65. 4
      tests/fixtures/layouts/labeling-github.yaml
  66. 4
      tests/fixtures/layouts/live-reconfiguration-add-job.yaml
  67. 4
      tests/fixtures/layouts/live-reconfiguration-del-project.yaml
  68. 4
      tests/fixtures/layouts/live-reconfiguration-failed-job.yaml
  69. 4
      tests/fixtures/layouts/live-reconfiguration-shared-queue.yaml
  70. 4
      tests/fixtures/layouts/merge-failure.yaml
  71. 4
      tests/fixtures/layouts/merging-github.yaml
  72. 4
      tests/fixtures/layouts/no-jobs-project.yaml
  73. 4
      tests/fixtures/layouts/no-jobs.yaml
  74. 4
      tests/fixtures/layouts/no-timer.yaml
  75. 4
      tests/fixtures/layouts/nonvoting-job.yaml
  76. 4
      tests/fixtures/layouts/nonvoting-pipeline.yaml
  77. 4
      tests/fixtures/layouts/one-job-project.yaml
  78. 5
      tests/fixtures/layouts/push-tag-github.yaml
  79. 4
      tests/fixtures/layouts/rate-limit.yaml
  80. 4
      tests/fixtures/layouts/repo-checkout-four-project.yaml
  81. 4
      tests/fixtures/layouts/repo-checkout-no-timer-override.yaml
  82. 4
      tests/fixtures/layouts/repo-checkout-no-timer.yaml
  83. 4
      tests/fixtures/layouts/repo-checkout-post.yaml
  84. 4
      tests/fixtures/layouts/repo-checkout-six-project.yaml
  85. 4
      tests/fixtures/layouts/repo-checkout-timer-override.yaml
  86. 4
      tests/fixtures/layouts/repo-checkout-timer.yaml
  87. 4
      tests/fixtures/layouts/repo-checkout-two-project.yaml
  88. 4
      tests/fixtures/layouts/repo-deleted.yaml
  89. 4
      tests/fixtures/layouts/reporting-github.yaml
  90. 5
      tests/fixtures/layouts/reporting-multiple-github.yaml
  91. 13
      tests/fixtures/layouts/requirements-github.yaml
  92. 4
      tests/fixtures/layouts/reviews-github.yaml
  93. 4
      tests/fixtures/layouts/smtp.yaml
  94. 4
      tests/fixtures/layouts/tags.yaml
  95. 4
      tests/fixtures/layouts/three-projects.yaml
  96. 4
      tests/fixtures/layouts/timer-smtp.yaml
  97. 4
      tests/fixtures/layouts/timer.yaml
  98. 3
      tests/unit/test_configloader.py
  99. 8
      tests/unit/test_model.py
  100. 40
      tests/unit/test_v3.py
  101. Some files were not shown because too many files have changed in this diff Show More

@ -165,3 +165,12 @@ configuration. An example tenant definition is:
can be limited to the protected branches which are gated. This
is a tenant wide setting and can be overridden per project.
This currently only affects GitHub projects.
.. attr:: default-parent
:default: base
If a job is defined without an explicit :attr:`job.parent`
attribute, this job will be configured as the job's parent.
This allows an administrator to configure a default base job to
implement local policies such as node setup and artifact
publishing.

@ -6,6 +6,13 @@ Glossary
.. glossary::
:sorted:
base job
A job with no parent. A base job may only be defined in a
:term:`config-project`. Multiple base jobs may be defined, but
each tenant has a single default job which will be used as the
parent of any job which does not specify one explicitly.
check
By convention, the name of a pipeline which performs pre-merge

@ -17,9 +17,10 @@ they specify one of two security contexts for that project. A
*config-project* is one which is primarily tasked with holding
configuration information and job content for Zuul. Jobs which are
defined in a config-project are run with elevated privileges, and all
Zuul configuration items are available for use. It is expected that
changes to config-projects will undergo careful scrutiny before being
merged.
Zuul configuration items are available for use. Base jobs (that is,
jobs without a parent) may only be defined in config-projects. It is
expected that changes to config-projects will undergo careful scrutiny
before being merged.
An *untrusted-project* is a project whose primary focus is not to
operate Zuul, but rather it is one of the projects being tested or
@ -439,6 +440,12 @@ specialization before arriving at a particular job. A job may inherit
from any other job in any project (however, if the other job is marked
as ``final``, some attributes may not be overidden).
A job with no parent is called a *base job* and may only be defined in
a :term:`config-project`. Every other job must have a parent, and so
ultimately, all jobs must have an inheritance path which terminates at
a base job. Each tenant has a default parent job which will be used
if no explicit parent is specified.
Jobs also support a concept called variance. The first time a job
definition appears is called the reference definition of the job.
Subsequent job definitions with the same name are called variants.
@ -503,11 +510,17 @@ Here is an example of two job definitions:
this name to use as the main playbook for the job. This name is
also referenced later in a project pipeline configuration.
.. TODO: figure out how to link the parent default to tenant.default.parent
.. attr:: parent
:default: Tenant default-parent
Specifies a job to inherit from. The parent job can be defined
in this or any other project. Any attributes not specified on
a job will be collected from its parent.
in this or any other project. Any attributes not specified on a
job will be collected from its parent. If no value is supplied
here, the job specified by :attr:`tenant.default-parent` will be
used. If **parent** is set to ``null`` (which is only valid in
a :term:`config-project`), this is a :term:`base job`.
.. attr:: description

@ -69,6 +69,10 @@
data:
value: vartest_secret
- job:
name: base
parent: null
- job:
name: base-urls
success-url: https://success.example.com/zuul-logs/{build.uuid}/

@ -0,0 +1,24 @@
- pipeline:
name: check
manager: independent
trigger:
gerrit:
- event: patchset-created
success:
gerrit:
Verified: 1
failure:
gerrit:
Verified: -1
- job:
name: my-base
parent: null
tags:
- mybase
- job:
name: other-base
parent: null
tags:
- otherbase

@ -0,0 +1,13 @@
- job:
name: my-job
- job:
name: other-job
parent: other-base
- project:
name: org/project
check:
jobs:
- my-job
- other-job

@ -0,0 +1,9 @@
- tenant:
name: tenant-one
default-parent: my-base
source:
gerrit:
config-projects:
- common-config
untrusted-projects:
- org/project

@ -1,2 +1,6 @@
- job:
name: base
parent: null
- job:
name: trusted-zuul.yaml-job

@ -12,6 +12,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: data-return

@ -19,6 +19,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: A

@ -12,6 +12,10 @@
gerrit:
verified: -1
- job:
name: base
parent: null
- job:
name: dd-big-empty-file

@ -26,6 +26,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test1

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test1

@ -10,3 +10,7 @@
failure:
gerrit:
Verified: -1
- job:
name: base
parent: null

@ -69,6 +69,10 @@
type: approved
trigger: {}
- job:
name: base
parent: null
- job:
name: common-config-test

@ -31,6 +31,10 @@
- compute1
- compute2
- job:
name: base
parent: null
- job:
name: single-inventory
nodes:

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-test1

@ -26,8 +26,13 @@
gerrit:
Verified: 0
- job:
name: base
parent: null
- job:
name: project-gerrit
- job:
name: project1-github

@ -10,3 +10,7 @@
failure:
gerrit:
Verified: -1
- job:
name: base
parent: null

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: python27
nodes:

@ -35,6 +35,7 @@
- job:
name: base
parent: null
timeout: 30
nodes:
- name: controller

@ -12,6 +12,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: python27
pre-run: playbooks/pre

@ -76,6 +76,10 @@
gerrit:
- event: ref-updated
- job:
name: base
parent: null
- job:
name: job1

@ -30,6 +30,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -32,6 +32,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -32,6 +32,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -30,6 +30,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -46,6 +46,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -49,6 +49,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-job

@ -30,6 +30,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -32,6 +32,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -36,6 +36,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-job

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: common-config-test

@ -19,6 +19,10 @@
name: test-semaphore-two
max: 2
- job:
name: base
parent: null
- job:
name: project-test1

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test1

@ -13,6 +13,7 @@
- job:
name: base
parent: null
- job:
name: test2

@ -40,6 +40,10 @@
- event: ref-updated
ref: ^(?!refs/).*$
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -1,2 +1,6 @@
- job:
name: base
parent: null
- job:
name: project-test1

@ -14,6 +14,10 @@
resultsdb:
resultsdb_failures:
- job:
name: base
parent: null
- job:
name: project-merge

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: python27
vars:

@ -16,6 +16,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: docs-draft-test
success-url: http://docs-draft.example.org/{change.number:.2}/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.uuid:.7}/publish-docs/

@ -1,3 +1,7 @@
- job:
name: base
parent: null
- job:
name: project-test1

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: common-config-job

@ -17,3 +17,7 @@
start:
github:
comment: true
- job:
name: base
parent: null

@ -43,6 +43,10 @@
another_gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test1

@ -11,6 +11,10 @@
alt_voting_gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test1

@ -45,6 +45,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-check

@ -43,6 +43,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-check

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test2
nodes:

@ -17,8 +17,13 @@
failure:
github: {}
- job:
name: base
parent: null
- job:
name: project-test1
- job:
name: project-test2

@ -27,16 +27,25 @@
failure:
github: {}
- job:
name: base
parent: null
- job:
name: project1-test
- job:
name: project2-test
- job:
name: project3-test
- job:
name: project4-test
- job:
name: project5-test
- job:
name: project6-test

@ -15,10 +15,16 @@
github:
unlabel: 'merge'
- job:
name: base
parent: null
- job:
name: project-test1
- job:
name: project-test2
- job:
name: project-merge
failure-message: Unable to merge change

@ -8,6 +8,10 @@
- opened
- changed
- job:
name: base
parent: null
- job:
name: one-job-project-merge

@ -15,6 +15,10 @@
to: you@example.com
disable-after-consecutive-failures: 3
- job:
name: base
parent: null
- job:
name: project-test1
nodes:

@ -7,6 +7,10 @@
ref: ^(?!refs/).*$
ignore-deletes: false
- job:
name: base
parent: null
- job:
name: project-post
nodes:

@ -6,6 +6,10 @@
- event: pull_request
action: opened
- job:
name: base
parent: null
- job:
name: project-test1
files:

@ -25,6 +25,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-test1
# success-url: http://logs.exxxample.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}

@ -5,6 +5,10 @@
timer:
- time: '* * * * * */1'
- job:
name: base
parent: null
- job:
name: project-bitrot
nodes:

@ -12,6 +12,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project1-merge

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test-irrelevant-starts-empty

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-test-irrelevant-files

@ -19,6 +19,10 @@
unlabel:
- 'test'
- job:
name: base
parent: null
- job:
name: project-labels

@ -19,6 +19,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -46,6 +46,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -13,6 +13,10 @@
merge: true
comment: false
- job:
name: base
parent: null
- project:
name: org/project
merge:

@ -11,6 +11,10 @@
gerrit:
Verified: -1
- job:
name: base
parent: null
- job:
name: project-testfile
files:

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: gate-noop

@ -20,6 +20,10 @@
gerrit:
- event: ref-updated
- job:
name: base
parent: null
- job:
name: project-test1

@ -19,6 +19,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: nonvoting-project-merge
hold-following-changes: true

@ -9,6 +9,10 @@
failure:
gerrit: {}
- job:
name: base
parent: null
- job:
name: project-merge
hold-following-changes: true

@ -40,6 +40,10 @@
- event: ref-updated
ref: ^(?!refs/).*$
- job:
name: base
parent: null
- job:
name: one-job-project-merge
hold-following-changes: true

@ -14,8 +14,13 @@
- event: push
ref: ^refs/tags/.*$
- job:
name: base
parent: null
- job:
name: project-post
- job:
name: project-tag

@ -24,6 +24,10 @@
window-decrease-type: exponential
window-decrease-factor: 2
- job:
name: base
parent: null
- job:
name: project-merge

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: integration
required-projects:

@ -7,6 +7,10 @@
gerrit:
- event: ref-updated
- job:
name: base
parent: null
- job:
name: integration
branches: master

@ -7,6 +7,10 @@
gerrit:
- event: ref-updated
- job:
name: base
parent: null
- job:
name: integration
override-branch: stable/havana

@ -6,6 +6,10 @@
- event: ref-updated
ref: ^(?!refs/).*$
- job:
name: base
parent: null
- job:
name: integration
required-projects:

@ -32,6 +32,10 @@
Verified: 0
precedence: high
- job:
name: base
parent: null
- job:
name: integration
required-projects:

@ -5,6 +5,10 @@
timer:
- time: '* * * * * */1'
- job:
name: base
parent: null
- job:<