James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 1 | :title: Tenant Configuration |
| 2 | |
| 3 | .. _tenant-config: |
| 4 | |
| 5 | Tenant Configuration |
| 6 | ==================== |
| 7 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 8 | After ``zuul.conf`` is configured, Zuul component servers will be able |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 9 | to start, but a tenant configuration is required in order for Zuul to |
| 10 | perform any actions. The tenant configuration file specifies upon |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 11 | which projects Zuul should operate. These repositories are grouped |
| 12 | into tenants. The configuration of each tenant is separate from the |
| 13 | rest (no pipelines, jobs, etc are shared between them). |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 14 | |
| 15 | A project may appear in more than one tenant; this may be useful if |
| 16 | you wish to use common job definitions across multiple tenants. |
| 17 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 18 | The tenant configuration file is specified by the |
| 19 | :attr:`scheduler.tenant_config` setting in ``zuul.conf``. It is a |
| 20 | YAML file which, like other Zuul configuration files, is a list of |
| 21 | configuration objects, though only one type of object is supported: |
| 22 | ``tenant``. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 23 | |
| 24 | Tenant |
| 25 | ------ |
| 26 | |
| 27 | A tenant is a collection of projects which share a Zuul |
Fabien Boucher | d779c9d | 2018-01-19 12:19:00 +0100 | [diff] [blame] | 28 | configuration. Some examples of tenant definitions are: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 29 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 30 | .. code-block:: yaml |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 31 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 32 | - tenant: |
| 33 | name: my-tenant |
| 34 | max-nodes-per-job: 5 |
| 35 | exclude-unprotected-branches: false |
| 36 | source: |
| 37 | gerrit: |
| 38 | config-projects: |
| 39 | - common-config |
| 40 | - shared-jobs: |
| 41 | include: job |
| 42 | untrusted-projects: |
| 43 | - zuul-jobs: |
| 44 | shadow: common-config |
| 45 | - project1 |
| 46 | - project2: |
| 47 | exclude-unprotected-branches: true |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 48 | |
Fabien Boucher | d779c9d | 2018-01-19 12:19:00 +0100 | [diff] [blame] | 49 | .. code-block:: yaml |
| 50 | |
| 51 | - tenant: |
| 52 | name: my-tenant |
| 53 | source: |
| 54 | gerrit: |
| 55 | config-projects: |
| 56 | - common-config |
| 57 | untrusted-projects: |
| 58 | - exclude: |
| 59 | - job |
| 60 | - semaphore |
| 61 | - project |
| 62 | - project-template |
| 63 | - nodeset |
| 64 | - secret |
| 65 | projects: |
| 66 | - project1 |
| 67 | - project2: |
| 68 | exclude-unprotected-branches: true |
| 69 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 70 | .. attr:: tenant |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 71 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 72 | The following attributes are supported: |
Tristan Cacqueray | 82f864b | 2017-08-01 05:54:42 +0000 | [diff] [blame] | 73 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 74 | .. attr:: name |
| 75 | :required: |
Tobias Henkel | eca4620 | 2017-08-02 20:27:10 +0200 | [diff] [blame] | 76 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 77 | The name of the tenant. This may appear in URLs, paths, and |
| 78 | monitoring fields, and so should be restricted to URL friendly |
| 79 | characters (ASCII letters, numbers, hyphen and underscore) and |
| 80 | you should avoid changing it unless necessary. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 81 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 82 | .. attr:: source |
| 83 | :required: |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 84 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 85 | A dictionary of sources to consult for projects. A tenant may |
| 86 | contain projects from multiple sources; each of those sources |
| 87 | must be listed here, along with the projects it supports. The |
| 88 | name of a :ref:`connection<connections>` is used as the |
| 89 | dictionary key (e.g. ``gerrit`` in the example above), and the |
| 90 | value is a further dictionary containing the keys below. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 91 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 92 | The next two attributes, **config-projects** and |
| 93 | **untrusted-projects** provide the bulk of the information for |
| 94 | tenant configuration. They list all of the projects upon which |
| 95 | Zuul will act. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 96 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 97 | The order of the projects listed in a tenant is important. A job |
| 98 | which is defined in one project may not be redefined in another |
| 99 | project; therefore, once a job appears in one project, a project |
| 100 | listed later will be unable to define a job with that name. |
| 101 | Further, some aspects of project configuration (such as the merge |
| 102 | mode) may only be set on the first appearance of a project |
| 103 | definition. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 104 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 105 | Zuul loads the configuration from all **config-projects** in the |
| 106 | order listed, followed by all **untrusted-projects** in order. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 107 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 108 | .. attr:: config-projects |
James E. Blair | 4b42e36 | 2017-07-13 13:52:22 -0700 | [diff] [blame] | 109 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 110 | A list of projects to be treated as :term:`config projects |
| 111 | <config-project>` in this tenant. The jobs in a config project |
| 112 | are trusted, which means they run with extra privileges, do not |
| 113 | have their configuration dynamically loaded for proposed |
| 114 | changes, and Zuul config files are only searched for in the |
| 115 | ``master`` branch. |
Tobias Henkel | eca4620 | 2017-08-02 20:27:10 +0200 | [diff] [blame] | 116 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 117 | The items in the list follow the same format described in |
| 118 | **untrusted-projects**. |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 119 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 120 | .. attr:: untrusted-projects |
| 121 | |
| 122 | A list of projects to be treated as untrusted in this tenant. |
| 123 | An :term:`untrusted-project` is the typical project operated on |
| 124 | by Zuul. Their jobs run in a more restrictive environment, they |
| 125 | may not define pipelines, their configuration dynamically |
| 126 | changes in response to proposed changes, and Zuul will read |
| 127 | configuration files in all of their branches. |
| 128 | |
Joshua Hesketh | 731cdf3 | 2017-12-11 13:37:44 +1100 | [diff] [blame] | 129 | .. attr:: <project> |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 130 | |
| 131 | The items in the list may either be simple string values of |
| 132 | the project names, or a dictionary with the project name as |
| 133 | key and the following values: |
| 134 | |
| 135 | .. attr:: include |
| 136 | |
Monty Taylor | db39bbb | 2017-08-23 17:24:00 -0400 | [diff] [blame] | 137 | Normally Zuul will load all of the :ref:`configuration-items` |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 138 | appropriate for the type of project (config or untrusted) |
| 139 | in question. However, if you only want to load some |
| 140 | items, the **include** attribute can be used to specify |
Monty Taylor | db39bbb | 2017-08-23 17:24:00 -0400 | [diff] [blame] | 141 | that *only* the specified items should be loaded. |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 142 | Supplied as a string, or a list of strings. |
| 143 | |
Monty Taylor | db39bbb | 2017-08-23 17:24:00 -0400 | [diff] [blame] | 144 | The following **configuration items** are recognized: |
| 145 | |
| 146 | * pipeline |
| 147 | * job |
| 148 | * semaphore |
| 149 | * project |
| 150 | * project-template |
| 151 | * nodeset |
| 152 | * secret |
| 153 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 154 | .. attr:: exclude |
| 155 | |
Monty Taylor | db39bbb | 2017-08-23 17:24:00 -0400 | [diff] [blame] | 156 | A list of **configuration items** that should not be loaded. |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 157 | |
| 158 | .. attr:: shadow |
| 159 | |
| 160 | A list of projects which this project is permitted to |
| 161 | shadow. Normally, only one project in Zuul may contain |
| 162 | definitions for a given job. If a project earlier in the |
| 163 | configuration defines a job which a later project |
| 164 | redefines, the later definition is considered an error and |
| 165 | is not permitted. The **shadow** attribute of a project |
| 166 | indicates that job definitions in this project which |
| 167 | conflict with the named projects should be ignored, and |
| 168 | those in the named project should be used instead. The |
| 169 | named projects must still appear earlier in the |
| 170 | configuration. In the example above, if a job definition |
| 171 | appears in both the ``common-config`` and ``zuul-jobs`` |
| 172 | projects, the definition in ``common-config`` will be |
| 173 | used. |
| 174 | |
| 175 | .. attr:: exclude-unprotected-branches |
| 176 | |
| 177 | Define if unprotected github branches should be |
| 178 | processed. Defaults to the tenant wide setting of |
| 179 | exclude-unprotected-branches. |
| 180 | |
Fabien Boucher | d779c9d | 2018-01-19 12:19:00 +0100 | [diff] [blame] | 181 | .. attr:: <project-group> |
| 182 | |
| 183 | The items in the list are dictionaries with the following |
| 184 | attributes. A **configuration items** definition is applied |
| 185 | to the list of projects. |
| 186 | |
| 187 | .. attr:: include |
| 188 | |
| 189 | A list of **configuration items** that should be loaded. |
| 190 | |
| 191 | .. attr:: exclude |
| 192 | |
| 193 | A list of **configuration items** that should not be loaded. |
| 194 | |
| 195 | .. attr:: projects |
| 196 | |
| 197 | A list of **project** items. |
| 198 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 199 | .. attr:: max-nodes-per-job |
| 200 | :default: 5 |
| 201 | |
| 202 | The maximum number of nodes a job can request. A value of |
| 203 | '-1' value removes the limit. |
| 204 | |
Tristan Cacqueray | c98bff7 | 2017-09-10 15:25:26 +0000 | [diff] [blame] | 205 | .. attr:: max-job-timeout |
| 206 | :default: 10800 |
| 207 | |
| 208 | The maximum timeout for jobs. A value of '-1' value removes the limit. |
| 209 | |
James E. Blair | b4eab92 | 2017-08-04 09:29:45 -0700 | [diff] [blame] | 210 | .. attr:: exclude-unprotected-branches |
| 211 | :default: false |
| 212 | |
| 213 | When using a branch and pull model on a shared GitHub repository |
| 214 | there are usually one or more protected branches which are gated |
| 215 | and a dynamic number of personal/feature branches which are the |
| 216 | source for the pull requests. These branches can potentially |
| 217 | include broken Zuul config and therefore break the global tenant |
| 218 | wide configuration. In order to deal with this Zuul's operations |
| 219 | can be limited to the protected branches which are gated. This |
| 220 | is a tenant wide setting and can be overridden per project. |
| 221 | This currently only affects GitHub projects. |
James E. Blair | 2bab6e7 | 2017-08-07 09:52:45 -0700 | [diff] [blame] | 222 | |
| 223 | .. attr:: default-parent |
| 224 | :default: base |
| 225 | |
| 226 | If a job is defined without an explicit :attr:`job.parent` |
| 227 | attribute, this job will be configured as the job's parent. |
| 228 | This allows an administrator to configure a default base job to |
| 229 | implement local policies such as node setup and artifact |
| 230 | publishing. |