mirror of https://github.com/certd/certd
chore:
parent
653f409d91
commit
18718f6a25
|
@ -13,7 +13,7 @@ export class DogeClient {
|
||||||
this.http = http;
|
this.http = http;
|
||||||
}
|
}
|
||||||
|
|
||||||
async request(apiPath: string, data: any = {}, jsonMode = false) {
|
async request(apiPath: string, data: any = {}, jsonMode = false, ignoreResNullCode = false) {
|
||||||
// 这里替换为你的多吉云永久 AccessKey 和 SecretKey,可在用户中心 - 密钥管理中查看
|
// 这里替换为你的多吉云永久 AccessKey 和 SecretKey,可在用户中心 - 密钥管理中查看
|
||||||
// 请勿在客户端暴露 AccessKey 和 SecretKey,那样恶意用户将获得账号完全控制权
|
// 请勿在客户端暴露 AccessKey 和 SecretKey,那样恶意用户将获得账号完全控制权
|
||||||
|
|
||||||
|
@ -34,7 +34,9 @@ export class DogeClient {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.code !== 200) {
|
if (res.code == null && ignoreResNullCode) {
|
||||||
|
//ignore
|
||||||
|
} else if (res.code !== 200) {
|
||||||
throw new Error('API Error: ' + res.msg);
|
throw new Error('API Error: ' + res.msg);
|
||||||
}
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
|
|
|
@ -44,6 +44,17 @@ export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin {
|
||||||
})
|
})
|
||||||
accessId!: string;
|
accessId!: string;
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: '忽略部署接口报错',
|
||||||
|
helper: '当该域名部署后报错,但是实际上已经部署成功时,可以勾选',
|
||||||
|
value: false,
|
||||||
|
component: {
|
||||||
|
name: 'a-switch',
|
||||||
|
type: 'checked',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
ignoreDeployNullCode = false;
|
||||||
|
|
||||||
dogeClient!: DogeClient;
|
dogeClient!: DogeClient;
|
||||||
|
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
|
@ -66,10 +77,14 @@ export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
async bindCert(certId: number) {
|
async bindCert(certId: number) {
|
||||||
await this.dogeClient.request('/cdn/cert/bind.json', {
|
await this.dogeClient.request(
|
||||||
id: certId,
|
'/cdn/cert/bind.json',
|
||||||
domain: this.domain,
|
{
|
||||||
});
|
id: certId,
|
||||||
|
domain: this.domain,
|
||||||
|
},
|
||||||
|
this.ignoreDeployNullCode
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new DogeCloudDeployToCDNPlugin();
|
new DogeCloudDeployToCDNPlugin();
|
||||||
|
|
|
@ -6,7 +6,7 @@ import dayjs from 'dayjs';
|
||||||
name: 'DeployCertToTencentCLB',
|
name: 'DeployCertToTencentCLB',
|
||||||
title: '部署到腾讯云CLB',
|
title: '部署到腾讯云CLB',
|
||||||
group: pluginGroups.tencent.key,
|
group: pluginGroups.tencent.key,
|
||||||
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡',
|
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡,必须开启sni',
|
||||||
default: {
|
default: {
|
||||||
strategy: {
|
strategy: {
|
||||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||||
|
@ -93,14 +93,13 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
|
||||||
accessId!: string;
|
accessId!: string;
|
||||||
|
|
||||||
client: any;
|
client: any;
|
||||||
ClbClient: any;
|
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
this.client = await this.getClient();
|
this.client = await this.getClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getClient() {
|
async getClient() {
|
||||||
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js');
|
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js');
|
||||||
this.ClbClient = sdk.v20180317.Client;
|
const ClbClient = sdk.v20180317.Client;
|
||||||
|
|
||||||
const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess;
|
const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess;
|
||||||
|
|
||||||
|
@ -118,7 +117,7 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return new this.ClbClient(clientConfig);
|
return new ClbClient(clientConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
|
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { tke } from 'tencentcloud-sdk-nodejs';
|
|
||||||
|
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
name: 'DeployCertToTencentTKEIngress',
|
name: 'DeployCertToTencentTKEIngress',
|
||||||
|
|
Loading…
Reference in New Issue