@certd/pipeline 1.39.6 → 1.39.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.39.8](https://github.com/certd/certd/compare/v1.39.7...v1.39.8) (2026-03-31)
7
+
8
+ ### Performance Improvements
9
+
10
+ * 阿里云CDN部署支持根据证书域名自动匹配部署 ([a68301e](https://github.com/certd/certd/commit/a68301e4dcea8b7391ad751aa57555d566297ad9))
11
+ * 阿里云dcdn支持根据证书域名匹配模式 ([df012de](https://github.com/certd/certd/commit/df012dec90590ecba85a69ed6355cfa8382c1da3))
12
+ * dcdn自动匹配部署,支持新增域名感知 ([c6a988b](https://github.com/certd/certd/commit/c6a988bc925886bd7163c1270f2b7a10a57b1c5b))
13
+
14
+ ## [1.39.7](https://github.com/certd/certd/compare/v1.39.6...v1.39.7) (2026-03-25)
15
+
16
+ **Note:** Version bump only for package @certd/pipeline
17
+
6
18
  ## [1.39.6](https://github.com/certd/certd/compare/v1.39.5...v1.39.6) (2026-03-22)
7
19
 
8
20
  **Note:** Version bump only for package @certd/pipeline
@@ -297,7 +297,7 @@ export class Executor {
297
297
  //参数没有变化
298
298
  inputChanged = false;
299
299
  }
300
- if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {
300
+ if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed && define.runStrategy !== RunStrategy.AlwaysRun) {
301
301
  if (lastResult != null && lastResult === ResultType.success && !inputChanged) {
302
302
  step.status.output = lastNode?.status?.output;
303
303
  step.status.files = lastNode?.status?.files;
@@ -1,14 +1,14 @@
1
- import { Registrable } from "../registry/index.js";
2
- import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../dt/index.js";
3
- import { FileStore } from "../core/file-store.js";
1
+ import { HttpClient, HttpRequestConfig, ILogger, utils } from "@certd/basic";
4
2
  import { IAccessService } from "../access/index.js";
5
- import { ICnameProxyService, IEmailService, IServiceGetter, IUrlService } from "../service/index.js";
3
+ import { PageSearch } from "../context/index.js";
4
+ import { FileStore } from "../core/file-store.js";
6
5
  import { IContext, RunHistory } from "../core/index.js";
7
- import { HttpRequestConfig, ILogger, utils } from "@certd/basic";
8
- import { HttpClient } from "@certd/basic";
9
- import { IPluginConfigService } from "../service/config.js";
6
+ import { FileItem, FormItemProps, Pipeline, Runnable, Step } from "../dt/index.js";
10
7
  import { INotificationService } from "../notification/index.js";
8
+ import { Registrable } from "../registry/index.js";
9
+ import { IPluginConfigService } from "../service/config.js";
11
10
  import { TaskEmitter } from "../service/emit.js";
11
+ import { ICnameProxyService, IEmailService, IServiceGetter, IUrlService } from "../service/index.js";
12
12
  export type PluginRequestHandleReq<T = any> = {
13
13
  typeName: string;
14
14
  action: string;
@@ -60,6 +60,7 @@ export type PluginDefine = Registrable & {
60
60
  onlyAdmin?: boolean;
61
61
  needPlus?: boolean;
62
62
  showRunStrategy?: boolean;
63
+ runStrategy?: any;
63
64
  pluginType?: string;
64
65
  type?: string;
65
66
  };
@@ -75,6 +76,11 @@ export type TaskResult = {
75
76
  pipelineVars: Record<string, any>;
76
77
  pipelinePrivateVars?: Record<string, any>;
77
78
  };
79
+ export type CertTargetItem = {
80
+ value: string;
81
+ label: string;
82
+ domain: string | string[];
83
+ };
78
84
  export type TaskInstanceContext = {
79
85
  pipeline: Pipeline;
80
86
  runtime: RunHistory;
@@ -130,6 +136,33 @@ export declare abstract class AbstractTaskPlugin implements ITaskPlugin {
130
136
  buildDomainGroupOptions(options: any[], domains: string[]): any[];
131
137
  getLastStatus(): Runnable;
132
138
  getLastOutput(key: string): any;
139
+ isDomainMatched(domainList: string | string[], certDomains: string[]): boolean;
140
+ isNotChanged(): boolean;
141
+ getAutoMatchedTargets(req: {
142
+ targetName: string;
143
+ certDomains: string[];
144
+ pageSize: number;
145
+ getDeployTargetList: (req: PageSearch) => Promise<{
146
+ list: CertTargetItem[];
147
+ total: number;
148
+ }>;
149
+ }): Promise<CertTargetItem[]>;
150
+ autoMatchedDeploy(req: {
151
+ targetName: string;
152
+ getCertDomains: () => Promise<string[]>;
153
+ uploadCert: () => Promise<any>;
154
+ deployOne: (req: {
155
+ target: CertTargetItem;
156
+ cert: any;
157
+ }) => Promise<void>;
158
+ getDeployTargetList: (req: PageSearch) => Promise<{
159
+ list: CertTargetItem[];
160
+ total: number;
161
+ }>;
162
+ }): Promise<{
163
+ result: string;
164
+ deployedList: string[];
165
+ }>;
133
166
  }
134
167
  export type OutputVO = {
135
168
  key: string;
@@ -1,8 +1,8 @@
1
+ import { domainUtils, logger, utils } from "@certd/basic";
2
+ import dayjs from "dayjs";
3
+ import { cloneDeep, upperFirst } from "lodash-es";
1
4
  import { accessRegistry } from "../access/index.js";
2
5
  import { CancelError, RunnableCollection } from "../core/index.js";
3
- import { logger, utils } from "@certd/basic";
4
- import dayjs from "dayjs";
5
- import { upperFirst } from "lodash-es";
6
6
  export var ContextScope;
7
7
  (function (ContextScope) {
8
8
  ContextScope[ContextScope["global"] = 0] = "global";
@@ -165,4 +165,79 @@ export class AbstractTaskPlugin {
165
165
  getLastOutput(key) {
166
166
  return this.getLastStatus().status?.output?.[key];
167
167
  }
168
+ isDomainMatched(domainList, certDomains) {
169
+ const matched = domainUtils.match(domainList, certDomains);
170
+ return matched;
171
+ }
172
+ isNotChanged() {
173
+ const lastResult = this.ctx?.lastStatus?.status?.status;
174
+ return !this.ctx.inputChanged && lastResult === "success";
175
+ }
176
+ async getAutoMatchedTargets(req) {
177
+ const matchedDomains = [];
178
+ let pageNo = 1;
179
+ const { certDomains } = req;
180
+ const pageSize = req.pageSize || 100;
181
+ while (true) {
182
+ const result = await req.getDeployTargetList({
183
+ pageNo,
184
+ pageSize,
185
+ });
186
+ const pageData = result.list;
187
+ this.logger.info(`获取到 ${pageData.length} 个 ${req.targetName}`);
188
+ if (!pageData || pageData.length === 0) {
189
+ break;
190
+ }
191
+ for (const item of pageData) {
192
+ const domainName = item.domain;
193
+ if (this.isDomainMatched(domainName, certDomains)) {
194
+ matchedDomains.push(item);
195
+ }
196
+ }
197
+ const totalCount = result.total || 0;
198
+ if (pageNo * pageSize >= totalCount || matchedDomains.length == 0) {
199
+ break;
200
+ }
201
+ pageNo++;
202
+ }
203
+ return matchedDomains;
204
+ }
205
+ async autoMatchedDeploy(req) {
206
+ this.logger.info("证书匹配模式部署");
207
+ const certDomains = await req.getCertDomains();
208
+ const certTargetList = await this.getAutoMatchedTargets({
209
+ targetName: req.targetName,
210
+ pageSize: 200,
211
+ certDomains,
212
+ getDeployTargetList: req.getDeployTargetList,
213
+ });
214
+ if (certTargetList.length === 0) {
215
+ this.logger.warn(`未找到匹配的${req.targetName}`);
216
+ return { result: "skip", deployedList: [] };
217
+ }
218
+ this.logger.info(`找到 ${certTargetList.length} 个匹配的${req.targetName}`);
219
+ //开始部署,检查是否已经部署过
220
+ const deployedList = cloneDeep(this.getLastStatus()?.status?.output?.deployedList || []);
221
+ const unDeployedTargets = certTargetList.filter(item => !deployedList.includes(item.value));
222
+ const count = unDeployedTargets.length;
223
+ const deployedCount = certTargetList.length - count;
224
+ if (deployedCount > 0) {
225
+ this.logger.info(`跳过 ${deployedCount} 个已部署过的${req.targetName}`);
226
+ }
227
+ this.logger.info(`需要部署 ${count} 个${req.targetName}`);
228
+ if (count === 0) {
229
+ return { result: "skip", deployedList };
230
+ }
231
+ this.logger.info(`开始部署`);
232
+ const aliCrtId = await req.uploadCert();
233
+ for (const target of unDeployedTargets) {
234
+ await req.deployOne({
235
+ cert: aliCrtId,
236
+ target,
237
+ });
238
+ deployedList.push(target.value);
239
+ }
240
+ this.logger.info(`本次成功部署 ${count} 个${req.targetName}`);
241
+ return { result: "success", deployedList };
242
+ }
168
243
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@certd/pipeline",
3
3
  "private": false,
4
- "version": "1.39.6",
4
+ "version": "1.39.8",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -18,8 +18,8 @@
18
18
  "compile": "tsc --skipLibCheck --watch"
19
19
  },
20
20
  "dependencies": {
21
- "@certd/basic": "^1.39.6",
22
- "@certd/plus-core": "^1.39.6",
21
+ "@certd/basic": "^1.39.8",
22
+ "@certd/plus-core": "^1.39.8",
23
23
  "dayjs": "^1.11.7",
24
24
  "lodash-es": "^4.17.21",
25
25
  "reflect-metadata": "^0.1.13"
@@ -45,5 +45,5 @@
45
45
  "tslib": "^2.8.1",
46
46
  "typescript": "^5.4.2"
47
47
  },
48
- "gitHead": "b0ccab41e17cb16c87bfc0ec3b052d5e8a5d8435"
48
+ "gitHead": "de0ae14544f1c3da4923dddc6a1a3bea4db295e7"
49
49
  }