1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-12 08:23:48 +02:00
woodpecker/pipeline/frontend/yaml/linter/schema/schema.json
Patrick Schratz f3df6f8873
Add privileged schema definition (#2777)
Co-authored-by: 6543 <m.huber@kithara.com>
2023-11-09 19:31:08 +01:00

645 lines
21 KiB
JSON

{
"title": "Woodpecker CI configuration file",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://woodpecker-ci.org/schema/woodpecker.json",
"description": "Schema of a Woodpecker pipeline file. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax",
"type": "object",
"required": ["steps"],
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"format": "uri"
},
"variables": {
"description": "Use yaml aliases to define variables. Read more: https://woodpecker-ci.org/docs/usage/advanced-yaml-syntax"
},
"clone": { "$ref": "#/definitions/clone" },
"skip_clone": { "type": "boolean" },
"branches": { "$ref": "#/definitions/branches" },
"when": { "$ref": "#/definitions/pipeline_when" },
"steps": { "$ref": "#/definitions/step_list" },
"pipeline": { "$ref": "#/definitions/step_list", "description": "deprecated, use steps" },
"services": { "$ref": "#/definitions/services" },
"workspace": { "$ref": "#/definitions/workspace" },
"matrix": { "$ref": "#/definitions/matrix" },
"platform": { "$ref": "#/definitions/platform" },
"labels": { "$ref": "#/definitions/labels" },
"depends_on": {
"type": "array",
"minLength": 1,
"items": { "type": "string" }
},
"runs_on": {
"type": "array",
"minLength": 1,
"items": { "type": "string" }
},
"version": { "type": "number", "default": 1 }
},
"definitions": {
"clone": {
"description": "Configures the clone step. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#clone",
"type": "object",
"additionalProperties": false,
"properties": {
"git": {
"type": "object",
"properties": {
"image": {
"type": "string"
}
}
}
}
},
"branches": {
"description": "Only include commits based on their target branch. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#branches",
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
},
"minProperties": 1
},
{
"type": "string"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"exclude": {
"oneOf": [
{
"type": "array",
"items": { "type": "string" },
"minLength": 1
},
{ "type": "string" }
]
},
"include": {
"oneOf": [
{
"type": "array",
"items": { "type": "string" },
"minLength": 1
},
{ "type": "string" }
]
}
}
}
]
},
"step_list": {
"description": "The steps section defines a list of steps which will be executed serially, in the order in which they are defined. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax",
"oneOf": [
{ "type": "object", "additionalProperties": { "$ref": "#/definitions/step" }, "minProperties": 1 },
{ "type": "array", "items": { "$ref": "#/definitions/step" }, "minLength": 1 }
]
},
"pipeline_when": {
"description": "Whole pipelines can be skipped based on conditions. Read more: https://woodpecker-ci.org/docs/next/usage/pipeline-syntax#when---global-pipeline-conditions",
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": { "$ref": "#/definitions/pipeline_when_condition" }
},
{
"$ref": "#/definitions/pipeline_when_condition"
}
]
},
"pipeline_when_condition": {
"type": "object",
"additionalProperties": false,
"properties": {
"repo": {
"description": "Execute a step only on a specific repository. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#repo",
"$ref": "#/definitions/constraint_list"
},
"branch": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#branch",
"$ref": "#/definitions/constraint_list"
},
"event": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#event",
"default": [],
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": { "$ref": "#/definitions/event_enum" }
},
{
"$ref": "#/definitions/event_enum"
}
]
},
"ref": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#ref",
"type": "string"
},
"cron": {
"description": "filter cron by title. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#cron",
"$ref": "#/definitions/constraint_list"
},
"platform": {
"description": "Execute a step only on a specific platform. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#platform",
"$ref": "#/definitions/constraint_list"
},
"environment": {
"description": "Execute a step only for a specific environment. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#environment",
"$ref": "#/definitions/constraint_list"
},
"instance": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#instance",
"$ref": "#/definitions/constraint_list"
},
"path": {
"description": "Execute a step only on commit with certain files added/removed/modified. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#path",
"oneOf": [
{ "type": "string" },
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"include": {
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"type": "array",
"items": {
"type": "string"
}
},
"ignore_message": {
"type": "string"
}
},
"additionalProperties": false
}
]
},
"evaluate": {
"description": "Execute a step only if the expression evaluates to true. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#evaluate",
"type": "string"
}
}
},
"step": {
"description": "Every step of your pipeline executes arbitrary commands inside a specified docker container. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#steps",
"type": "object",
"additionalProperties": false,
"required": ["image"],
"properties": {
"name": {
"description": "The name of the step. Can be used if using the array style steps list.",
"type": "string"
},
"image": {
"$ref": "#/definitions/step_image"
},
"privileged": {
"$ref": "#/definitions/step_privileged"
},
"pull": {
"$ref": "#/definitions/step_pull"
},
"commands": {
"$ref": "#/definitions/step_commands"
},
"environment": {
"$ref": "#/definitions/step_environment"
},
"directory": {
"$ref": "#/definitions/step_directory"
},
"secrets": {
"$ref": "#/definitions/step_secrets"
},
"settings": {
"$ref": "#/definitions/step_settings"
},
"when": {
"$ref": "#/definitions/step_when"
},
"volumes": {
"$ref": "#/definitions/step_volumes"
},
"group": {
"description": "Execute multiple steps with the same group key in parallel. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#step-group---parallel-execution",
"type": "string"
},
"detach": {
"description": "Detach a step to run in background until pipeline finishes. Read more: https://woodpecker-ci.org/docs/usage/services#detachment",
"type": "boolean"
},
"failure": {
"description": "How to handle the failure of this step. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#failure",
"type": "string",
"enum": ["fail", "ignore"],
"default": "fail"
},
"backend_options": {
"$ref": "#/definitions/step_backend_options"
}
}
},
"step_when": {
"description": "Steps can be skipped based on conditions. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#when---conditional-execution",
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": { "$ref": "#/definitions/step_when_condition" }
},
{
"$ref": "#/definitions/step_when_condition"
}
]
},
"step_when_condition": {
"type": "object",
"additionalProperties": false,
"properties": {
"repo": {
"description": "Execute a step only on a specific repository. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#repo",
"$ref": "#/definitions/constraint_list"
},
"branch": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#branch",
"$ref": "#/definitions/constraint_list"
},
"event": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#event",
"default": ["push", "pull_request", "tag", "deployment"],
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": { "$ref": "#/definitions/event_enum" }
},
{
"$ref": "#/definitions/event_enum"
}
]
},
"ref": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#ref",
"type": "string"
},
"cron": {
"description": "filter cron by title. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#cron",
"$ref": "#/definitions/constraint_list"
},
"status": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#status",
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": { "type": "string", "enum": ["success", "failure"] }
},
{
"type": "string",
"enum": ["success", "failure"]
}
]
},
"platform": {
"description": "Execute a step only on a specific platform. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#platform",
"$ref": "#/definitions/constraint_list"
},
"environment": {
"description": "Execute a step only for a specific environment. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#environment",
"$ref": "#/definitions/constraint_list"
},
"matrix": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/matrix-pipelines",
"type": "object",
"additionalProperties": {
"type": ["boolean", "string", "number"]
}
},
"instance": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#instance",
"$ref": "#/definitions/constraint_list"
},
"path": {
"description": "Execute a step only on commit with certain files added/removed/modified. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#path",
"oneOf": [
{ "type": "string" },
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "object",
"properties": {
"include": {
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"type": "array",
"items": {
"type": "string"
}
},
"ignore_message": {
"type": "string"
}
},
"additionalProperties": false
}
]
},
"evaluate": {
"description": "Execute a step only if the expression evaluates to true. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#evaluate",
"type": "string"
}
}
},
"event_enum": {
"enum": ["push", "pull_request", "tag", "deployment", "cron", "manual"]
},
"constraint_list": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minLength": 1,
"items": { "type": "string" }
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"include": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minLength": 1,
"items": { "type": "string" }
}
]
},
"exclude": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minLength": 1,
"items": { "type": "string" }
}
]
}
}
}
]
},
"step_image": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#image",
"type": "string"
},
"step_privileged": {
"description": "Run the step in privileged mode. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#privileged",
"type": "boolean",
"default": false
},
"step_pull": {
"description": "Always pull the latest image on pipeline execution Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#image",
"type": "boolean"
},
"step_commands": {
"description": "Commands of every pipeline step are executed serially as if you would enter them into your local shell. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#commands",
"oneOf": [
{
"type": "array",
"items": { "type": "string" },
"minLength": 1
},
{ "type": "string" }
]
},
"step_environment": {
"description": "Pass environment variables to a pipeline step. Read more: https://woodpecker-ci.org/docs/usage/environment",
"oneOf": [
{
"type": "array",
"items": { "type": "string" },
"minLength": 1
},
{
"type": "object",
"additionalProperties": {
"type": ["boolean", "string", "number"]
}
}
]
},
"step_secrets": {
"description": "Pass secrets to a pipeline step at runtime. Read more: https://woodpecker-ci.org/docs/usage/secrets",
"type": "array",
"items": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"required": ["source", "target"],
"properties": {
"source": { "type": "string" },
"target": { "type": "string" }
}
}
]
},
"minLength": 1
},
"step_settings": {
"description": "Change the settings of your plugin. Read more: https://woodpecker-ci.org/docs/usage/plugins/plugins",
"type": "object",
"additionalProperties": {
"type": ["boolean", "string", "number", "array", "object"]
}
},
"step_volumes": {
"description": "Mount files or folders from the host machine into your step container. Read more: https://woodpecker-ci.org/docs/usage/volumes",
"type": "array",
"items": { "type": "string" },
"minLength": 1
},
"step_directory": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#directory",
"type": "string"
},
"step_backend_options": {
"description": "Advanced options for the different agent backends",
"type": "object",
"properties": {
"kubernetes": {
"$ref": "#/definitions/step_backend_kubernetes_resources"
}
}
},
"step_backend_kubernetes": {
"description": "Advanced options for the kubernetes agent backends",
"type": "object",
"properties": {
"resources": {
"$ref": "#/definitions/step_backend_kubernetes_resources"
}
}
},
"step_backend_kubernetes_resources": {
"description": "Resources for the kubernetes backend. Read more: https://woodpecker-ci.org/docs/administration/backends/kubernetes",
"type": "object",
"properties": {
"requests": {
"$ref": "#/definitions/step_kubernetes_resources_object"
},
"limits": {
"$ref": "#/definitions/step_kubernetes_resources_object"
}
}
},
"step_kubernetes_resources_object": {
"description": "A list of kubernetes resource mappings",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"step_backend_kubernetes_service_account": {
"description": "serviceAccountName to be use by job. Read more: https://woodpecker-ci.org/docs/administration/backends/kubernetes",
"type": "object",
"properties": {
"requests": {
"$ref": "#/definitions/step_kubernetes_service_account_object"
},
"limits": {
"$ref": "#/definitions/step_kubernetes_service_account_object"
}
}
},
"step_kubernetes_service_account_object": {
"description": "A list of kubernetes resource mappings",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"services": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/services",
"type": "object",
"additionalProperties": { "$ref": "#/definitions/service" },
"minProperties": 1
},
"service": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/services",
"type": "object",
"additionalProperties": false,
"minProperties": 1,
"required": ["image"],
"properties": {
"image": {
"$ref": "#/definitions/step_image"
},
"privileged": {
"$ref": "#/definitions/step_privileged"
},
"pull": {
"$ref": "#/definitions/step_pull"
},
"commands": {
"$ref": "#/definitions/step_commands"
},
"environment": {
"$ref": "#/definitions/step_environment"
},
"secrets": {
"$ref": "#/definitions/step_secrets"
},
"settings": {
"$ref": "#/definitions/step_settings"
},
"when": {
"$ref": "#/definitions/step_when"
},
"volumes": {
"$ref": "#/definitions/step_volumes"
},
"ports": {
"description": "expose ports to which other steps can connect to",
"type": "array",
"items": {
"oneOf": [{ "type": "number" }, { "type": "string" }]
},
"minLength": 1
}
}
},
"workspace": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#workspace",
"type": "object",
"additionalProperties": true
},
"matrix": {
"description": "Execute pipeline for each matrix combination. Read more: https://woodpecker-ci.org/docs/usage/matrix-pipelines",
"type": "object",
"properties": {
"include": {
"type": "array",
"items": {
"type": "object"
},
"minLength": 1
}
},
"additionalProperties": {
"type": "array",
"items": {
"type": ["boolean", "string", "number"]
},
"minLength": 1
}
},
"platform": {
"description": "Configures the platform the pipeline will be executed on. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#platform",
"type": "string",
"additionalProperties": false
},
"labels": {
"description": "Configures the labels used for the agent selection. Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#clone",
"type": "object",
"additionalProperties": {
"type": ["boolean", "string", "number"]
}
}
}
}