Created
June 12, 2017 17:15
-
-
Save JJediny/3c2b692ef62b8f422501efce5b65aafd to your computer and use it in GitHub Desktop.
JSON Schema of a Jenkinsfile (DSL Pipeline)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Jenkinsfile YAML", | |
"definitions": { | |
"libraries": { | |
"description": "One or more shared library identifiers to load", | |
"type": "array", | |
"items": { | |
"type": "string" | |
}, | |
"minItems": 1 | |
}, | |
"environmentValue": { | |
"description": "A possible value for an environment variable", | |
"anyOf": [ | |
{ | |
"$ref": "#/definitions/singleArgument" | |
}, | |
{ | |
"$ref": "#/definitions/internalFunction" | |
} | |
] | |
}, | |
"options": { | |
"description": "One or more options (including job properties, wrappers, and options specific to Declarative Pipelines)", | |
"type": "object", | |
"properties": { | |
"options": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/methodCall" | |
}, | |
"minItems": 1 | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"triggers": { | |
"description": "One or more triggers", | |
"type": "object", | |
"properties": { | |
"triggers": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/methodCall" | |
}, | |
"minItems": 1 | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"parameters": { | |
"description": "One or more parameter definitions", | |
"type": "object", | |
"properties": { | |
"parameters": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/methodCall" | |
}, | |
"minItems": 1 | |
} | |
}, | |
"additionalProperties": false | |
}, | |
"step": { | |
"description": "A single step with parameters", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"arguments": { | |
"$ref": "#/definitions/argumentList" | |
} | |
}, | |
"required": [ | |
"name", | |
"arguments" | |
], | |
"additionalProperties": false | |
}, | |
"treeStep": { | |
"description": "A block-scoped step with parameters containing 1 or more other steps", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"arguments": { | |
"$ref": "#/definitions/argumentList" | |
}, | |
"children": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"anyOf": [ | |
{ | |
"$ref": "#/definitions/step" | |
}, | |
{ | |
"$ref": "#/definitions/treeStep" | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"name", | |
"arguments", | |
"children" | |
], | |
"additionalProperties": false | |
}, | |
"nestedWhenCondition": { | |
"description": "A when condition holding one or more other when conditions", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"children": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"anyOf": [ | |
{ | |
"$ref": "#/definitions/step" | |
}, | |
{ | |
"$ref": "#/definitions/nestedWhenCondition" | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"name", | |
"children" | |
], | |
"additionalProperties": false | |
}, | |
"branch": { | |
"description": "A block of steps, generally one of: the contents of a stage, the contents of a build condition block, or one branch of a parallel invocation", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"steps": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"anyOf": [ | |
{ | |
"$ref": "#/definitions/step" | |
}, | |
{ | |
"$ref": "#/definitions/treeStep" | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"name", | |
"steps" | |
], | |
"additionalProperties": false | |
}, | |
"buildCondition": { | |
"description": "A block of steps to be invoked depending on whether the given build condition is met", | |
"type": "object", | |
"properties": { | |
"condition": { | |
"type": "string" | |
}, | |
"branch": { | |
"$ref": "#/definitions/branch" | |
} | |
}, | |
"required": [ | |
"condition", | |
"branch" | |
], | |
"additionalProperties": false | |
}, | |
"environment": { | |
"description": "A block of key = value pairs, used to set environment variables for the build", | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/environmentEntry" | |
}, | |
"minItems": 1 | |
}, | |
"tools": { | |
"description": "A block of 'toolType \"toolVersion\"' pairs listing tools to autoinstall and add to the path", | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/argumentValue" | |
}, | |
"minItems": 1 | |
}, | |
"agent": { | |
"description": "Determines the node/image in which the build will run from either named parameters or a bare none", | |
"type": "object", | |
"properties": { | |
"type": { | |
"type": "string" | |
}, | |
"arguments": { | |
"$ref": "#/definitions/mapArgumentList" | |
}, | |
"argument": { | |
"$ref": "#/definitions/rawArgument" | |
} | |
}, | |
"required": [ | |
"type" | |
], | |
"additionalProperties": false | |
}, | |
"when": { | |
"description": "Conditions to evaluate whether the stage should run or not", | |
"type": "object", | |
"properties": { | |
"conditions": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"anyOf": [ | |
{ | |
"$ref": "#/definitions/step" | |
}, | |
{ | |
"$ref": "#/definitions/nestedWhenCondition" | |
} | |
] | |
} | |
} | |
}, | |
"required": [ | |
"conditions" | |
], | |
"additionalProperties": false | |
}, | |
"post": { | |
"description": "An array of build conditions with blocks of steps to run if those conditions are satisfied at the end of the build while still on the image/node the build ran on", | |
"type": "object", | |
"properties": { | |
"conditions": { | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$ref": "#/definitions/buildCondition" | |
} | |
} | |
}, | |
"required": [ | |
"conditions" | |
], | |
"additionalProperties": false | |
}, | |
"stage": { | |
"description": "A single Pipeline stage, with a name and one or more branches", | |
"type": "object", | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"failFast": { | |
"type": "boolean" | |
}, | |
"agent": { | |
"$ref": "#/definitions/agent" | |
}, | |
"when": { | |
"$ref": "#/definitions/when" | |
}, | |
"post": { | |
"$ref": "#/definitions/post" | |
}, | |
"tools": { | |
"$ref": "#/definitions/tools" | |
}, | |
"environment": { | |
"$ref": "#/definitions/environment" | |
}, | |
"branches": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/branch" | |
} | |
} | |
}, | |
"required": [ | |
"name", | |
"branches" | |
], | |
"additionalProperties": false | |
}, | |
"stages": { | |
"description": "Top level section containing a list of stages", | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$ref": "#/definitions/stage" | |
} | |
}, | |
"pipeline": { | |
"type": "object", | |
"properties": { | |
"stages": { | |
"$ref": "#/definitions/stages" | |
}, | |
"post": { | |
"$ref": "#/definitions/post" | |
}, | |
"environment": { | |
"$ref": "#/definitions/environment" | |
}, | |
"agent": { | |
"$ref": "#/definitions/agent" | |
}, | |
"tools": { | |
"$ref": "#/definitions/tools" | |
}, | |
"options": { | |
"$ref": "#/definitions/options" | |
}, | |
"triggers": { | |
"$ref": "#/definitions/triggers" | |
}, | |
"parameters": { | |
"$ref": "#/definitions/parameters" | |
}, | |
"libraries": { | |
"$ref": "#/definitions/libraries" | |
} | |
}, | |
"required": [ | |
"stages", | |
"agent" | |
], | |
"additionalProperties": false | |
} | |
}, | |
"type": "object", | |
"properties": { | |
"pipeline": { | |
"$ref": "#/definitions/pipeline" | |
} | |
}, | |
"required": [ | |
"pipeline" | |
], | |
"additionalProperties": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment