8000 Improve zuul schema by ssbarnea · Pull Request #17 · ansible/schemas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Improve zuul schema #17

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
files: 'pattern' # or list of patterns
override-checkout: master
success-url: docs/
failure-url: docs/
secrets: # https://zuul-ci.org/docs/zuul/reference/job_def.html#attr-job.secrets
- foo
- name: bar
Expand All @@ -45,6 +46,8 @@
required-projects:
- foo
- bar
roles:
- zuul: some_role_name

- project-template:
name: sample-template
Expand Down
39 changes: 39 additions & 0 deletions f/zuul.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"title": "Description",
"type": "string"
},
"failure-url": {
"title": "Failure-Url",
"type": "string"
},
"files": {
"anyOf": [
{
Expand All @@ -66,6 +70,20 @@
"title": "Host-Vars",
"type": "object"
},
"irrelevant-files": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"title": "Irrelevant-Files"
},
"name": {
"title": "Name",
"type": "string"
Expand Down Expand Up @@ -116,6 +134,13 @@
"title": "Required-Projects",
"type": "array"
},
"roles": {
"items": {
"$ref": "#/definitions/ZuulRoleModel"
},
"title": "Roles",
"type": "array"
},
"run": {
"title": "Run",
"type": "string"
Expand Down Expand Up @@ -374,6 +399,20 @@
],
"title": "SecretModel",
"type": "object"
},
"ZuulRoleModel": {
"additionalProperties": false,
"properties": {
"zuul": {
"title": "Zuul",
"type": "string"
}
},
"required": [
"zuul"
],
"title": "ZuulRoleModel",
"type": "object"
}
},
"items": {
Expand Down
10 changes: 10 additions & 0 deletions src/ansibleschemas/zuul.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ class Config:
extra = Extra.forbid


class ZuulRoleModel(BaseModel):
zuul: str

class Config:
extra = Extra.forbid


class JobModel(BaseModel):
# based on https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html#play
name: str
Expand All @@ -79,8 +86,10 @@ class JobModel(BaseModel):
parent: Optional[str]
vars: Optional[Mapping[str, Any]]
files: Optional[Union[str, List[str]]]
irrelevant_files: Optional[Union[str, List[str]]] = Field(alias="irrelevant-files")
override_checkout: Optional[str] = Field(alias="override-checkout")
success_url: Optional[str] = Field(alias="success-url")
failure_url: Optional[str] = Field(alias="failure-url")
abstract: Optional[bool] = False
voting: Optional[bool] = True
timeout: Optional[int]
Expand All @@ -91,6 +100,7 @@ class JobModel(BaseModel):
tags: Optional[Union[str, List[str]]]
required_projects: Optional[List[str]] = Field(alias="required-projects")
secrets: Optional[Union[JobSecretModel, List[Union[JobSecretModel, str]]]]
roles: Optional[List[ZuulRoleModel]]

class Config:
extra = Extra.forbid
Expand Down
0