Merge branch 'v2-dev' into v2

v2
xiaojunnuo 2025-07-15 15:47:46 +08:00
commit 521599ef39
43 changed files with 646 additions and 66 deletions

View File

@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Bug Fixes
* 修复流水线列表页报length错误的bug ([9864792](https://github.com/certd/certd/commit/9864792bbfd149e770d6e1ffa809573694f99dd3))
* 修复流水线页面状态没有刷新的bug ([93e9498](https://github.com/certd/certd/commit/93e9498b410353f504e11e264db62468895d7290))
* 修复自定义证书检查时间重启之后不生效的bug ([38e867c](https://github.com/certd/certd/commit/38e867c917bbc68bd228bdd8064f3e7358d6413d))
### Performance Improvements
* 支持上传证书到各种对象存储oss、cos、七牛、s3、minio等 ([1da8617](https://github.com/certd/certd/commit/1da8617a53a675776635bbc3bcb3c6d7dff83e27))
* 支持邮箱发送证书 ([95332d5](https://github.com/certd/certd/commit/95332d5db96cd54ddab6ab737332417a09169b39))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Bug Fixes

View File

@ -1 +1 @@
23:53
15:36

View File

@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Bug Fixes
* 修复流水线列表页报length错误的bug ([9864792](https://github.com/certd/certd/commit/9864792bbfd149e770d6e1ffa809573694f99dd3))
* 修复流水线页面状态没有刷新的bug ([93e9498](https://github.com/certd/certd/commit/93e9498b410353f504e11e264db62468895d7290))
* 修复自定义证书检查时间重启之后不生效的bug ([38e867c](https://github.com/certd/certd/commit/38e867c917bbc68bd228bdd8064f3e7358d6413d))
### Performance Improvements
* 支持上传证书到各种对象存储oss、cos、七牛、s3、minio等 ([1da8617](https://github.com/certd/certd/commit/1da8617a53a675776635bbc3bcb3c6d7dff83e27))
* 支持邮箱发送证书 ([95332d5](https://github.com/certd/certd/commit/95332d5db96cd54ddab6ab737332417a09169b39))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Bug Fixes

View File

@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.36.6"
"version": "1.36.7"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/publishlab/node-acme-client/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/acme-client
## [1.36.6](https://github.com/publishlab/node-acme-client/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/acme-client

View File

@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.36.6",
"@certd/basic": "^1.36.7",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
@ -69,5 +69,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/basic
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/basic

View File

@ -1 +1 @@
23:48
15:21

View File

@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -45,5 +45,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Performance Improvements
* 支持邮箱发送证书 ([95332d5](https://github.com/certd/certd/commit/95332d5db96cd54ddab6ab737332417a09169b39))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/pipeline

View File

@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -17,8 +17,8 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/basic": "^1.36.6",
"@certd/plus-core": "^1.36.6",
"@certd/basic": "^1.36.7",
"@certd/plus-core": "^1.36.7",
"dayjs": "^1.11.7",
"lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13"
@ -44,5 +44,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -1,7 +1,9 @@
export type EmailSend = {
subject: string;
content: string;
receivers: string[];
content?: string;
attachments?: any[];
html?: string;
};
export interface IEmailService {

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/lib-huawei
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/lib-huawei

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@ -24,5 +24,5 @@
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/lib-iframe
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/lib-iframe

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -31,5 +31,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/jdcloud
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/jdcloud

View File

@ -1,6 +1,6 @@
{
"name": "@certd/jdcloud",
"version": "1.36.6",
"version": "1.36.7",
"description": "jdcloud openApi sdk",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
@ -61,5 +61,5 @@
"fetch"
]
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/lib-k8s
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/lib-k8s

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -17,7 +17,7 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/basic": "^1.36.6",
"@certd/basic": "^1.36.7",
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
@ -32,5 +32,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/lib-server
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Performance Improvements

View File

@ -1,6 +1,6 @@
{
"name": "@certd/lib-server",
"version": "1.36.6",
"version": "1.36.7",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -27,10 +27,10 @@
],
"license": "AGPL",
"dependencies": {
"@certd/acme-client": "^1.36.6",
"@certd/basic": "^1.36.6",
"@certd/pipeline": "^1.36.6",
"@certd/plus-core": "^1.36.6",
"@certd/acme-client": "^1.36.7",
"@certd/basic": "^1.36.7",
"@certd/pipeline": "^1.36.7",
"@certd/plus-core": "^1.36.7",
"@midwayjs/cache": "~3.14.0",
"@midwayjs/core": "~3.20.3",
"@midwayjs/i18n": "~3.20.3",
@ -61,5 +61,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.36.6",
"version": "1.36.7",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -46,5 +46,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Performance Improvements
* 支持邮箱发送证书 ([95332d5](https://github.com/certd/certd/commit/95332d5db96cd54ddab6ab737332417a09169b39))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Performance Improvements

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -16,10 +16,10 @@
"pub": "npm publish"
},
"dependencies": {
"@certd/acme-client": "^1.36.6",
"@certd/basic": "^1.36.6",
"@certd/pipeline": "^1.36.6",
"@certd/plugin-lib": "^1.36.6",
"@certd/acme-client": "^1.36.7",
"@certd/basic": "^1.36.7",
"@certd/pipeline": "^1.36.7",
"@certd/plugin-lib": "^1.36.7",
"@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7",
"jszip": "^3.10.1",
@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -1,4 +1,4 @@
import { AbstractTaskPlugin, IContext, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import { AbstractTaskPlugin, FileItem, IContext, Step, TaskInput, TaskOutput } from "@certd/pipeline";
import dayjs from "dayjs";
import type { CertInfo } from "./acme.js";
import { CertReader } from "./cert-reader.js";
@ -71,6 +71,12 @@ export abstract class CertApplyBaseConvertPlugin extends AbstractTaskPlugin {
})
cert?: CertInfo;
@TaskOutput({
title: "域名证书压缩文件",
type: "certZip",
})
certZip?: FileItem;
async onInstance() {
this.userContext = this.ctx.userContext;
this.lastStatus = this.ctx.lastStatus as Step;
@ -131,6 +137,7 @@ export abstract class CertApplyBaseConvertPlugin extends AbstractTaskPlugin {
} else {
this.extendsFiles();
}
this.certZip = this._result.files[0];
}
async zipCert(cert: CertInfo, filename: string) {

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Bug Fixes
* 修复流水线页面状态没有刷新的bug ([93e9498](https://github.com/certd/certd/commit/93e9498b410353f504e11e264db62468895d7290))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
**Note:** Version bump only for package @certd/plugin-lib

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.36.6",
"version": "1.36.7",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -21,8 +21,8 @@
"@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.10",
"@aws-sdk/client-s3": "^3.787.0",
"@certd/basic": "^1.36.6",
"@certd/pipeline": "^1.36.6",
"@certd/basic": "^1.36.7",
"@certd/pipeline": "^1.36.7",
"@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.22.0",
"basic-ftp": "^5.0.5",
@ -53,5 +53,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "29d49d72f95aa101729965710375104240a2c038"
"gitHead": "e0408f30ba604c4dbe7cb415d1eac8cb588fbc45"
}

View File

@ -16,6 +16,10 @@ export default class SshOssClientImpl extends BaseOssClient<SshAccess> {
throw new Error("Method not implemented.");
}
async upload(filePath: string, fileContent: Buffer) {
if (!filePath) {
filePath = "";
}
filePath = filePath.trim();
const tmpFilePath = path.join(os.tmpdir(), "cert", "http", filePath);
// Write file to temp path

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Bug Fixes
* 修复流水线页面状态没有刷新的bug ([93e9498](https://github.com/certd/certd/commit/93e9498b410353f504e11e264db62468895d7290))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Bug Fixes

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.36.6",
"version": "1.36.7",
"private": true,
"scripts": {
"dev": "vite --open",
@ -103,8 +103,8 @@
"zod-defaults": "^0.1.3"
},
"devDependencies": {
"@certd/lib-iframe": "^1.36.6",
"@certd/pipeline": "^1.36.6",
"@certd/lib-iframe": "^1.36.7",
"@certd/pipeline": "^1.36.7",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@ -374,6 +374,7 @@ export default defineComponent({
const detail: RunHistory = await props.options?.getHistoryDetail({ historyId: currentHistory.value.id });
currentHistory.value.logs = detail.logs;
currentHistory.value.pipeline = detail.pipeline;
currentHistory.value.status = detail.pipeline.status.result;
};
const changeCurrentHistory = async (history?: RunHistory) => {
if (!history) {
@ -385,7 +386,7 @@ export default defineComponent({
currentHistory.value = history;
await loadCurrentHistoryDetail();
pipeline.value = currentHistory.value.pipeline;
currentPipeline.value = cloneDeep(pipeline.value);
currentPipeline.value = currentHistory.value.pipeline;
};
async function loadHistoryList(reload = false) {
@ -439,8 +440,13 @@ export default defineComponent({
}
if (currentHistory.value != null) {
if (currentHistory.value.pipeline?.status?.status === "start") {
if (currentHistory.value.status === "start") {
await loadCurrentHistoryDetail();
pipeline.value = currentHistory.value.pipeline;
// if (currentHistory.value.pipeline?.status?.status !== "start") {
// true
// await loadHistoryList(true);
// }
}
}
} catch (e) {

View File

@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.7](https://github.com/certd/certd/compare/v1.36.6...v1.36.7) (2025-07-15)
### Bug Fixes
* 修复流水线列表页报length错误的bug ([9864792](https://github.com/certd/certd/commit/9864792bbfd149e770d6e1ffa809573694f99dd3))
* 修复流水线页面状态没有刷新的bug ([93e9498](https://github.com/certd/certd/commit/93e9498b410353f504e11e264db62468895d7290))
* 修复自定义证书检查时间重启之后不生效的bug ([38e867c](https://github.com/certd/certd/commit/38e867c917bbc68bd228bdd8064f3e7358d6413d))
### Performance Improvements
* 支持上传证书到各种对象存储oss、cos、七牛、s3、minio等 ([1da8617](https://github.com/certd/certd/commit/1da8617a53a675776635bbc3bcb3c6d7dff83e27))
* 支持邮箱发送证书 ([95332d5](https://github.com/certd/certd/commit/95332d5db96cd54ddab6ab737332417a09169b39))
## [1.36.6](https://github.com/certd/certd/compare/v1.36.5...v1.36.6) (2025-07-14)
### Performance Improvements

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.36.6",
"version": "1.36.7",
"description": "fast-server base midway",
"private": true,
"type": "module",
@ -42,20 +42,20 @@
"@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-iam": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.36.6",
"@certd/basic": "^1.36.6",
"@certd/commercial-core": "^1.36.6",
"@certd/acme-client": "^1.36.7",
"@certd/basic": "^1.36.7",
"@certd/commercial-core": "^1.36.7",
"@certd/cv4pve-api-javascript": "^8.4.1",
"@certd/jdcloud": "^1.36.6",
"@certd/lib-huawei": "^1.36.6",
"@certd/lib-k8s": "^1.36.6",
"@certd/lib-server": "^1.36.6",
"@certd/midway-flyway-js": "^1.36.6",
"@certd/pipeline": "^1.36.6",
"@certd/plugin-cert": "^1.36.6",
"@certd/plugin-lib": "^1.36.6",
"@certd/plugin-plus": "^1.36.6",
"@certd/plus-core": "^1.36.6",
"@certd/jdcloud": "^1.36.7",
"@certd/lib-huawei": "^1.36.7",
"@certd/lib-k8s": "^1.36.7",
"@certd/lib-server": "^1.36.7",
"@certd/midway-flyway-js": "^1.36.7",
"@certd/pipeline": "^1.36.7",
"@certd/plugin-cert": "^1.36.7",
"@certd/plugin-lib": "^1.36.7",
"@certd/plugin-plus": "^1.36.7",
"@certd/plus-core": "^1.36.7",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0",

View File

@ -71,7 +71,7 @@ export class AutoCRegisterCron {
}
})
for (const item of monitorSettingList) {
const setting = item.setting ?? JSON.parse(item.setting)
const setting = item.setting ? JSON.parse(item.setting):{}
if(!setting?.cron){
continue
}

View File

@ -98,6 +98,8 @@ export class EmailService implements IEmailService {
to: email.receivers.join(', '), // list of receivers
subject: subject,
text: email.content,
html: email.html,
attachments: email.attachments,
};
await transporter.sendMail(mailOptions);
}

View File

@ -128,13 +128,15 @@ export class PipelineService extends BaseService<PipelineEntity> {
}
const pipeline = JSON.parse(item.content);
let stepCount = 0;
RunnableCollection.each(pipeline.stages, (runnable: any) => {
stepCount++;
});
if(pipeline.stages){
RunnableCollection.each(pipeline.stages, (runnable: any) => {
stepCount++;
});
}
// @ts-ignore
item.stepCount = stepCount;
// @ts-ignore
item.triggerCount = pipeline.triggers.length;
item.triggerCount = pipeline.triggers?.length;
delete item.content;
}

View File

@ -1,3 +1,4 @@
export * from './host-shell-execute/index.js';
export * from './upload-to-host/index.js';
export * from './copy-to-local/index.js'
export * from './plugin-upload-to-oss.js'

View File

@ -0,0 +1,274 @@
import {AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
import {CertInfo} from "@certd/plugin-cert";
import {ossClientFactory} from "@certd/plugin-lib";
import {utils} from "@certd/basic";
@IsTaskPlugin({
name: 'UploadCertToOss',
title: '上传证书到对象存储OSS',
icon: 'ion:cloud-upload-outline',
desc: '支持阿里云OSS、腾讯云COS、七牛云KODO、S3、MinIO、FTP、SFTP',
group: pluginGroups.host.key,
showRunStrategy:false,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class UploadCertToOssPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '域名证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'output-selector',
from: [":cert:"],
},
required: true,
})
cert!: CertInfo;
@TaskInput({
title: 'OSS类型',
component: {
name: 'a-select',
vModel:"value",
options: [
{ label: "阿里云OSS", value: "alioss" },
{ label: "腾讯云COS", value: "tencentcos" },
{ label: "七牛OSS", value: "qiniuoss" },
{ label: "S3/Minio", value: "s3" },
{ label: "SFTP", value: "sftp" },
{ label: "FTP", value: "ftp" },
]
},
required: true,
})
uploaderType!: string;
@TaskInput({
title: 'OSS授权',
component: {
name: 'access-selector',
},
required: true,
mergeScript: `
return {
component: {
type: ctx.compute(({form})=>{
return form.uploaderType;
})
}
}
`,
})
accessId!: string;
@TaskInput({
title: '证书格式',
helper: '要部署的证书格式支持pem、pfx、der、jks',
component: {
name: 'a-select',
options: [
{ value: 'pem', label: 'pemcrtNginx等大部分应用' },
{ value: 'pfx', label: 'pfx一般用于IIS' },
{ value: 'der', label: 'der一般用于Apache' },
{ value: 'jks', label: 'jks一般用于JAVA应用' },
{ value: 'one', label: '证书私钥一体crt+key简单合并为一个pem文件' },
],
},
required: true,
})
certType!: string;
@TaskInput({
title: '证书保存路径',
helper: '路径要包含证书文件名,例如:/tmp/cert.pem',
component: {
placeholder: '/root/deploy/nginx/full_chain.pem',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'pem';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
crtPath!: string;
@TaskInput({
title: '私钥保存路径',
helper: '路径要包含私钥文件名,例如:/tmp/cert.key',
component: {
placeholder: '/root/deploy/nginx/cert.key',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'pem';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
keyPath!: string;
@TaskInput({
title: '中间证书保存路径',
helper: '路径要包含文件名,一般情况传上面两个文件即可,极少数情况需要这个中间证书',
component: {
placeholder: '/root/deploy/nginx/intermediate.pem',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'pem';
})
}
`,
rules: [{ type: 'filepath' }],
})
icPath!: string;
@TaskInput({
title: 'PFX证书保存路径',
helper: '路径要包含证书文件名例如D:\\iis\\cert.pfx',
component: {
placeholder: 'D:\\iis\\cert.pfx',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'pfx';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
pfxPath!: string;
@TaskInput({
title: 'DER证书保存路径',
helper: '路径要包含证书文件名,例如:/tmp/cert.der',
component: {
placeholder: '/root/deploy/apache/cert.der',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'der';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
derPath!: string;
@TaskInput({
title: 'jks证书保存路径',
helper: '路径要包含证书文件名,例如:/tmp/cert.jks',
component: {
placeholder: '/root/deploy/java_app/cert.jks',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'jks';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
jksPath!: string;
@TaskInput({
title: '一体证书保存路径',
helper: '路径要包含证书文件名,例如:/tmp/crt_key.pem',
component: {
placeholder: '/app/crt_key.pem',
},
mergeScript: `
return {
show: ctx.compute(({form})=>{
return form.certType === 'one';
})
}
`,
required: true,
rules: [{ type: 'filepath' }],
})
onePath!: string;
async onInstance() {}
async execute(): Promise<void> {
const { accessId } = this;
let { crtPath, keyPath, icPath, pfxPath, derPath, jksPath, onePath } = this;
if (!accessId) {
throw new Error('OSS授权配置不能为空');
}
const uploaderType = this.uploaderType
const uploaderAccess = this.accessId
const httpUploaderContext = {
accessService: this.ctx.accessService,
logger: this.logger,
utils,
};
const access = await this.getAccess(uploaderAccess);
this.logger.info("上传方式", uploaderType);
const httpUploader = await ossClientFactory.createOssClientByType(uploaderType, {
access,
rootDir: "",
ctx: httpUploaderContext,
});
this.logger.info('准备上传文件到OSS');
if (crtPath) {
await httpUploader.upload(crtPath, Buffer.from(this.cert.crt))
this.logger.info(`上传证书:${crtPath}`);
}
if (keyPath) {
await httpUploader.upload(keyPath, Buffer.from(this.cert.key))
this.logger.info(`上传私钥:${keyPath}`);
}
if (icPath) {
await httpUploader.upload(icPath, Buffer.from(this.cert.ic))
this.logger.info(`上传中间证书:${icPath}`);
}
if (pfxPath) {
await httpUploader.upload(pfxPath, Buffer.from(this.cert.pfx, "base64"))
this.logger.info(`上传PFX证书${pfxPath}`);
}
if (derPath) {
await httpUploader.upload(derPath, Buffer.from(this.cert.der, "base64"))
this.logger.info(`上传DER证书${derPath}`);
}
if (this.jksPath) {
await httpUploader.upload(jksPath,Buffer.from(this.cert.jks, "base64"))
this.logger.info(`上传jks证书${jksPath}`);
}
if (onePath) {
await httpUploader.upload(onePath, Buffer.from(this.cert.one))
this.logger.info(`上传一体证书:${onePath}`);
}
this.logger.info('上传文件成功');
}
}
new UploadCertToOssPlugin();

View File

@ -2,3 +2,4 @@ export * from './plugin-restart.js';
export * from './plugin-script.js';
export * from './plugin-wait.js';
export * from './plugin-db-backup.js';
export * from './plugin-deploy-to-mail.js';

View File

@ -0,0 +1,186 @@
import {AbstractTaskPlugin, FileItem, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
import {CertInfo, CertReader} from "@certd/plugin-cert";
import dayjs from "dayjs";
@IsTaskPlugin({
name: 'DeployCertToMailPlugin',
title: '邮件发送证书',
icon: 'ion:mail-outline',
desc: '通过邮件发送证书',
group: pluginGroups.other.key,
showRunStrategy:false,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class DeployCertToMailPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '域名证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'output-selector',
from: [":cert:"],
},
required: true,
})
cert!: CertInfo;
@TaskInput({
title: '证书压缩文件',
helper: '请选择前置任务输出的域名证书压缩文件',
component: {
name: 'output-selector',
from: [":certZip:"],
},
required: true,
})
certZip!: FileItem;
@TaskInput({
title: '接收邮箱',
component: {
name: 'EmailSelector',
vModel: 'value',
mode:"tags",
},
required: true,
})
email!: string[];
/**
* title:
* title:
* helper: |-
* 使
* :${certDomains}
* component:
* name: a-input
* required: false
* template:
* title:
* helper: |-
* 使
* :${certDomains}
* value: |-
* :
* (${certDomains})
* component:
* name: a-textarea
* autosize:
* minRows: 6
* maxRows: 10
* required: false
*/
@TaskInput({
title: '邮件标题',
component: {
name: 'a-input',
vModel: 'value',
placeholder:`证书申请成功【$\{mainDomain}】`,
},
helper: '请输入邮件标题否则将使用默认标题\n模板变量主域名=$\{mainDomain}、全部域名=$\{domains}、过期时间=$\{expiresTime}、备注=$\{remark}、证书PEM=$\{crt}、证书私钥=$\{key}、中间证书/CA证书=$\{ic}',
required: false,
})
title!: string;
@TaskInput({
title: '邮件模版',
component: {
name: 'a-textarea',
vModel: 'value',
autosize: {
minRows: 6,
maxRows: 10,
},
placeholder: `
<div>
<p></p>
<p>$\{domains}</p>
<p>$\{expiresTime}</p>
<p>$\{remark}</p>
</div>
`,
},
helper: `请输入模版内容否则将使用默认模版,模板变量同上`,
required: false,
})
template!: string;
@TaskInput({
title: '备注',
component: {
name: 'a-input',
vModel: 'value',
},
required: false,
})
remark!: string;
async onInstance() {}
async execute(): Promise<void> {
this.logger.info(`开始发送邮件`);
const certReader = new CertReader(this.cert)
const mainDomain = certReader.getMainDomain();
const domains = certReader.getAllDomains().join(',');
const data = {
mainDomain,
domains,
expiresTime: dayjs(certReader.expires).format("YYYY-MM-DD HH:mm:ss"),
remark:this.remark ||"",
crt: this.cert.crt,
key: this.cert.key,
ic: this.cert.ic
}
let title = `证书申请成功【${mainDomain}`;
let html = `
<div>
<p></p>
<p>${domains}</p>
<p>${data.expiresTime}</p>
<p>${this.remark||""}</p>
</div>
`;
if (this.title) {
const compile = this.compile(this.title);
title = compile(data);
}
if (this.template) {
const compile = this.compile(this.template);
html = compile(data);
}
const file = this.certZip
if (!file) {
throw new Error('证书压缩文件还未生成,重新运行证书任务');
}
await this.ctx.emailService.send({
subject:title,
html: html,
receivers: this.email,
attachments: [
{
filename: file.filename,
path: file.path,
},
],
})
}
compile(templateString:string) {
return new Function('data', ` with(data || {}) {
return \`${templateString}\`;
}
`);
}
}
new DeployCertToMailPlugin();

View File

@ -5,7 +5,7 @@ import { TencentAccess } from "@certd/plugin-lib";
name: 'DeployCertToTencentEO',
title: '腾讯云-部署到腾讯云EO',
icon: 'svg:icon-tencentcloud',
desc: '腾讯云边缘安全加速平台EO必须配置上传证书到腾讯云任务',
desc: '腾讯云边缘安全加速平台EdgeOne(EO),必须配置上传证书到腾讯云任务',
group: pluginGroups.tencent.key,
default: {
strategy: {