1
This commit is contained in:
parent
fa4b146693
commit
d76517beb2
@ -1,7 +1,10 @@
|
|||||||
package com.qqchen.deploy.backend.deploy.dto.variables;
|
package com.qqchen.deploy.backend.deploy.dto.variables;
|
||||||
|
|
||||||
|
import com.qqchen.deploy.backend.workflow.annotation.SchemaProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jenkins构建变量
|
* Jenkins构建变量
|
||||||
*/
|
*/
|
||||||
@ -9,4 +12,53 @@ import lombok.Data;
|
|||||||
public class JenkinsJavaBuildVariables extends JenkinsBaseBuildVariables {
|
public class JenkinsJavaBuildVariables extends JenkinsBaseBuildVariables {
|
||||||
|
|
||||||
|
|
||||||
|
@SchemaProperty(
|
||||||
|
title = "脚本代码",
|
||||||
|
description = "脚本代码",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private String script;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 脚本语言
|
||||||
|
*/
|
||||||
|
@SchemaProperty(
|
||||||
|
title = "脚本语言",
|
||||||
|
description = "脚本语言类型",
|
||||||
|
required = true,
|
||||||
|
enumValues = {"shell", "python", "javascript", "groovy"},
|
||||||
|
enumNames = {"Shell脚本 (已支持)", "Python脚本 (开发中)", "JavaScript脚本 (开发中)", "Groovy脚本 (开发中)"},
|
||||||
|
defaultValue = "shell"
|
||||||
|
)
|
||||||
|
private String language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解释器路径
|
||||||
|
*/
|
||||||
|
@SchemaProperty(
|
||||||
|
title = "解释器路径",
|
||||||
|
description = "脚本解释器的路径,例如:/bin/bash, /usr/bin/python3",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private String interpreter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功退出码
|
||||||
|
*/
|
||||||
|
@SchemaProperty(
|
||||||
|
title = "成功标识",
|
||||||
|
description = "脚本执行成功时的标识",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
private Integer successExitCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支持的脚本语言列表
|
||||||
|
*/
|
||||||
|
@SchemaProperty(
|
||||||
|
title = "支持的脚本语言",
|
||||||
|
enumValues = {"shell", "python", "javascript", "groovy"},
|
||||||
|
enumNames = {"Shell脚本 (已支持)", "Python脚本 (开发中)", "JavaScript脚本 (开发中)", "Groovy脚本 (开发中)"}
|
||||||
|
)
|
||||||
|
private List<String> supportedLanguages;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,8 @@ public class ScriptNodePanelVariables extends BaseNodePanelVariables {
|
|||||||
*/
|
*/
|
||||||
@SchemaProperty(
|
@SchemaProperty(
|
||||||
title = "支持的脚本语言",
|
title = "支持的脚本语言",
|
||||||
enumValues = {"shell", "python", "javascript", "groovy"}
|
enumValues = {"shell", "python", "javascript", "groovy"},
|
||||||
|
enumNames = {"Shell脚本 (已支持)", "Python脚本 (开发中)", "JavaScript脚本 (开发中)", "Groovy脚本 (开发中)"}
|
||||||
)
|
)
|
||||||
private List<String> supportedLanguages;
|
private List<String> supportedLanguages;
|
||||||
|
|
||||||
|
|||||||
@ -79,8 +79,29 @@ public class GenerateSchemaUtils {
|
|||||||
if (List.class.isAssignableFrom(field.getType())) {
|
if (List.class.isAssignableFrom(field.getType())) {
|
||||||
ObjectNode items = property.putObject("items");
|
ObjectNode items = property.putObject("items");
|
||||||
items.put("type", "string");
|
items.put("type", "string");
|
||||||
|
|
||||||
|
// 如果有枚举值定义,则在items中设置枚举相关属性
|
||||||
|
if (annotation.enumValues().length > 0) {
|
||||||
|
// 在items中设置enum
|
||||||
|
ArrayNode enumNode = items.putArray("enum");
|
||||||
|
for (String value : annotation.enumValues()) {
|
||||||
|
enumNode.add(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在items中设置enumNames
|
||||||
|
if (annotation.enumNames().length > 0) {
|
||||||
|
ArrayNode enumNamesNode = items.putArray("enumNames");
|
||||||
|
for (String name : annotation.enumNames()) {
|
||||||
|
enumNamesNode.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保不在顶层定义enum和enumNames
|
||||||
|
property.remove("enum");
|
||||||
|
property.remove("enumNames");
|
||||||
|
|
||||||
// 处理Map类型
|
// 处理Map类型
|
||||||
if (Map.class.isAssignableFrom(field.getType())) {
|
if (Map.class.isAssignableFrom(field.getType())) {
|
||||||
ObjectNode additionalProperties = property.putObject("additionalProperties");
|
ObjectNode additionalProperties = property.putObject("additionalProperties");
|
||||||
@ -129,7 +150,7 @@ public class GenerateSchemaUtils {
|
|||||||
dataSourceNode.put("valueField", dataSource.valueField());
|
dataSourceNode.put("valueField", dataSource.valueField());
|
||||||
dataSourceNode.put("labelField", dataSource.labelField());
|
dataSourceNode.put("labelField", dataSource.labelField());
|
||||||
|
|
||||||
// 处理依赖字段
|
// <EFBFBD><EFBFBD><EFBFBD>理依赖字段
|
||||||
String[] dependsOn = dataSource.dependsOn();
|
String[] dependsOn = dataSource.dependsOn();
|
||||||
if (dependsOn != null && dependsOn.length > 0) {
|
if (dependsOn != null && dependsOn.length > 0) {
|
||||||
ArrayNode dependsOnNode = dataSourceNode.putArray("dependsOn");
|
ArrayNode dependsOnNode = dataSourceNode.putArray("dependsOn");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user