Skip to content

Instantly share code, notes, and snippets.

@dacci
Created January 20, 2023 03:36
Show Gist options
  • Save dacci/6ccf1b1cdcb93228f574137c05e82491 to your computer and use it in GitHub Desktop.
Save dacci/6ccf1b1cdcb93228f574137c05e82491 to your computer and use it in GitHub Desktop.
JSON schema for AWS CodeBuild buildspec.
{
"$ref": "#/definitions/BuildSpec",
"definitions": {
"BuildSpec": {
"type": "object",
"required": [
"version"
],
"additionalProperties": false,
"properties": {
"version": {
"type": "number",
"enum": [
0.1,
0.2
]
},
"run-as": {
"type": "string"
},
"env": {
"$ref": "#/definitions/Env"
},
"proxy": {
"$ref": "#/definitions/Proxy"
},
"batch": {
"$ref": "#/definitions/Batch"
},
"phases": {
"$ref": "#/definitions/Phases"
},
"reports": {
"type": "object",
"required": [],
"additionalProperties": {
"$ref": "#/definitions/Report"
}
},
"artifacts": {
"$ref": "#/definitions/Artifacts"
},
"cache": {
"$ref": "#/definitions/Cache"
}
}
},
"YesNo": {
"type": "string",
"enum": [
"yes",
"no"
]
},
"Map": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"Env": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"shell": {
"type": "string",
"enum": [
"bash",
"/bin/sh",
"powershell.exe",
"cmd.exe"
]
},
"variables": {
"$ref": "#/definitions/Map"
},
"parameter-store": {
"$ref": "#/definitions/Map"
},
"secrets-manager": {
"$ref": "#/definitions/Map"
},
"exported-variables": {
"type": "array",
"items": {
"type": "string"
}
},
"git-credential-helper": {
"$ref": "#/definitions/YesNo"
}
}
},
"Proxy": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"upload-artifacts": {
"$ref": "#/definitions/YesNo"
},
"logs": {
"$ref": "#/definitions/YesNo"
}
}
},
"Batch": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"fast-fail": {
"type": "boolean"
},
"build-graph": {
"type": "array",
"items": {
"$ref": "#/definitions/BatchBuild"
}
},
"build-list": {
"type": "array",
"items": {
"$ref": "#/definitions/BatchBuild"
}
},
"build-matrix": {
"type": "array",
"items": {
"$ref": "#/definitions/BuildMatrix"
}
}
}
},
"BatchBuild": {
"type": "object",
"required": [
"identifier"
],
"additionalProperties": false,
"properties": {
"identifier": {
"type": "string"
},
"buildspec": {
"type": "string"
},
"debug-session": {
"type": "boolean"
},
"depend-on": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"$ref": "#/definitions/BatchEnv"
},
"ignore-failure": {
"type": "boolean"
}
}
},
"BatchEnv": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"compute-type": {
"type": "string"
},
"image": {
"type": "string"
},
"privileged-mode": {
"type": "boolean"
},
"type": {
"type": "string"
},
"variables": {}
}
},
"BuildMatrix": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"static": {
"$ref": "#/definitions/StaticBuild"
},
"dynamic": {
"$ref": "#/definitions/DynamicBuild"
}
}
},
"StaticBuild": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"ignore-failure": {
"type": "boolean"
},
"env": {
"$ref": "#/definitions/StaticBuildEnv"
}
}
},
"StaticBuildEnv": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"privileged-mode": {
"type": "boolean"
},
"type": {
"type": "string"
}
}
},
"DynamicBuild": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"buildspec": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"$ref": "#/definitions/DynamicBuildEnv"
}
}
},
"DynamicBuildEnv": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"compute-type": {
"type": "array",
"items": {
"type": "string"
}
},
"image": {
"type": "array",
"items": {
"type": "string"
}
},
"variables": {
"type": "array",
"items": {
"$ref": "#/definitions/Map"
}
}
}
},
"Phases": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"install": {
"$ref": "#/definitions/InstallPhase"
},
"pre_build": {
"$ref": "#/definitions/BuildPhase"
},
"build": {
"$ref": "#/definitions/BuildPhase"
},
"post_build": {
"$ref": "#/definitions/BuildPhase"
}
}
},
"InstallPhase": {
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {
"run-as": {
"type": "string"
},
"on-failure": {
"type": "string",
"enum": [
"ABORT",
"CONTINUE"
]
},
"runtime-versions": {
"$ref": "#/definitions/Map"
},
"commands": {
"type": "array",
"items": {
"type": "string"
}
},
"finally": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"BuildPhase": {
"type": "object",
"required": [],
"additionalProperties": true,
"properties": {
"run-as": {
"type": "string"
},
"on-failure": {
"type": "string",
"enum": [
"ABORT",
"CONTINUE"
]
},
"commands": {
"type": "array",
"items": {
"type": "string"
}
},
"finally": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Report": {
"type": "object",
"required": [
"files"
],
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"type": "string"
}
},
"file-format": {
"type": "string",
"enum": [
"CUCUMBERJSON",
"JUNITXML",
"NUNITXML",
"NUNIT3XML",
"TESTNGXML",
"VISUALSTUDIOTRX",
"CLOVERXML",
"COBERTURAXML",
"JACOCOXML",
"SIMPLECOV"
]
},
"base-directory": {
"type": "string"
},
"discard-paths": {
"$ref": "#/definitions/YesNo"
}
}
},
"Artifacts": {
"type": "object",
"required": [
"files"
],
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"discard-paths": {
"$ref": "#/definitions/YesNo"
},
"base-directory": {
"type": "string"
},
"exclude-paths": {
"type": "array",
"items": {
"type": "string"
}
},
"enable-symlinks": {
"$ref": "#/definitions/YesNo"
},
"s3-prefix": {
"type": "string"
},
"secondary-artifacts": {
"type": "object",
"required": [],
"additionalProperties": {
"$ref": "#/definitions/SecondaryArtifact"
}
}
}
},
"SecondaryArtifact": {
"type": "object",
"required": [
"files"
],
"additionalProperties": false,
"properties": {
"files": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"discard-paths": {
"$ref": "#/definitions/YesNo"
},
"base-directory": {
"type": "string"
}
}
},
"Cache": {
"type": "object",
"required": [
"paths"
],
"additionalProperties": false,
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment