增加脚本适配工厂
This commit is contained in:
parent
048d53855c
commit
8155dc3eb9
@ -296,67 +296,28 @@ true, NOW(), 'system', NOW(), 'system', 1, false),
|
|||||||
true, NOW(), 'system', NOW(), 'system', 1, false),
|
true, NOW(), 'system', NOW(), 'system', 1, false),
|
||||||
|
|
||||||
-- 任务节点类型
|
-- 任务节点类型
|
||||||
(2003, 'SCRIPT', '脚本执行节点', '执行各种脚本语言的节点', 'TASK', 'code', '#13c2c2',
|
(2003, 'SHELL', 'Shell脚本节点', '执行Shell脚本的任务节点', 'TASK', 'code', '#1890ff',
|
||||||
'[{
|
'[{
|
||||||
"code": "SCRIPT",
|
"code": "SHELL",
|
||||||
"name": "脚本执行器",
|
"name": "Shell脚本执行器",
|
||||||
"description": "支持执行多种脚本语言(Shell、Python、JavaScript等)",
|
"description": "执行Shell脚本,支持配置超时时间和工作目录",
|
||||||
"supportedLanguages": ["shell"],
|
|
||||||
"configSchema": {
|
"configSchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["name", "script", "language"],
|
"required": ["script"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "节点名称",
|
|
||||||
"minLength": 1,
|
|
||||||
"maxLength": 50
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "节点描述",
|
|
||||||
"maxLength": 200
|
|
||||||
},
|
|
||||||
"script": {
|
"script": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "脚本内容",
|
"title": "脚本内容",
|
||||||
"format": "script",
|
"format": "shell",
|
||||||
"description": "需要执行的脚本内容"
|
"description": "需要执行的Shell脚本内容"
|
||||||
},
|
},
|
||||||
"language": {
|
"timeout": {
|
||||||
"type": "string",
|
"type": "number",
|
||||||
"title": "脚本语言",
|
"title": "超时时间",
|
||||||
"enum": ["shell", "python", "javascript", "groovy"],
|
"description": "脚本执行的最大时间(秒)",
|
||||||
"enumNames": ["Shell脚本 (已支持)", "Python脚本 (开发中)", "JavaScript脚本 (开发中)", "Groovy脚本 (开发中)"],
|
"minimum": 1,
|
||||||
"default": "shell",
|
"maximum": 3600,
|
||||||
"description": "脚本语言类型",
|
"default": 300
|
||||||
"oneOf": [
|
|
||||||
{
|
|
||||||
"const": "shell",
|
|
||||||
"title": "Shell脚本"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"const": "python",
|
|
||||||
"title": "Python脚本",
|
|
||||||
"readOnly": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"const": "javascript",
|
|
||||||
"title": "JavaScript脚本",
|
|
||||||
"readOnly": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"const": "groovy",
|
|
||||||
"title": "Groovy脚本",
|
|
||||||
"readOnly": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"interpreter": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "解释器路径",
|
|
||||||
"description": "脚本解释器的路径,例如:/bin/bash, /usr/bin/python3",
|
|
||||||
"default": "/bin/bash"
|
|
||||||
},
|
},
|
||||||
"workingDirectory": {
|
"workingDirectory": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -364,26 +325,30 @@ true, NOW(), 'system', NOW(), 'system', 1, false),
|
|||||||
"description": "脚本执行的工作目录",
|
"description": "脚本执行的工作目录",
|
||||||
"default": "/tmp"
|
"default": "/tmp"
|
||||||
},
|
},
|
||||||
"timeout": {
|
"retryTimes": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"title": "超时时间",
|
"title": "重试次数",
|
||||||
"description": "脚本执行的最大时间(秒)",
|
"minimum": 0,
|
||||||
|
"maximum": 10,
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"retryInterval": {
|
||||||
|
"type": "number",
|
||||||
|
"title": "重试间隔(秒)",
|
||||||
"minimum": 1,
|
"minimum": 1,
|
||||||
"maximum": 3600,
|
"maximum": 3600,
|
||||||
"default": 300
|
"default": 60
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "环境变量",
|
"title": "环境变量",
|
||||||
"description": "脚本执行时的环境变量",
|
"description": "脚本执行时的环境变量",
|
||||||
"additionalProperties": {
|
"additionalProperties": {"type": "string"}
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"successExitCode": {
|
"successExitCode": {
|
||||||
"type": "integer",
|
"type": "number",
|
||||||
"title": "成功退出码",
|
"title": "成功退出码",
|
||||||
"description": "脚本执行成功时的退出码",
|
"description": "脚本执行成功的退出码",
|
||||||
"default": 0
|
"default": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +356,6 @@ true, NOW(), 'system', NOW(), 'system', 1, false),
|
|||||||
}]',
|
}]',
|
||||||
'{
|
'{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["name", "script", "language"],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -404,57 +368,16 @@ true, NOW(), 'system', NOW(), 'system', 1, false),
|
|||||||
"title": "节点描述",
|
"title": "节点描述",
|
||||||
"maxLength": 200
|
"maxLength": 200
|
||||||
},
|
},
|
||||||
"script": {
|
"executor": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "脚本内容",
|
"title": "执行器",
|
||||||
"format": "script",
|
"enum": ["SHELL"],
|
||||||
"description": "需要执行的脚本内容"
|
"enumNames": ["Shell脚本执行器"]
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "脚本语言",
|
|
||||||
"enum": ["shell", "python", "javascript", "groovy"],
|
|
||||||
"enumNames": ["Shell脚本 (已支持)", "Python脚本 (开发中)", "JavaScript脚本 (开发中)", "Groovy脚本 (开发中)"],
|
|
||||||
"default": "shell",
|
|
||||||
"description": "脚本语言类型"
|
|
||||||
},
|
|
||||||
"interpreter": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "解释器路径",
|
|
||||||
"description": "脚本解释器的路径,例如:/bin/bash, /usr/bin/python3",
|
|
||||||
"default": "/bin/bash"
|
|
||||||
},
|
|
||||||
"workingDirectory": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "工作目录",
|
|
||||||
"description": "脚本执行的工作目录",
|
|
||||||
"default": "/tmp"
|
|
||||||
},
|
|
||||||
"timeout": {
|
|
||||||
"type": "integer",
|
|
||||||
"title": "超时时间",
|
|
||||||
"description": "脚本执行的最大时间(秒)",
|
|
||||||
"minimum": 1,
|
|
||||||
"maximum": 3600,
|
|
||||||
"default": 300
|
|
||||||
},
|
|
||||||
"environment": {
|
|
||||||
"type": "object",
|
|
||||||
"title": "环境变量",
|
|
||||||
"description": "脚本执行时的环境变量",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"successExitCode": {
|
|
||||||
"type": "integer",
|
|
||||||
"title": "成功退出码",
|
|
||||||
"description": "脚本执行成功时的退出码",
|
|
||||||
"default": 0
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"required": ["name", "executor"]
|
||||||
}',
|
}',
|
||||||
'{"name": "脚本执行", "language": "shell", "script": "echo \"Hello World\""}',
|
'{"name": "Shell脚本", "executor": "SHELL"}',
|
||||||
true, NOW(), 'system', NOW(), 'system', 1, false),
|
true, NOW(), 'system', NOW(), 'system', 1, false),
|
||||||
|
|
||||||
-- Git节点类型
|
-- Git节点类型
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user