perf: 优化成功后跳过的提示

pull/148/head
xiaojunnuo 2024-08-13 20:30:42 +08:00
parent ffc4e71783
commit 7b451bbf6e
33 changed files with 151 additions and 252 deletions

View File

@ -6,7 +6,7 @@ import { IAccessService } from "../access/index.js";
import { IEmailService } from "../service/index.js";
import { IContext } from "../core/index.js";
import { AxiosInstance } from "axios";
import { logger } from "../utils/index.js";
import { ILogger, logger } from "../utils/index.js";
export enum ContextScope {
global,
@ -69,6 +69,9 @@ export type TaskInstanceContext = {
export abstract class AbstractTaskPlugin implements ITaskPlugin {
_result: TaskResult = { clearLastStatus: false, files: [], pipelineVars: {} };
ctx!: TaskInstanceContext;
logger!: ILogger;
accessService!: IAccessService;
clearLastStatus() {
this._result.clearLastStatus = true;
}
@ -79,6 +82,8 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
setCtx(ctx: TaskInstanceContext) {
this.ctx = ctx;
this.logger = ctx.logger;
this.accessService = ctx.accessService;
}
randomFileId() {

View File

@ -1,7 +1,6 @@
import { AbstractTaskPlugin, HttpClient, IAccessService, IContext, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import { AbstractTaskPlugin, HttpClient, IContext, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import dayjs from "dayjs";
import type { CertInfo } from "./acme.js";
import { Logger } from "log4js";
import { CertReader } from "./cert-reader.js";
import JSZip from "jszip";
@ -91,9 +90,7 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
// })
csrInfo!: string;
logger!: Logger;
userContext!: IContext;
accessService!: IAccessService;
http!: HttpClient;
lastStatus!: Step;
@ -103,8 +100,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
cert?: CertInfo;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
this.userContext = this.ctx.userContext;
this.http = this.ctx.http;
this.lastStatus = this.ctx.lastStatus as Step;

View File

@ -23,7 +23,7 @@ export default {
const currentStepIndex = inject("currentStepIndex") as Ref<number>;
const currentTask = inject("currentTask") as Ref<any>;
const getPluginGroups = inject("getPluginGroups") as Ref<any>;
const getPluginGroups = inject("getPluginGroups") as any;
const pluginGroups = getPluginGroups();
function onCreate() {
options.value = pluginGroups.getPreStepOutputOptions({
@ -42,7 +42,7 @@ export default {
watch(
() => {
return pluginGroups.value.map;
return pluginGroups.value?.map;
},
() => {
onCreate();

View File

@ -61,24 +61,7 @@
<fs-form-item v-model="currentStep.input[key]" :item="item" :get-context-fn="blankFn" />
</template>
<fs-form-item
v-model="currentStep.strategy.runStrategy"
:item="{
title: '运行策略',
key: 'strategy.runStrategy',
component: {
name: 'a-select',
vModel: 'value',
options: [
{ value: 0, label: '正常运行(证书申请任务请选择它)' },
{ value: 1, label: '成功后跳过(非证书任务请选择它)' }
]
},
helper: '该任务运行成功一次之后下次运行是否跳过,保持默认即可',
rules: [{ required: true, message: '此项必填' }]
}"
:get-context-fn="blankFn"
/>
<fs-form-item v-model="currentStep.strategy.runStrategy" :item="runStrategyProps" :get-context-fn="blankFn" />
</a-form>
<template #footer>
@ -289,10 +272,36 @@ export default {
};
}
const runStrategyProps = ref({
title: "运行策略",
key: "strategy.runStrategy",
component: {
name: "a-select",
vModel: "value",
options: [
{ value: 0, label: "正常运行(证书申请任务请选择它)" },
{ value: 1, label: "成功后跳过(非证书任务请选择它)" }
]
},
helper: {
render: () => {
return (
<div>
<div>正常运行每次都运行证书任务需要每次都运行</div>
<div>成功后跳过在证书没变化时该任务成功一次之后跳过不重复部署</div>
<div>保持默认即可如果你想要再次测试部署可以临时设置为正常运行</div>
</div>
);
}
},
rules: [{ required: true, message: "此项必填" }]
});
return {
...useStepForm(),
labelCol: { span: 6 },
wrapperCol: { span: 16 }
wrapperCol: { span: 16 },
runStrategyProps
};
}
};

View File

@ -1,6 +1,3 @@
koa:
port: 7001
flyway:
scriptDir: './db/migration-pg'

View File

@ -1,2 +1,2 @@
koa:
port: 7001
preview:
enabled: true

View File

@ -1,2 +1,8 @@
koa:
port: 7001
preview:
enabled: false
typeorm:
dataSource:
default:
logging: false

View File

@ -38,7 +38,10 @@ const development = {
},
},
cron: {
//启动时立即触发一次
immediateTriggerOnce: false,
//启动时仅注册adminid=1用户的
onlyAdminUser: false,
},
/**
*

View File

@ -1,21 +0,0 @@
import { MidwayConfig } from '@midwayjs/core';
import { mergeConfig } from './loader.js';
const preview = {
/**
*
*/
preview: {
enabled: true,
},
typeorm: {
dataSource: {
default: {
logging: false,
},
},
},
} as MidwayConfig;
mergeConfig(preview, 'preview');
export default preview;

View File

@ -1,21 +0,0 @@
import { MidwayConfig } from '@midwayjs/core';
import { mergeConfig } from './loader.js';
const production = {
/**
*
*/
preview: {
enabled: false,
},
typeorm: {
dataSource: {
default: {
logging: false,
},
},
},
} as MidwayConfig;
mergeConfig(production, 'production');
export default production;

View File

@ -1,11 +0,0 @@
import { MidwayConfig } from '@midwayjs/core';
export default {
typeorm: {
dataSource: {
default: {
synchronize: true, // 如果第一次使用,不存在表,有同步的需求可以写 true
},
},
},
} as MidwayConfig;

View File

@ -1,7 +0,0 @@
import { MidwayConfig } from '@midwayjs/core';
export default {
koa: {
port: null,
},
} as MidwayConfig;

View File

@ -1,4 +1,4 @@
import { Configuration, App } from '@midwayjs/core';
import { App, Configuration } from '@midwayjs/core';
import * as koa from '@midwayjs/koa';
import * as orm from '@midwayjs/typeorm';
import * as cache from '@midwayjs/cache';
@ -14,12 +14,7 @@ import { PreviewMiddleware } from './middleware/preview.js';
import { AuthorityMiddleware } from './middleware/authority.js';
import { logger } from './utils/logger.js';
import { ResetPasswdMiddleware } from './middleware/reset-passwd/middleware.js';
// import { DefaultErrorFilter } from './filter/default.filter.js';
// import { NotFoundFilter } from './filter/notfound.filter.js';
import DefaultConfig from './config/config.default.js';
import ProductionConfig from './config/config.production.js';
import PreviewConfig from './config/config.preview.js';
import UnittestConfig from './config/config.unittest.js';
process.on('uncaughtException', error => {
console.error('未捕获的异常:', error);
@ -43,9 +38,6 @@ process.on('uncaughtException', error => {
importConfigs: [
{
default: DefaultConfig,
preview: PreviewConfig,
production: ProductionConfig,
unittest: UnittestConfig,
},
],
})

View File

@ -1,12 +1,4 @@
import {
Provide,
Controller,
Post,
Inject,
Body,
Query,
ALL,
} from '@midwayjs/core';
import { Provide, Controller, Post, Inject, Body, Query, ALL } from '@midwayjs/core';
import { UserService } from '../service/user-service.js';
import { CrudController } from '../../../basic/crud-controller.js';
import { RoleService } from '../service/role-service.js';

View File

@ -191,4 +191,17 @@ export class UserService extends BaseService<UserEntity> {
};
await this.update(param);
}
async delete(ids: any) {
if (typeof ids === 'string') {
ids = ids.split(',');
ids = ids.map(id => parseInt(id));
}
if (ids instanceof Array) {
if (ids.includes(1)) {
throw new CommonException('不能删除管理员');
}
}
await super.delete(ids);
}
}

View File

@ -8,8 +8,8 @@ export class AutoRegisterCron {
@Inject()
pipelineService: PipelineService;
@Config('preview.enabled')
private preview: boolean;
@Config('cron.onlyAdminUser')
private onlyAdminUser: boolean;
// @Inject()
// echoPlugin: EchoPlugin;
@ -19,7 +19,7 @@ export class AutoRegisterCron {
@Init()
async init() {
logger.info('加载定时trigger开始');
await this.pipelineService.onStartup(this.immediateTriggerOnce, this.preview);
await this.pipelineService.onStartup(this.immediateTriggerOnce, this.onlyAdminUser);
// logger.info(this.echoPlugin, this.echoPlugin.test);
// logger.info('加载定时trigger完成');
//

View File

@ -136,10 +136,13 @@ export class HistoryService extends BaseService<HistoryEntity> {
}
async deleteByIds(ids: number[], userId: number) {
await this.repository.delete({
const condition: any = {
id: In(ids),
userId,
});
};
if (userId != null) {
condition.userId = userId;
}
await this.repository.delete(condition);
await this.logService.deleteByHistoryIds(ids);
}

View File

@ -149,10 +149,10 @@ export class PipelineService extends BaseService<PipelineEntity> {
/**
*
*/
async onStartup(immediateTriggerOnce: boolean, preview: boolean) {
async onStartup(immediateTriggerOnce: boolean, onlyAdminUser: boolean) {
logger.info('加载定时trigger开始');
await this.foreachPipeline(async entity => {
if (preview && entity.userId !== 1) {
if (onlyAdminUser && entity.userId !== 1) {
return;
}
const pipeline = JSON.parse(entity.content ?? '{}');

View File

@ -11,8 +11,7 @@ export class AliyunAccess {
component: {
placeholder: 'accessKeyId',
},
helper:
'注意证书申请需要dns解析权限其他阿里云插件也需要对应的权限比如证书上传需要证书管理权限',
helper: '注意证书申请需要dns解析权限其他阿里云插件也需要对应的权限比如证书上传需要证书管理权限',
required: true,
})
accessKeyId = '';

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
// @ts-ignore
import { ROAClient } from '@alicloud/pop-core';
import { AliyunAccess } from '../../access/index.js';
@ -106,13 +106,7 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
})
accessId!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance(): Promise<void> {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance(): Promise<void> {}
async execute(): Promise<void> {
console.log('开始部署证书到阿里云cdn');
const { regionId, ingressClass, clusterId, isPrivateIpAddress, cert } = this;
@ -121,7 +115,7 @@ export class DeployCertToAliyunAckIngressPlugin extends AbstractTaskPlugin {
const kubeConfigStr = await this.getKubeConfig(client, clusterId, isPrivateIpAddress);
this.logger.info('kubeconfig已成功获取');
const k8sClient = new K8sClient(kubeConfigStr,this.logger);
const k8sClient = new K8sClient(kubeConfigStr, this.logger);
const ingressType = ingressClass || 'qcloud';
if (ingressType === 'qcloud') {
throw new Error('暂未实现');

View File

@ -1,11 +1,4 @@
import {
AbstractTaskPlugin,
IAccessService,
ILogger,
IsTaskPlugin, pluginGroups,
RunStrategy,
TaskInput,
} from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import dayjs from 'dayjs';
import Core from '@alicloud/pop-core';
import RPCClient from '@alicloud/pop-core';
@ -57,18 +50,10 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
})
accessId!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
console.log('开始部署证书到阿里云cdn');
const access = (await this.accessService.getById(
this.accessId
)) as AliyunAccess;
const access = (await this.accessService.getById(this.accessId)) as AliyunAccess;
const client = this.getClient(access);
const params = await this.buildParams();
await this.doRequest(client, params);
@ -85,8 +70,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
}
async buildParams() {
const CertName =
(this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss');
const CertName = (this.certName ?? 'certd') + '-' + dayjs().format('YYYYMMDDHHmmss');
const cert: any = this.cert;
return {
RegionId: 'cn-hangzhou',
@ -103,11 +87,7 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
const requestOption = {
method: 'POST',
};
const ret: any = await client.request(
'SetDomainServerCertificate',
params,
requestOption
);
const ret: any = await client.request('SetDomainServerCertificate', params, requestOption);
this.checkRet(ret);
this.logger.info('设置cdn证书成功:', ret.RequestId);
}

View File

@ -1,8 +1,7 @@
import { AbstractTaskPlugin, IAccessService, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import Core from '@alicloud/pop-core';
import { AliyunAccess } from '../../access/index.js';
import { appendTimeSuffix, checkRet, ZoneOptions } from '../../utils/index.js';
import { Logger } from 'log4js';
@IsTaskPlugin({
name: 'uploadCertToAliyun',
@ -26,8 +25,7 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
title: '大区',
value: 'cn-hangzhou',
component: {
name: 'a-select',
mode: 'tags',
name: 'a-auto-complete',
vModel: 'value',
options: ZoneOptions,
},
@ -61,13 +59,7 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
})
aliyunCertId!: string;
accessService!: IAccessService;
logger!: Logger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
console.log('开始部署证书到阿里云cdn');

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
@IsTaskPlugin({
@ -28,8 +28,8 @@ export class CloudflareDeployToCDNPlugin extends AbstractTaskPlugin {
title: '选择框',
component: {
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/select-cn
name: 'a-select',
mode: 'tags',
name: 'a-auto-complete',
vModel: 'value',
options: [
{ value: '1', label: '选项1' },
{ value: '2', label: '选项2' },
@ -71,13 +71,7 @@ export class CloudflareDeployToCDNPlugin extends AbstractTaskPlugin {
})
accessId!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const { select, text, cert, accessId } = this;
const certReader = new CertReader(cert);

View File

@ -1,6 +1,5 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
import { K8sClient } from '@certd/lib-k8s';
@IsTaskPlugin({
name: 'demoTest',
@ -28,8 +27,8 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
title: '选择框',
component: {
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/select-cn
name: 'a-select',
mode: 'tags',
name: 'a-auto-complete',
vModel: 'value',
options: [
{ value: '1', label: '选项1' },
{ value: '2', label: '选项2' },
@ -55,7 +54,7 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
component: {
name: 'pi-output-selector',
},
required: true,
// required: true,
})
cert!: CertInfo;
@ -67,31 +66,33 @@ export class DemoTestPlugin extends AbstractTaskPlugin {
name: 'pi-access-selector',
type: 'demo', //固定授权类型
},
rules: [{ required: true, message: '此项必填' }],
// rules: [{ required: true, message: '此项必填' }],
})
accessId!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const { select, text, cert, accessId } = this;
const certReader = new CertReader(cert);
const access = await this.accessService.getById(accessId);
this.logger.debug('access', access);
this.logger.debug('certReader', certReader);
try {
const access = await this.accessService.getById(accessId);
this.logger.debug('access', access);
} catch (e) {
this.logger.error('获取授权失败', e);
}
try {
const certReader = new CertReader(cert);
this.logger.debug('certReader', certReader);
} catch (e) {
this.logger.error('读取crt失败', e);
}
this.logger.info('DemoTestPlugin execute');
this.logger.info('text:', text);
this.logger.info('select:', select);
this.logger.info('switch:', this.switch);
this.logger.info('授权id:', accessId);
//TODO 这里实现你要部署的执行方法
new K8sClient('111', null);
}
}
//TODO 这里实例化插件,进行注册

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { SshClient } from '../../lib/ssh.js';
@IsTaskPlugin({
@ -34,12 +34,7 @@ export class HostShellExecutePlugin extends AbstractTaskPlugin {
})
script!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const { script, accessId } = this;
const connectConf = await this.accessService.getById(accessId);

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { SshClient } from '../../lib/ssh.js';
import { CertInfo, CertReader } from '@certd/plugin-cert';
import * as fs from 'fs';
@ -86,13 +86,7 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin {
})
hostKeyPath!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
copyFile(srcFile: string, destFile: string) {
const dir = destFile.substring(0, destFile.lastIndexOf('/'));

View File

@ -0,0 +1 @@
export * from './k8s-access.js';

View File

@ -0,0 +1,19 @@
import { IsAccess, AccessInput } from '@certd/pipeline';
@IsAccess({
name: 'k8s',
title: 'k8s授权',
desc: '',
})
export class K8sAccess {
@AccessInput({
title: 'kubeconfig',
component: {
placeholder: 'kubeconfig',
},
required: true,
})
kubeconfig = '';
}
new K8sAccess();

View File

@ -10,8 +10,7 @@ export class DnspodAccess {
title: '端点',
component: {
placeholder: 'endpoint',
name: 'a-select',
mode: 'tags',
name: 'a-auto-complete',
vModel: 'value',
options: [
{ value: 'https://dnsapi.cn', label: '中国站' },

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import tencentcloud from 'tencentcloud-sdk-nodejs';
import { TencentAccess } from '../../access/index.js';
import { CertInfo } from '@certd/plugin-cert';
@ -59,14 +59,7 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin {
// })
// endpoint!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const accessProvider: TencentAccess = (await this.accessService.getById(this.accessId)) as TencentAccess;

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
import tencentcloud from 'tencentcloud-sdk-nodejs';
import { TencentAccess } from '../../access/index.js';
import dayjs from 'dayjs';
@ -17,10 +17,9 @@ import dayjs from 'dayjs';
export class DeployToClbPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '大区',
value: 'ap-guangzhou',
component: {
name: 'a-select',
mode: 'tags',
name: 'a-auto-complete',
vModel: 'value',
options: [
{ value: 'ap-guangzhou' },
{ value: 'ap-beijing' },
@ -93,13 +92,7 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
})
accessId!: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess;
const client = this.getClient(accessProvider, this.region);

View File

@ -1,8 +1,7 @@
import { AbstractTaskPlugin, IAccessService, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
import tencentcloud from 'tencentcloud-sdk-nodejs';
import { K8sClient } from '@certd/lib-k8s';
import dayjs from 'dayjs';
import { Logger } from 'log4js';
@IsTaskPlugin({
name: 'DeployCertToTencentTKEIngress',
@ -38,8 +37,10 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
@TaskInput({
title: 'ingress类型',
value: 'qcloud',
component: {
name: 'a-select',
name: 'a-auto-complete',
vModel: 'value',
options: [{ value: 'qcloud' }, { value: 'nginx' }],
},
helper: '可选 qcloud / nginx',
@ -89,12 +90,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
})
cert!: any;
logger!: Logger;
accessService!: IAccessService;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const accessProvider = await this.accessService.getById(this.accessId);
const tkeClient = this.getTkeClient(accessProvider, this.region);

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IAccessService, ILogger, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import tencentcloud from 'tencentcloud-sdk-nodejs';
import dayjs from 'dayjs';
@ -43,13 +43,7 @@ export class UploadToTencentPlugin extends AbstractTaskPlugin {
})
tencentCertId?: string;
accessService!: IAccessService;
logger!: ILogger;
async onInstance() {
this.accessService = this.ctx.accessService;
this.logger = this.ctx.logger;
}
async onInstance() {}
async execute(): Promise<void> {
const { accessId, name, cert } = this;