fixing structure for run step and updating pipeline V1 schema

This commit is contained in:
Vardan Bansal 2023-09-19 15:26:55 -07:00
parent 789fd8298b
commit f86d1a909a
2 changed files with 616 additions and 83 deletions

View File

@ -274,11 +274,11 @@ export const PluginsPanel = ({ onPluginAddUpdate }: PluginsPanelInterface): JSX.
set(payload, PluginInputsFieldPath, omit(pluginFormData, 'name')) set(payload, PluginInputsFieldPath, omit(pluginFormData, 'name'))
return payload as PluginInsertionTemplateInterface return payload as PluginInsertionTemplateInterface
case PluginCategory.Harness: case PluginCategory.Harness:
return name && image && script return image || script
? { ? {
name, ...(name && { name }),
type: 'script', type: 'run',
spec: { image, run: script } spec: { ...(image && { image }), ...(script && { script }) }
} }
: {} : {}
default: default:

View File

@ -222,7 +222,7 @@
}, },
"type": { "type": {
"description": "The stage type.", "description": "The stage type.",
"enum": ["cd", "ci", "custom", "flag", "iacm", "template"], "enum": ["cd", "ci", "custom", "flag", "iacm", "template", "group", "parallel"],
"type": "string" "type": "string"
}, },
"when": { "when": {
@ -233,6 +233,15 @@
"$ref": "#/definitions/FailureList" "$ref": "#/definitions/FailureList"
} }
}, },
"x-properties": {
"inputs": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-type": "map[string]interface{}"
}
},
"oneOf": [ "oneOf": [
{ {
"allOf": [ "allOf": [
@ -341,6 +350,42 @@
} }
} }
] ]
},
{
"allOf": [
{
"properties": {
"type": {
"const": "group"
}
}
},
{
"properties": {
"spec": {
"$ref": "#/definitions/StageGroup"
}
}
}
]
},
{
"allOf": [
{
"properties": {
"type": {
"const": "parallel"
}
}
},
{
"properties": {
"spec": {
"$ref": "#/definitions/StageParallel"
}
}
}
]
} }
], ],
"anyOf": [ "anyOf": [
@ -348,6 +393,8 @@
"required": ["type"] "required": ["type"]
} }
], ],
"x-docs-skip": false,
"x-docs-title": "stage",
"x-file": "stage.yaml" "x-file": "stage.yaml"
}, },
"Strategy": { "Strategy": {
@ -417,6 +464,19 @@
] ]
} }
], ],
"examples": [
{
"strategy": {
"matrix": {
"axis": {
"golang": [1.19, 1.21],
"node": [16, 18]
}
}
}
}
],
"x-docs-title": "strategy",
"x-file": "strategy.yaml" "x-file": "strategy.yaml"
}, },
"For": { "For": {
@ -471,6 +531,17 @@
} }
} }
}, },
"examples": [
{
"matrix": {
"axis": {
"golang": [1.19, 1.21],
"node": [16, 18]
}
}
}
],
"x-docs-title": "matrix",
"x-file": "strategy_matrix.yaml" "x-file": "strategy_matrix.yaml"
}, },
"While": { "While": {
@ -508,6 +579,7 @@
}, },
"When": { "When": {
"title": "When", "title": "When",
"description": "Expression used to evaluate whether or not a Stage or Step should execute.",
"oneOf": [ "oneOf": [
{ {
"type": "string" "type": "string"
@ -523,6 +595,8 @@
} }
], ],
"x-go-skip": true, "x-go-skip": true,
"x-docs-skip": false,
"x-docs-title": "when",
"x-file": "when.yaml" "x-file": "when.yaml"
}, },
"WhenCond": { "WhenCond": {
@ -532,6 +606,7 @@
"$ref": "#/definitions/WhenExpr" "$ref": "#/definitions/WhenExpr"
}, },
"x-go-skip": true, "x-go-skip": true,
"x-docs-skip": true,
"x-file": "when_cond.yaml" "x-file": "when_cond.yaml"
}, },
"WhenExpr": { "WhenExpr": {
@ -557,6 +632,7 @@
} }
}, },
"x-go-skip": true, "x-go-skip": true,
"x-docs-skip": true,
"x-file": "when_expr.yaml" "x-file": "when_expr.yaml"
}, },
"FailureList": { "FailureList": {
@ -1174,12 +1250,14 @@
}, },
"type": "object", "type": "object",
"title": "StageCI", "title": "StageCI",
"x-docs-skip": false,
"x-docs-title": "stage.type.ci",
"x-file": "stage_ci.yaml" "x-file": "stage_ci.yaml"
}, },
"Cache": { "Cache": {
"title": "Cache", "title": "Cache",
"type": "object", "type": "object",
"description": "Cache defines caching behavior.", "description": "Cache defines pipeline caching behavior.",
"properties": { "properties": {
"enabled": { "enabled": {
"description": "Enabled enables cache intelligence.", "description": "Enabled enables cache intelligence.",
@ -1252,6 +1330,8 @@
"type": "boolean" "type": "boolean"
} }
}, },
"x-docs-skip": false,
"x-docs-title": "clone.stage",
"x-file": "clone_stage.yaml" "x-file": "clone_stage.yaml"
}, },
"Platform": { "Platform": {
@ -1260,19 +1340,46 @@
"type": "object", "type": "object",
"properties": { "properties": {
"arch": { "arch": {
"$ref": "#/definitions/Arch", "description": "Arch defines the target cpu architecture.",
"description": "Arch defines the target cpu architecture." "type": "string",
"enum": [
"amd64",
"arm",
"arm64",
"386",
"ppc",
"ppc64",
"ppc64le",
"riscv",
"riscv64",
"s390",
"s390x",
"sparc",
"sparc64"
]
}, },
"features": { "features": {
"description": "Features defines the target platform features.", "description": "Features defines the target platform features.",
"type": "array",
"items": { "items": {
"type": "string" "type": "string"
}, }
"type": "array"
}, },
"os": { "os": {
"$ref": "#/definitions/OS", "description": "OS defines the target operating system.",
"description": "OS defines the target operating system." "type": "string",
"enum": [
"linux",
"windows",
"macos",
"darwin",
"dragonfly",
"freebsd",
"netbsd",
"openbsd",
"plan9",
"solaris"
]
}, },
"variant": { "variant": {
"description": "Variant defines the target cpu architecture variant.", "description": "Variant defines the target cpu architecture variant.",
@ -1298,34 +1405,6 @@
], ],
"x-file": "platform.yaml" "x-file": "platform.yaml"
}, },
"Arch": {
"title": "Arch",
"type": "string",
"description": "List of cpu architectures.",
"enum": [
"amd64",
"arm",
"arm64",
"386",
"ppc",
"ppc64",
"ppc64le",
"riscv",
"riscv64",
"s390",
"s390x",
"sparc",
"sparc64"
],
"x-file": "enum_arch.yaml"
},
"OS": {
"title": "OS",
"type": "string",
"description": "List of operating systems.",
"enum": ["linux", "windows", "macos", "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9", "solaris"],
"x-file": "enum_os.yaml"
},
"Runtime": { "Runtime": {
"title": "Runtime", "title": "Runtime",
"description": "Defines the runtime execution engine.", "description": "Defines the runtime execution engine.",
@ -1559,6 +1638,7 @@
"barrier", "barrier",
"bitrise", "bitrise",
"script", "script",
"run",
"group", "group",
"parallel", "parallel",
"plugin", "plugin",
@ -1583,6 +1663,15 @@
"$ref": "#/definitions/FailureList" "$ref": "#/definitions/FailureList"
} }
}, },
"x-properties": {
"inputs": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-type": "map[string]interface{}"
}
},
"oneOf": [ "oneOf": [
{ {
"allOf": [ "allOf": [
@ -1674,6 +1763,24 @@
} }
] ]
}, },
{
"allOf": [
{
"properties": {
"type": {
"const": "run"
}
}
},
{
"properties": {
"spec": {
"$ref": "#/definitions/StepRun"
}
}
}
]
},
{ {
"allOf": [ "allOf": [
{ {
@ -1837,16 +1944,6 @@
"title": "StepBackground", "title": "StepBackground",
"type": "object", "type": "object",
"properties": { "properties": {
"image": {
"type": "string"
},
"user": {
"type": "string"
},
"pull": {
"type": "string",
"enum": ["always", "never", "if-not-exists"]
},
"shell": { "shell": {
"type": "string", "type": "string",
"enum": ["sh", "bash", "powershell", "pwsh"] "enum": ["sh", "bash", "powershell", "pwsh"]
@ -1859,41 +1956,257 @@
"description": "The step environment variables." "description": "The step environment variables."
}, },
"run": { "run": {
"type": "string" "type": "string",
"x-deprecate": true
}, },
"entrypoint": { "script": {
"type": "string" "anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "string"
}
]
}, },
"args": { "container": {
"type": "array", "$ref": "#/definitions/Container"
"items": {
"type": "string"
}
},
"ports": {
"type": "array",
"items": {
"type": "string"
}
},
"network": {
"type": "string"
},
"privileged": {
"type": "boolean"
},
"resources": {
"$ref": "#/definitions/Resources"
}, },
"mount": { "mount": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/Mount" "$ref": "#/definitions/Mount"
} }
},
"image": {
"type": "string",
"x-deprecate": true
},
"user": {
"type": "string",
"x-deprecate": true
},
"pull": {
"type": "string",
"enum": ["always", "never", "if-not-exists"],
"x-deprecate": true
},
"entrypoint": {
"type": "string",
"x-deprecate": true
},
"args": {
"type": "array",
"items": {
"type": "string"
},
"x-deprecate": true
},
"ports": {
"type": "array",
"items": {
"type": "string"
},
"x-deprecate": true
},
"network": {
"type": "string",
"x-deprecate": true
},
"privileged": {
"type": "boolean",
"x-deprecate": true
},
"resources": {
"$ref": "#/definitions/Resources",
"x-deprecate": true
},
"workdir": {
"type": "string",
"x-deprecate": true
} }
}, },
"x-file": "step_background.yaml" "x-file": "step_background.yaml"
}, },
"Container": {
"title": "Container",
"description": "Container configures step execution inside a container.",
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"image": {
"type": "string",
"description": "Container image."
},
"connector": {
"type": "string",
"description": "Connect used to authenticate to the registry."
},
"credentials": {
"$ref": "#/definitions/Credentials",
"description": "Credentials used to authenticate to the registry."
},
"pull": {
"type": "string",
"enum": ["always", "never", "if-not-exists"]
},
"entrypoint": {
"type": "string"
},
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"dns": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "string"
}
]
},
"dsn_search": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "string"
}
]
},
"extra_hosts": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "string"
}
]
},
"network": {
"type": "string"
},
"network_mode": {
"type": "string"
},
"privileged": {
"type": "boolean"
},
"workdir": {
"type": "string"
},
"ports": {
"type": "array",
"items": {
"type": "string"
}
},
"volumes": {
"type": "array",
"items": {
"type": "string"
}
},
"user": {
"type": "string"
},
"group": {
"type": "string"
},
"cpu": {
"type": ["string", "number"]
},
"memory": {
"format": "bytes",
"type": ["string", "number"]
},
"shm_size": {
"format": "bytes",
"type": ["string", "number"]
}
}
}
],
"x-go-skip": true,
"x-docs-title": "container",
"x-file": "container.yaml"
},
"Credentials": {
"type": "object",
"title": "Credentials",
"description": "Configures registry credentials.",
"properties": {
"username": {
"type": "string",
"description": "Username defines registry username."
},
"password": {
"type": "string",
"description": "Username defines registry password."
},
"aws": {
"$ref": "#/definitions/CredentialsAWS",
"description": "Configures registry credentials for AWS / EC2."
}
},
"examples": [
{
"credentials": {
"username": "${{ secrets.get(\"username\") }}",
"password": "${{ secrets.get(\"password\") }}"
}
},
{
"credentials": {
"aws": {
"access_key": "${{ secrets.get(\"access_key\") }}",
"secret_key": "${{ secrets.get(\"secret_key\") }}"
}
}
}
],
"x-docs-title": "credentials",
"x-file": "credentials.yaml"
},
"CredentialsAWS": {
"type": "object",
"title": "CredentialsAWS",
"description": "Configures AWS credentials.",
"properties": {
"access_key": {
"type": "string",
"description": "Provides the AWS access key"
},
"secret_key": {
"type": "string",
"description": "Provides the AWS secret key"
}
},
"x-docs-title": "credentials.aws",
"x-file": "credentials_aws.yaml"
},
"StepBarrier": { "StepBarrier": {
"title": "StepBarrier", "title": "StepBarrier",
"type": "object", "type": "object",
@ -2037,6 +2350,58 @@
"required": ["path", "type"], "required": ["path", "type"],
"x-file": "report.yaml" "x-file": "report.yaml"
}, },
"StepRun": {
"title": "StepRun",
"type": "object",
"properties": {
"shell": {
"type": "string",
"enum": ["sh", "bash", "powershell", "pwsh", "python"]
},
"script": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "string"
}
]
},
"container": {
"$ref": "#/definitions/Container"
},
"envs": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "The step environment variables."
},
"reports": {
"type": "array",
"items": {
"$ref": "#/definitions/Report"
}
},
"outputs": {
"type": "array",
"items": {
"type": "string"
}
},
"mount": {
"type": "array",
"items": {
"$ref": "#/definitions/Mount"
}
}
},
"x-file": "step_run.yaml"
},
"StepTest": { "StepTest": {
"title": "StepTest", "title": "StepTest",
"type": "object", "type": "object",
@ -2152,6 +2517,9 @@
"image": { "image": {
"type": "string" "type": "string"
}, },
"name": {
"type": "string"
},
"uses": { "uses": {
"type": "string" "type": "string"
}, },
@ -2190,6 +2558,13 @@
"with": { "with": {
"type": "object" "type": "object"
}, },
"inputs": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"x-go-type": "map[string]interface{}"
},
"outputs": { "outputs": {
"type": "array", "type": "array",
"items": { "items": {
@ -2219,8 +2594,9 @@
"inputs": { "inputs": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "object"
} },
"x-go-type": "map[string]interface{}"
}, },
"overlays": { "overlays": {
"type": "object" "type": "object"
@ -2429,6 +2805,7 @@
}, },
"type": "object", "type": "object",
"title": "StageCD", "title": "StageCD",
"x-docs-skip": true,
"x-file": "stage_cd.yaml" "x-file": "stage_cd.yaml"
}, },
"StageCustom": { "StageCustom": {
@ -2458,6 +2835,7 @@
}, },
"type": "object", "type": "object",
"title": "StageCustom", "title": "StageCustom",
"x-docs-skip": true,
"x-file": "stage_custom.yaml" "x-file": "stage_custom.yaml"
}, },
"StageInfra": { "StageInfra": {
@ -2500,12 +2878,14 @@
}, },
"type": "object", "type": "object",
"title": "StageInfra", "title": "StageInfra",
"x-docs-skip": true,
"x-docs-title": "stage.type.infra",
"x-file": "stage_infra.yaml" "x-file": "stage_infra.yaml"
}, },
"Clone": { "Clone": {
"title": "Clone", "title": "Clone",
"type": "object", "type": "object",
"description": "Clone defines the default clone behavior.", "description": "Clone defines the clone behavior.",
"properties": { "properties": {
"depth": { "depth": {
"description": "Depth defines the clone depth.", "description": "Depth defines the clone depth.",
@ -2533,6 +2913,8 @@
"description": "Reference defines the clone ref." "description": "Reference defines the clone ref."
} }
}, },
"x-docs-skip": false,
"x-docs-title": "clone",
"x-file": "clone.yaml" "x-file": "clone.yaml"
}, },
"Reference": { "Reference": {
@ -2583,28 +2965,177 @@
}, },
"type": "object", "type": "object",
"title": "StageFlag", "title": "StageFlag",
"x-docs-skip": true,
"x-file": "stage_flag.yaml" "x-file": "stage_flag.yaml"
}, },
"StageTemplate": { "StageTemplate": {
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
"description": "Template name." "description": "The template name."
}, },
"inputs": { "inputs": {
"type": "object", "type": "object",
"description": "The template inputs.",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "object"
} },
}, "x-go-type": "map[string]interface{}"
"overlays": {
"type": "object"
} }
}, },
"type": "object", "type": "object",
"title": "StageTemplate", "title": "StageTemplate",
"description": "Configures a Stage Template step.",
"examples": [
{
"type": "template",
"spec": {
"name": "deploy",
"inputs": {
"environment": "prod",
"region": "us-east"
}
}
}
],
"x-docs-skip": false,
"x-docs-title": "stage.type.template",
"x-file": "stage_template.yaml" "x-file": "stage_template.yaml"
}, },
"StageGroup": {
"properties": {
"stages": {
"description": "Configures a series of stages to execute.",
"items": {
"$ref": "#/definitions/Stage"
},
"type": "array"
}
},
"type": "object",
"title": "StageGroup",
"examples": [
{
"type": "group",
"spec": {
"stages": [
{
"type": "ci",
"spec": {
"steps": [
{
"type": "run",
"spec": {
"script": "go build",
"container": "golang"
}
},
{
"type": "run",
"spec": {
"script": "go test",
"container": "golang"
}
}
]
}
},
{
"type": "ci",
"spec": {
"steps": [
{
"type": "run",
"spec": {
"script": "npm install",
"container": "node"
}
},
{
"type": "run",
"spec": {
"script": "npm test",
"container": "node"
}
}
]
}
}
]
}
}
],
"x-docs-skip": false,
"x-docs-title": "stage.type.group",
"x-file": "stage_group.yaml"
},
"StageParallel": {
"properties": {
"stages": {
"description": "Configures a series of stages to execute in parallel.",
"items": {
"$ref": "#/definitions/Stage"
},
"type": "array"
}
},
"type": "object",
"title": "StageParallel",
"x-docs-skip": false,
"x-docs-title": "stage.type.parallel",
"examples": [
{
"type": "parallel",
"spec": {
"stages": [
{
"type": "ci",
"spec": {
"steps": [
{
"type": "run",
"spec": {
"script": "go build",
"container": "golang"
}
},
{
"type": "run",
"spec": {
"script": "go test",
"container": "golang"
}
}
]
}
},
{
"type": "ci",
"spec": {
"steps": [
{
"type": "run",
"spec": {
"script": "npm install",
"container": "node"
}
},
{
"type": "run",
"spec": {
"script": "npm test",
"container": "node"
}
}
]
}
}
]
}
}
],
"x-file": "stage_parallel.yaml"
},
"Input": { "Input": {
"title": "Input", "title": "Input",
"type": "object", "type": "object",
@ -2620,7 +3151,8 @@
"description": "Desc defines the input description." "description": "Desc defines the input description."
}, },
"default": { "default": {
"type": ["string", "number", "boolean", "array", "object"] "type": ["string", "number", "boolean", "array", "object"],
"x-go-type": "interface{}"
}, },
"required": { "required": {
"type": "boolean", "type": "boolean",
@ -2843,6 +3375,7 @@
"type": "string" "type": "string"
} }
}, },
"x-docs-skip": true,
"x-file": "barrier.yaml" "x-file": "barrier.yaml"
}, },
"Status": { "Status": {