@cloudbase/manager-node 5.8.2 → 5.8.3
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 +6 -0
- package/lib/database/index.js +11 -6
- package/lib/deploy/DeployOrchestrator.js +30 -16
- package/lib/deploy/FunctionDeployer.js +269 -39
- package/lib/deploy/StaticDeployer.js +7 -1
- package/lib/deploy/function/builders/cloud.js +45 -348
- package/lib/deploy/function/cloud-build-service.js +2 -16
- package/lib/deploy/function/config-guard.js +42 -32
- package/lib/deploy/function/enterprise-tcr.js +194 -0
- package/lib/deploy/function/image-tag.js +31 -0
- package/lib/deploy/function/local-builder.js +170 -25
- package/lib/deploy/function/personal-tcr.js +153 -0
- package/lib/deploy/types.js +11 -0
- package/lib/hosting/index.js +27 -0
- package/lib/projectValidator/index.js +22 -20
- package/package.json +2 -2
- package/types/database/index.d.ts +1 -0
- package/types/deploy/DeployOrchestrator.d.ts +10 -0
- package/types/deploy/FunctionDeployer.d.ts +20 -2
- package/types/deploy/StaticDeployer.d.ts +11 -0
- package/types/deploy/function/builders/cloud.d.ts +6 -39
- package/types/deploy/function/enterprise-tcr.d.ts +32 -0
- package/types/deploy/function/image-tag.d.ts +10 -0
- package/types/deploy/function/local-builder.d.ts +35 -6
- package/types/deploy/function/personal-tcr.d.ts +35 -0
- package/types/deploy/types.d.ts +34 -8
- package/types/hosting/index.d.ts +13 -0
- package/types/projectValidator/index.d.ts +3 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Environment } from '../../environment';
|
|
2
|
+
export declare const DEFAULT_PERSONAL_TCR_REGISTRY = "ccr.ccs.tencentyun.com";
|
|
3
|
+
export interface IPersonalTcrService {
|
|
4
|
+
ensurePushTarget: (options: {
|
|
5
|
+
namespace: string;
|
|
6
|
+
repository: string;
|
|
7
|
+
ensureNamespace?: boolean;
|
|
8
|
+
ensureRepository?: boolean;
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
cleanupTags: (options: {
|
|
11
|
+
namespace: string;
|
|
12
|
+
repository: string;
|
|
13
|
+
retain?: number;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare class PersonalTcrService implements IPersonalTcrService {
|
|
17
|
+
private readonly request;
|
|
18
|
+
constructor(environment: Environment);
|
|
19
|
+
ensurePushTarget(options: {
|
|
20
|
+
namespace: string;
|
|
21
|
+
repository: string;
|
|
22
|
+
ensureNamespace?: boolean;
|
|
23
|
+
ensureRepository?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
cleanupTags(options: {
|
|
26
|
+
namespace: string;
|
|
27
|
+
repository: string;
|
|
28
|
+
retain?: number;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
private namespaceExists;
|
|
31
|
+
private repositoryExists;
|
|
32
|
+
private createIgnoringExisting;
|
|
33
|
+
private listAllTags;
|
|
34
|
+
}
|
|
35
|
+
export declare function createPersonalTcrService(environment: Environment): IPersonalTcrService;
|
package/types/deploy/types.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type DeployActionKind = 'create' | 'update' | 'replace' | 'noop';
|
|
|
22
22
|
/** 部署计划中的细粒度操作 */
|
|
23
23
|
export type DeployOperation = 'create-function' | 'update-code' | 'update-config' | 'replace-function' | 'configure-access' | 'configure-gateway';
|
|
24
24
|
/** 统一进度阶段 */
|
|
25
|
-
export type DeployStage = 'validate' | 'preflight' | 'plan' | 'pack' | 'upload' | 'build' | 'push' | 'deploy-function' | 'wait-active' | 'configure-access' | 'configure-gateway' | 'done';
|
|
25
|
+
export type DeployStage = 'validate' | 'preflight' | 'plan' | 'pack' | 'upload' | 'login' | 'build' | 'push' | 'deploy-function' | 'wait-active' | 'configure-access' | 'configure-gateway' | 'done';
|
|
26
26
|
/** 单项检查结论 */
|
|
27
27
|
export type CheckStatus = 'pass' | 'warn' | 'fail';
|
|
28
28
|
/**
|
|
@@ -94,6 +94,17 @@ export declare const FUNCTION_DEPLOY_ERROR: {
|
|
|
94
94
|
readonly BUILD_ARG_INVALID: "BUILD_ARG_INVALID";
|
|
95
95
|
readonly CLOUD_REGISTRY_CREDENTIAL_MISSING: "CLOUD_REGISTRY_CREDENTIAL_MISSING";
|
|
96
96
|
readonly CLOUD_REGISTRY_CREDENTIAL_INVALID: "CLOUD_REGISTRY_CREDENTIAL_INVALID";
|
|
97
|
+
readonly TCR_REGION_MISSING: "TCR_REGION_MISSING";
|
|
98
|
+
readonly TCR_INSTANCE_DISCOVERY_FAILED: "TCR_INSTANCE_DISCOVERY_FAILED";
|
|
99
|
+
readonly TCR_INSTANCE_NOT_FOUND: "TCR_INSTANCE_NOT_FOUND";
|
|
100
|
+
readonly TCR_INSTANCE_AMBIGUOUS: "TCR_INSTANCE_AMBIGUOUS";
|
|
101
|
+
readonly TCR_INSTANCE_INVALID: "TCR_INSTANCE_INVALID";
|
|
102
|
+
readonly TCR_NAMESPACE_INVALID: "TCR_NAMESPACE_INVALID";
|
|
103
|
+
readonly TCR_NAMESPACE_QUERY_FAILED: "TCR_NAMESPACE_QUERY_FAILED";
|
|
104
|
+
readonly TCR_NAMESPACE_CREATE_FAILED: "TCR_NAMESPACE_CREATE_FAILED";
|
|
105
|
+
readonly TCR_TOKEN_CREATE_FAILED: "TCR_TOKEN_CREATE_FAILED";
|
|
106
|
+
readonly TCR_TOKEN_INVALID: "TCR_TOKEN_INVALID";
|
|
107
|
+
readonly TCR_DOCKER_LOGIN_FAILED: "TCR_DOCKER_LOGIN_FAILED";
|
|
97
108
|
readonly GATEWAY_PATH_INVALID: "GATEWAY_PATH_INVALID";
|
|
98
109
|
readonly LOCAL_FALLBACK_INVALID: "LOCAL_FALLBACK_INVALID";
|
|
99
110
|
readonly PREFLIGHT_CODE_PATH_MISSING: "PREFLIGHT_CODE_PATH_MISSING";
|
|
@@ -243,7 +254,7 @@ export interface IHttpZipDeployConfig extends IHttpFunctionDeployCommon, ILocalC
|
|
|
243
254
|
*/
|
|
244
255
|
installDependency?: boolean | 'TRUE' | 'FALSE';
|
|
245
256
|
}
|
|
246
|
-
/** 个人版 TCR
|
|
257
|
+
/** 个人版 TCR 推送凭证,local/cloud 均可使用。 */
|
|
247
258
|
export interface IRegistryCredential {
|
|
248
259
|
/** 腾讯云账号 ID(UIN),作为个人版 CCR 登录用户名 */
|
|
249
260
|
username: string;
|
|
@@ -258,12 +269,14 @@ export interface IImageBuildTarget {
|
|
|
258
269
|
dockerfile?: string;
|
|
259
270
|
/** 目标镜像仓库实例 ID */
|
|
260
271
|
registryId?: string;
|
|
261
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* 目标镜像命名空间。personal local/cloud 优先使用显式配置;
|
|
274
|
+
* 缺省时使用当前 CloudBase envId。enterprise 可省略并由实例准备逻辑创建或复用。
|
|
275
|
+
*/
|
|
262
276
|
namespace?: string;
|
|
263
277
|
/**
|
|
264
|
-
* 目标镜像仓库路径。
|
|
265
|
-
*
|
|
266
|
-
* local 策略当前需提供可直接 push 的完整 registry/namespace/repository 地址。
|
|
278
|
+
* 目标镜像仓库路径。local/cloud 均可省略并默认使用函数名;
|
|
279
|
+
* manager-node 会结合目标 registry 与 namespace 组装最终推送地址。
|
|
267
280
|
*/
|
|
268
281
|
repository?: string;
|
|
269
282
|
/** local 策略的目标镜像 tag;cloud 策略由平台生成,不接受自定义 tag */
|
|
@@ -272,10 +285,15 @@ export interface IImageBuildTarget {
|
|
|
272
285
|
platform?: string;
|
|
273
286
|
/** 构建参数,不得写入敏感值 */
|
|
274
287
|
buildArgs?: Record<string, string>;
|
|
275
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* 个人版 TCR 推送凭证。personal local/cloud 必须由调用方显式提供;
|
|
290
|
+
* manager-node 仅使用该凭证登录,不创建用户、不修改远端密码,也不持久化凭证。
|
|
291
|
+
*/
|
|
276
292
|
registryCredential?: IRegistryCredential;
|
|
277
293
|
/** 忽略同摘要镜像复用,强制重新构建 */
|
|
278
294
|
forceBuild?: boolean;
|
|
295
|
+
/** 个人版 TCR 保留的最新镜像标签数量 */
|
|
296
|
+
retainedTags?: number;
|
|
279
297
|
}
|
|
280
298
|
/** HTTP 自定义镜像公共配置 */
|
|
281
299
|
export interface IHttpImageRuntimeCommon extends IHttpFunctionDeployCommon {
|
|
@@ -413,16 +431,25 @@ export interface IFunctionDeployPlan {
|
|
|
413
431
|
/** 单步执行结果 */
|
|
414
432
|
export interface IDeployStepResult {
|
|
415
433
|
stage: DeployStage;
|
|
434
|
+
/** 同一 stage 下的具体步骤名称,例如 Docker 环境检查、镜像仓库权限检查 */
|
|
435
|
+
label?: string;
|
|
416
436
|
status: 'success' | 'skipped' | 'failed';
|
|
417
437
|
/** 毫秒 */
|
|
418
438
|
elapsedTime: number;
|
|
419
439
|
detail?: string;
|
|
440
|
+
errorCode?: string;
|
|
420
441
|
}
|
|
421
442
|
/** 进度事件 */
|
|
422
443
|
export interface IDeployProgressEvent {
|
|
423
444
|
stage: DeployStage;
|
|
445
|
+
/** 同一 stage 下的具体步骤名称,例如 Docker 环境检查、镜像仓库权限检查 */
|
|
446
|
+
label?: string;
|
|
424
447
|
status: 'start' | 'success' | 'skipped' | 'failed';
|
|
425
448
|
message?: string;
|
|
449
|
+
/** 当前阶段耗时(毫秒),仅 success/failed 时提供 */
|
|
450
|
+
elapsedTime?: number;
|
|
451
|
+
errorCode?: string;
|
|
452
|
+
requestId?: string;
|
|
426
453
|
}
|
|
427
454
|
/** 部署结果 */
|
|
428
455
|
export interface IFunctionDeployResult {
|
|
@@ -447,7 +474,6 @@ export interface IFunctionDeployResult {
|
|
|
447
474
|
warnings: string[];
|
|
448
475
|
plan: IFunctionDeployPlan;
|
|
449
476
|
}
|
|
450
|
-
/** 部署选项 */
|
|
451
477
|
export interface IFunctionDeployOptions {
|
|
452
478
|
/** 只生成计划,不执行任何变更 */
|
|
453
479
|
dryRun?: boolean;
|
package/types/hosting/index.d.ts
CHANGED
|
@@ -229,6 +229,9 @@ export declare class HostingService {
|
|
|
229
229
|
}>;
|
|
230
230
|
/**
|
|
231
231
|
* 查询域名状态信息
|
|
232
|
+
*
|
|
233
|
+
* 仅在 CDN 域名(domainType=cdn)或老环境(未返回 domainType)时调用 CDN 接口,
|
|
234
|
+
* 其他域名类型(gateway / eo 等)返回空结果
|
|
232
235
|
* @param options
|
|
233
236
|
*/
|
|
234
237
|
tcbCheckResource(options: ICheckSourceOptions): Promise<{
|
|
@@ -238,6 +241,9 @@ export declare class HostingService {
|
|
|
238
241
|
}>;
|
|
239
242
|
/**
|
|
240
243
|
* 域名配置变更
|
|
244
|
+
*
|
|
245
|
+
* 仅在 CDN 域名(domainType=cdn)或老环境(未返回 domainType)时调用 CDN 接口,
|
|
246
|
+
* 其他域名类型(gateway / eo 等)返回空结果
|
|
241
247
|
* @param options
|
|
242
248
|
*/
|
|
243
249
|
tcbModifyAttribute(options: IModifyOptions): Promise<{}>;
|
|
@@ -263,4 +269,11 @@ export declare class HostingService {
|
|
|
263
269
|
* 将 cloudPath 转换成 cloudPath/ 形式
|
|
264
270
|
*/
|
|
265
271
|
private getCloudKey;
|
|
272
|
+
/**
|
|
273
|
+
* 获取静态托管域名类型(cdn / gateway / eo)
|
|
274
|
+
*
|
|
275
|
+
* 后端通过 DescribeEnvInfo 返回 StaticStorages[0].DomainType,
|
|
276
|
+
* 仅 cdn 或空值(老环境)才允许调用 CDN 相关接口。
|
|
277
|
+
*/
|
|
278
|
+
private getStorageDomainType;
|
|
266
279
|
}
|
|
@@ -5,8 +5,9 @@ export declare class ProjectValidator {
|
|
|
5
5
|
private validateSchema;
|
|
6
6
|
private validateEnvId;
|
|
7
7
|
/**
|
|
8
|
-
* 个人版 TCR 的 username/password
|
|
9
|
-
*
|
|
8
|
+
* 个人版 TCR 的 username/password 必须在 cloudbaserc 中显式声明。
|
|
9
|
+
* namespace/repository 可省略,分别由部署器按 envId/函数名推导。
|
|
10
|
+
* ConfigParser 已先解析 {{env.*}},因此这里同时承担缺失凭证 env 值的前置校验。
|
|
10
11
|
*/
|
|
11
12
|
private validatePersonalRegistryConfig;
|
|
12
13
|
private hasPersonalCloudFunction;
|