mirror of https://github.com/certd/certd
parent
46a1b74799
commit
87853a2015
|
@ -67,6 +67,7 @@ export abstract class CertApplyBaseConvertPlugin extends AbstractTaskPlugin {
|
||||||
|
|
||||||
@TaskOutput({
|
@TaskOutput({
|
||||||
title: "域名证书",
|
title: "域名证书",
|
||||||
|
type: "cert",
|
||||||
})
|
})
|
||||||
cert?: CertInfo;
|
cert?: CertInfo;
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ export class CertApplyUploadPlugin extends CertApplyBaseConvertPlugin {
|
||||||
|
|
||||||
@TaskOutput({
|
@TaskOutput({
|
||||||
title: "证书MD5",
|
title: "证书MD5",
|
||||||
|
type: "certMd5",
|
||||||
})
|
})
|
||||||
certMd5?: string;
|
certMd5?: string;
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@ export { EVENT_CERT_APPLY_SUCCESS } from "./cert-plugin/base-convert.js";
|
||||||
export * from "./cert-plugin/index.js";
|
export * from "./cert-plugin/index.js";
|
||||||
export * from "./cert-plugin/lego/index.js";
|
export * from "./cert-plugin/lego/index.js";
|
||||||
export * from "./cert-plugin/custom/index.js";
|
export * from "./cert-plugin/custom/index.js";
|
||||||
export const CertApplyPluginNames = ["CertApply", "CertApplyLego", "CertApplyUpload"];
|
export const CertApplyPluginNames = [":cert:"];
|
||||||
|
|
|
@ -54,8 +54,9 @@ function getDomainFromPipeline(inputKey: string) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CertApplyPluginNames.includes(certStep.type)) {
|
const firstLevelValue = certStep.input.cert;
|
||||||
targetStepId = getStepIdFromInputKey(certStep.input?.cert);
|
if (firstLevelValue && typeof firstLevelValue === "string" && firstLevelValue.indexOf(".") > 0) {
|
||||||
|
targetStepId = getStepIdFromInputKey(firstLevelValue);
|
||||||
certStep = findStepFromPipeline(targetStepId);
|
certStep = findStepFromPipeline(targetStepId);
|
||||||
if (!certStep) {
|
if (!certStep) {
|
||||||
errorRef.value = "找不到目标步骤,请先选择域名证书";
|
errorRef.value = "找不到目标步骤,请先选择域名证书";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { inject, onMounted, Ref, ref, watch } from "vue";
|
import { inject, onMounted, Ref, ref, watch } from "vue";
|
||||||
|
import { usePluginStore } from "/@/store/plugin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OutputSelector",
|
name: "OutputSelector",
|
||||||
|
@ -27,10 +28,11 @@ export default {
|
||||||
const currentStepIndex = inject("currentStepIndex") as Ref<number>;
|
const currentStepIndex = inject("currentStepIndex") as Ref<number>;
|
||||||
const currentTask = inject("currentTask") as Ref<any>;
|
const currentTask = inject("currentTask") as Ref<any>;
|
||||||
|
|
||||||
const getPluginGroups = inject("getPluginGroups") as any;
|
const pluginStore = usePluginStore();
|
||||||
const pluginGroups = getPluginGroups();
|
|
||||||
function onCreate() {
|
async function onCreate() {
|
||||||
options.value = pluginGroups.getPreStepOutputOptions({
|
await pluginStore.init();
|
||||||
|
options.value = pluginStore.group.getPreStepOutputOptions({
|
||||||
pipeline: pipeline.value,
|
pipeline: pipeline.value,
|
||||||
currentStageIndex: currentStageIndex.value,
|
currentStageIndex: currentStageIndex.value,
|
||||||
currentTaskIndex: currentTaskIndex.value,
|
currentTaskIndex: currentTaskIndex.value,
|
||||||
|
@ -38,11 +40,38 @@ export default {
|
||||||
currentTask: currentTask.value,
|
currentTask: currentTask.value,
|
||||||
});
|
});
|
||||||
if (props.from) {
|
if (props.from) {
|
||||||
|
let froms = [];
|
||||||
if (typeof props.from === "string") {
|
if (typeof props.from === "string") {
|
||||||
options.value = options.value.filter((item: any) => item.type === props.from);
|
froms = [props.from];
|
||||||
} else {
|
} else {
|
||||||
options.value = options.value.filter((item: any) => props.from.includes(item.type));
|
froms = props.from;
|
||||||
}
|
}
|
||||||
|
function match(from: string, item: any) {
|
||||||
|
// pluginType:valueType:keyName
|
||||||
|
if (from.includes(":")) {
|
||||||
|
const [pluginType, valueType, keyName] = from.split(":");
|
||||||
|
if (pluginType && item.type !== pluginType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (valueType && item.valueType !== valueType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (keyName && item.key !== keyName) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return item.type === from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options.value = options.value.filter((item: any) => {
|
||||||
|
for (const from of froms) {
|
||||||
|
if (match(from, item)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.modelValue != null) {
|
if (props.modelValue != null) {
|
||||||
|
@ -55,19 +84,10 @@ export default {
|
||||||
ctx.emit("update:modelValue", value);
|
ctx.emit("update:modelValue", value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
onCreate();
|
await onCreate();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
() => {
|
|
||||||
return pluginGroups.value?.map;
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
onCreate();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
function onChanged(value: any) {
|
function onChanged(value: any) {
|
||||||
ctx.emit("update:modelValue", value);
|
ctx.emit("update:modelValue", value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const CertApplyPluginNames = ["CertApply", "CertApplyLego", "CertApplyUpload"];
|
export const CertApplyPluginNames = [":cert:"];
|
||||||
|
|
|
@ -87,10 +87,13 @@ export class PluginGroups {
|
||||||
for (const step of steps) {
|
for (const step of steps) {
|
||||||
const stepDefine = this.get(step.type);
|
const stepDefine = this.get(step.type);
|
||||||
for (const key in stepDefine?.output) {
|
for (const key in stepDefine?.output) {
|
||||||
|
const inputDefine = stepDefine.output[key];
|
||||||
options.push({
|
options.push({
|
||||||
value: `step.${step.id}.${key}`,
|
value: `step.${step.id}.${key}`,
|
||||||
label: `${stepDefine.output[key].title}【from:${step.title}】`,
|
label: `${inputDefine.title}【from:${step.title}】`,
|
||||||
type: step.type,
|
type: step.type,
|
||||||
|
valueType: inputDefine.type,
|
||||||
|
key: key,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,7 +299,7 @@ import { useSettingStore } from "/@/store/settings";
|
||||||
import { useUserStore } from "/@/store/user";
|
import { useUserStore } from "/@/store/user";
|
||||||
import TaskShortcuts from "./component/shortcut/task-shortcuts.vue";
|
import TaskShortcuts from "./component/shortcut/task-shortcuts.vue";
|
||||||
import { eachSteps, findStep } from "../utils";
|
import { eachSteps, findStep } from "../utils";
|
||||||
import { PluginGroups } from "/@/store/plugin";
|
import { PluginGroups, usePluginStore } from "/@/store/plugin";
|
||||||
import { getCronNextTimes } from "/@/components/cron-editor/utils";
|
import { getCronNextTimes } from "/@/components/cron-editor/utils";
|
||||||
import { useCertViewer } from "/@/views/certd/pipeline/use";
|
import { useCertViewer } from "/@/views/certd/pipeline/use";
|
||||||
|
|
||||||
|
@ -494,16 +494,15 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const pluginGroupsRef: Ref<PluginGroups> = ref();
|
const pluginStore = usePluginStore();
|
||||||
|
|
||||||
const fetchPlugins = async () => {
|
const fetchPlugins = async () => {
|
||||||
pluginGroupsRef.value = await props.options.getPluginGroups();
|
await pluginStore.init();
|
||||||
};
|
};
|
||||||
fetchPlugins();
|
fetchPlugins();
|
||||||
|
|
||||||
provide("pipeline", pipeline);
|
provide("pipeline", pipeline);
|
||||||
provide("getPluginGroups", () => {
|
provide("getPluginGroups", () => {
|
||||||
return pluginGroupsRef.value;
|
return pluginStore.group;
|
||||||
});
|
});
|
||||||
provide("currentHistory", currentHistory);
|
provide("currentHistory", currentHistory);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export function getDefaultDeployPlugin() {
|
||||||
let certApplyNames = ''
|
let certApplyNames = ''
|
||||||
for (const name of CertApplyPluginNames) {
|
for (const name of CertApplyPluginNames) {
|
||||||
certApplyNames += `
|
certApplyNames += `
|
||||||
- ${name}`
|
- "${name}"`
|
||||||
}
|
}
|
||||||
const metadata =`
|
const metadata =`
|
||||||
input: # 插件的输入参数
|
input: # 插件的输入参数
|
||||||
|
|
|
@ -26,7 +26,7 @@ const regionDict = [
|
||||||
title: '阿里云-上传证书到阿里云',
|
title: '阿里云-上传证书到阿里云',
|
||||||
icon: 'svg:icon-aliyun',
|
icon: 'svg:icon-aliyun',
|
||||||
group: pluginGroups.aliyun.key,
|
group: pluginGroups.aliyun.key,
|
||||||
desc: '如果不想在阿里云上同一份证书上传多次,可以把此任务作为前置任务,其他阿里云任务证书那一项选择此任务的输出',
|
desc: '上传证书到阿里云数字证书管理服务(CAS),注意:不会部署到任何应用上;如果不想在阿里云上同一份证书上传多次,可以把此任务作为前置任务,其他阿里云任务证书那一项选择此任务的输出',
|
||||||
default: {
|
default: {
|
||||||
strategy: {
|
strategy: {
|
||||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||||
|
|
Loading…
Reference in New Issue