Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Last active October 21, 2018 23:59
Show Gist options
  • Save toolmantim/78eb8bd692600da6fdbaa07176a2680d to your computer and use it in GitHub Desktop.
Save toolmantim/78eb8bd692600da6fdbaa07176a2680d to your computer and use it in GitHub Desktop.
JSON Schema for Buildkite Pipeline files
{
"title": "JSON schema for Buildkite pipeline configuration files",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"label": {
"type": "string",
"description": "The label that will be displayed in the pipeline visualisation in Buildkite. Supports emoji.",
"examples": [ ":docker: Build" ]
},
"branches": {
"description": "Which branches will include this step in their builds",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": { "type": "string" }
}
],
"examples": [
"master",
[ "feature/*", "chore/*" ]
]
},
"commands": {
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
,
"description": "The shell command/s to run during this step",
"examples": [
"make test",
[ "npm install", "npm test" ]
]
},
"commandRetry": {
"type": "object",
"properties": {
"exit_status": {
"description": "The exit status number that will cause this job to retry",
"anyOf": [
{
"type": "string",
"enum": [ "*" ]
},
{
"type": "number"
}
]
},
"limit": {
"type": "integer",
"description": "The number of times this job can be retried",
"minimum": 1,
"maximum": 10
}
},
"additionalProperties": false
},
"commandStep": {
"properties": {
"agents": {
"type": "object",
"description": "The query rules to target specific agents for this step",
"examples": [
{ "queue": "deploy" },
{ "ruby": "2*" }
]
},
"artifact_paths": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": { "type": "string" }
}
],
"description": "The glob path/s of artifacts to upload once this step has finished running",
"examples": [
[ "screenshots/*" ],
[ "dist/myapp.zip", "dist/myapp.tgz" ]
]
},
"branches": {
"$reg": "#/definitions/branches"
},
"command": {
"$ref": "#/definitions/commands"
},
"commands": {
"$ref": "#/definitions/commands"
},
"concurrency": {
"type": "integer",
"description": "The maximum number of jobs created from this step that are allowed to run at the same time. If you use this attribute, you must also define concurrency_group.",
"examples": [
1
]
},
"concurrency_group": {
"type": "string",
"description": "A unique name for the concurrency group that you are creating with the concurrency attribute",
"examples": [
"my-pipeline/deploy"
]
},
"env": {
"type": "object",
"description": "Environment variables for this step",
"examples": [
{ "NODE_ENV": "test" }
]
},
"label": {
"$ref": "#/definitions/label"
},
"name": {
"$ref": "#/definitions/label"
},
"parallelism": {
"type": "integer",
"description": "The number of parallel jobs that will be created based on this step",
"examples": [
42
]
},
"plugins": {
"type": "array",
"description": "Array of plugins for this step",
"items": {
"type": "object",
"maxProperties": 1,
"examples": [
{ "docker-compose#v1.0.0": { "run": "app" } }
]
}
},
"retry": {
"type": "object",
"description": "The conditions for retrying this step.",
"properties": {
"automatic": {
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/definitions/commandRetry"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/commandRetry"
}
}
],
"description": "Whether to allow a job to retry automatically. If set to true, the retry conditions are set to the default value.",
"default": [
{
"exit_status": "*",
"limit": 2
}
]
},
"manual": {
"description": "Whether to allow a job to be retried manually",
"anyOf": [
{
"type": "boolean"
},
{
"type": "object",
"properties": {
"allowed": {
"type": "boolean",
"description": "Whether or not this job can be retried manually",
"default": true
},
"permit_on_passed": {
"type": "boolean",
"description": "Whether or not this job can be retried after it has passed",
"default": true
},
"reason": {
"type": "string",
"description": "A string that will be displayed in a tooltip on the Retry button in Buildkite. This will only be displayed if the allowed attribute is set to false.",
"examples": [
"No retries allowed on deploy steps"
]
}
},
"additionalProperties": false
}
]
}
},
"additionalProperties": false
},
"skip": {
"anyOf": [
{ "type": "boolean" },
{ "type": "string" }
],
"description": "Whether this step should be skipped. You can specify a reason for using a string.",
"examples": [
true,
false,
"My reason"
]
},
"timeout_in_minutes": {
"type": "integer",
"description": "The number of minutes to time out a job",
"minimum": 1,
"examples": [
60
]
},
"type": {
"type": "string",
"description": "The type of the step",
"pattern": "^(script|command|commands)$"
}
},
"additionalProperties": false
},
"waitStepContinueOnFailure": {
"type": "boolean",
"description": "Continue even if the previous steps failed"
},
"waitStep": {
"anyOf":[
{
"type": "string",
"pattern": "^wait$",
"description": "Waits for all previous steps to have successfully completed before allowing following jobs to continue"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "The type of the step",
"pattern": "^(wait|waiter)$"
},
"continue_on_failure": {
"$ref": "#/definitions/waitStepContinueOnFailure"
}
}
},
{
"type": "object",
"properties": {
"wait": {
"description": "Waits for all previous steps to have successfully completed before allowing following jobs to continue",
"anyOf":[
{ "type": "string", "maxLength": 0 },
{ "type": "null" }
]
},
"continue_on_failure": {
"$ref": "#/definitions/waitStepContinueOnFailure"
}
},
"additionalProperties": false
}
]
},
"triggerStep": {
"type": "object",
"properties": {
"trigger": {
"type": "string",
"description": "The slug of the pipeline to create a build."
},
"label": {
"$ref": "#/definitions/label"
},
"branches": {
"$ref": "#/definitions/branches"
},
"async": {
"type": "boolean",
"default": false,
"description": "Whether to continue the build without waiting for the triggered step to complete"
},
"build": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The message for the build (supports emoji)",
"default": "The label of the trigger step"
},
"commit": {
"type": "string",
"description": "The commit hash for the build",
"default": "HEAD"
},
"branch": {
"type": "string",
"description": "The branch for the build",
"default": "master"
},
"meta_data": {
"type": "object",
"description": "Meta-data for the build"
},
"env": {
"type": "object",
"description": "Environment variables for the build"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"blockStep": {
"type": "object",
"properties": {
"block": {
"type": "string",
"description": "The label of the block step",
"examples": [
":rocket: Release"
]
},
"prompt": {
"type": "string",
"description": "Instructional message displayed in the dialog box when the unblock step is activated",
"examples": [
"Release to production?",
"Fill out the details for this release"
]
},
"fields": {
"type": "array",
"description": "A list of input fields required to be filled out before unblocking the step",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The text input name",
"examples": [
"Release Name"
]
},
"key": {
"type": "string",
"description": "The meta-data key that stores the field's input",
"pattern": "^[a-zA-Z0-9-]+$",
"examples": [
"release-name"
]
},
"hint": {
"type": "string",
"description": "The explanatory text that is shown after the label",
"examples": [
"What’s the code name for this release? :name_badge:"
]
},
"required": {
"type": "boolean",
"default": true,
"description": "Whether the field is required for form submission"
},
"default": {
"type": "string",
"description": "The value that is pre-filled in the text field",
"examples": [
"Flying Dolphin"
]
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"select": {
"type": "string",
"description": "The text input name",
"examples": [
"Release Stream"
]
},
"key": {
"type": "string",
"description": "The meta-data key that stores the field's input",
"pattern": "^[a-zA-Z0-9-]+$",
"examples": [
"release-stream"
]
},
"default": {
"type": "string",
"description": "The value of the option that will be pre-selected in the dropdown",
"examples": [ "beta" ]
},
"options": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string",
"description": "The text displayed on the select list item",
"examples": [ "Stable" ]
},
"value": {
"type": "string",
"description": "The value to be stored as meta-data",
"examples": [ "stable" ]
},
"hint": {
"type": "string",
"description": "The text displayed directly under the select field’s label",
"examples": [
"Which release stream does this belong in? :fork:"
]
},
"required": {
"type": "boolean",
"default": true,
"description": "Whether the field is required for form submission"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
]
}
},
"branches": {
"ref": "#!/definitions/branches"
}
},
"additionalProperties": false
}
},
"required": [
"steps"
],
"properties": {
"env": {
"type": "object",
"description": "The environment variables for all jobs",
"examples": [
{ "NODE_ENV": "test" }
]
},
"steps": {
"type": "array",
"description": "The steps to run",
"items": {
"anyOf": [
{ "$ref": "#/definitions/blockStep" },
{ "$ref": "#/definitions/commandStep" },
{ "$ref": "#/definitions/waitStep" },
{ "$ref": "#/definitions/triggerStep" }
]
}
}
},
"additionalProperties": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment