mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
perf: 优化成功后跳过的提示
This commit is contained in:
@@ -38,7 +38,10 @@ const development = {
|
||||
},
|
||||
},
|
||||
cron: {
|
||||
//启动时立即触发一次
|
||||
immediateTriggerOnce: false,
|
||||
//启动时仅注册admin(id=1)用户的
|
||||
onlyAdminUser: false,
|
||||
},
|
||||
/**
|
||||
* 演示环境
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -1,11 +0,0 @@
|
||||
import { MidwayConfig } from '@midwayjs/core';
|
||||
|
||||
export default {
|
||||
typeorm: {
|
||||
dataSource: {
|
||||
default: {
|
||||
synchronize: true, // 如果第一次使用,不存在表,有同步的需求可以写 true
|
||||
},
|
||||
},
|
||||
},
|
||||
} as MidwayConfig;
|
||||
@@ -1,7 +0,0 @@
|
||||
import { MidwayConfig } from '@midwayjs/core';
|
||||
|
||||
export default {
|
||||
koa: {
|
||||
port: null,
|
||||
},
|
||||
} as MidwayConfig;
|
||||
@@ -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,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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完成');
|
||||
//
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ?? '{}');
|
||||
|
||||
@@ -11,8 +11,7 @@ export class AliyunAccess {
|
||||
component: {
|
||||
placeholder: 'accessKeyId',
|
||||
},
|
||||
helper:
|
||||
'注意:证书申请,需要dns解析权限;其他阿里云插件,也需要对应的权限,比如证书上传需要证书管理权限',
|
||||
helper: '注意:证书申请,需要dns解析权限;其他阿里云插件,也需要对应的权限,比如证书上传需要证书管理权限',
|
||||
required: true,
|
||||
})
|
||||
accessKeyId = '';
|
||||
|
||||
+3
-9
@@ -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('暂未实现');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+3
-11
@@ -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');
|
||||
|
||||
+4
-10
@@ -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);
|
||||
|
||||
@@ -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 这里实例化插件,进行注册
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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('/'));
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './k8s-access.js';
|
||||
@@ -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();
|
||||
@@ -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: '中国站' },
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+5
-9
@@ -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);
|
||||
|
||||
+2
-8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user