@cloudbase/manager-node 5.8.2 → 5.8.4
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 +15 -0
- package/lib/database/index.js +11 -6
- package/lib/deploy/DeployOrchestrator.js +170 -278
- package/lib/deploy/FunctionDeployer.js +310 -52
- package/lib/deploy/StaticDeployer.js +7 -1
- package/lib/deploy/function/artifact.js +55 -41
- package/lib/deploy/function/builders/cloud.js +58 -359
- package/lib/deploy/function/cam-preflight.js +2 -1
- package/lib/deploy/function/cloud-build-service.js +2 -16
- package/lib/deploy/function/config-guard.js +210 -55
- package/lib/deploy/function/enterprise-tcr.js +195 -0
- package/lib/deploy/function/image-tag.js +31 -0
- package/lib/deploy/function/local-builder.js +178 -32
- package/lib/deploy/function/personal-tcr.js +153 -0
- package/lib/deploy/function/preflight.js +3 -2
- package/lib/deploy/types.js +11 -0
- package/lib/hosting/index.js +27 -0
- package/lib/projectValidator/index.js +22 -23
- package/package.json +2 -2
- package/types/database/index.d.ts +1 -0
- package/types/deploy/DeployOrchestrator.d.ts +19 -25
- package/types/deploy/FunctionDeployer.d.ts +35 -3
- package/types/deploy/StaticDeployer.d.ts +11 -0
- package/types/deploy/function/artifact.d.ts +0 -5
- package/types/deploy/function/builders/cloud.d.ts +6 -39
- package/types/deploy/function/config-guard.d.ts +18 -0
- 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 +110 -28
- package/types/hosting/index.d.ts +13 -0
- package/types/projectValidator/index.d.ts +3 -2
- package/types/projectValidator/types.d.ts +0 -1
- package/lib/deploy/StateStore.js +0 -328
- package/types/deploy/StateStore.d.ts +0 -174
|
@@ -5,12 +5,30 @@ exports.createImageArtifactFromConfig = createImageArtifactFromConfig;
|
|
|
5
5
|
exports.createImageArtifactFromBuild = createImageArtifactFromBuild;
|
|
6
6
|
exports.createImageArtifactFromCloudBuild = createImageArtifactFromCloudBuild;
|
|
7
7
|
exports.toCloudFunction = toCloudFunction;
|
|
8
|
+
const error_1 = require("../../error");
|
|
8
9
|
const types_1 = require("../types");
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* 解析构建类镜像部署物的 SCF RegistryId
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
+
* 个人版镜像(personal,如个人版 CCR)不携带 registryId;企业版优先取
|
|
14
|
+
* imageConfig.registryId,回退到构建配置 imageConfig.build.registryId。
|
|
15
|
+
* 正常流程下企业版 registryId 已由 prepareEnterpriseTcrTarget 在构建前解析补齐,
|
|
16
|
+
* 此处对缺失场景 fail-fast 并给出明确错误:避免产出缺少 RegistryId 的部署物,
|
|
17
|
+
* 导致后续 SCF 拉取企业版镜像时失败且难以排查。
|
|
13
18
|
*/
|
|
19
|
+
function resolveBuildRegistryId(imageConfig) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
if (imageConfig.imageType !== 'enterprise') {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const registryId = (_a = imageConfig.registryId) !== null && _a !== void 0 ? _a : (_b = imageConfig.build) === null || _b === void 0 ? void 0 : _b.registryId;
|
|
25
|
+
if (!registryId) {
|
|
26
|
+
throw new error_1.CloudBaseError('企业版镜像缺少 TCR 实例 ID(registryId),无法生成镜像部署物。', {
|
|
27
|
+
code: types_1.FUNCTION_DEPLOY_ERROR.IMAGE_REGISTRY_ID_MISSING
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return registryId;
|
|
31
|
+
}
|
|
14
32
|
/** 由本地代码来源构造代码类部署物 */
|
|
15
33
|
function createCodeArtifact(config) {
|
|
16
34
|
const functionRootPath = 'functionRootPath' in config ? config.functionRootPath : undefined;
|
|
@@ -28,28 +46,26 @@ function createCodeArtifact(config) {
|
|
|
28
46
|
}
|
|
29
47
|
/** 由已有镜像配置构造镜像类部署物 */
|
|
30
48
|
function createImageArtifactFromConfig(config) {
|
|
31
|
-
var _a
|
|
49
|
+
var _a;
|
|
32
50
|
const { imageConfig } = config;
|
|
33
|
-
//
|
|
34
|
-
// 与 local/cloud 策略一致;imageConfig 内的同名字段仅作向后兼容兜底。
|
|
51
|
+
// 直接读取 cloudbaserc 嵌套形状:镜像字段全部位于 imageConfig。
|
|
35
52
|
// 个人版镜像(personal,如个人版 CCR)不应携带 registryId。
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const registryId = imageType === 'enterprise' ? configuredRegistryId : undefined;
|
|
53
|
+
const imageType = imageConfig.imageType;
|
|
54
|
+
const registryId = imageType === 'enterprise' ? imageConfig.registryId : undefined;
|
|
39
55
|
return {
|
|
40
56
|
kind: 'image',
|
|
41
57
|
deployMode: 'image',
|
|
42
58
|
imageUri: imageConfig.imageUri,
|
|
43
59
|
imageType,
|
|
44
60
|
registryId,
|
|
45
|
-
imagePort: types_1.IMAGE_FUNCTION_PORT,
|
|
61
|
+
imagePort: (_a = imageConfig.imagePort) !== null && _a !== void 0 ? _a : types_1.IMAGE_FUNCTION_PORT,
|
|
46
62
|
effectiveStrategy: 'image',
|
|
47
|
-
entryPoint:
|
|
48
|
-
command:
|
|
49
|
-
args:
|
|
50
|
-
commandList:
|
|
51
|
-
argsList:
|
|
52
|
-
containerImageAccelerate:
|
|
63
|
+
entryPoint: imageConfig.entryPoint,
|
|
64
|
+
command: imageConfig.command,
|
|
65
|
+
args: imageConfig.args,
|
|
66
|
+
commandList: imageConfig.commandList,
|
|
67
|
+
argsList: imageConfig.argsList,
|
|
68
|
+
containerImageAccelerate: imageConfig.containerImageAccelerate
|
|
53
69
|
};
|
|
54
70
|
}
|
|
55
71
|
/**
|
|
@@ -59,11 +75,10 @@ function createImageArtifactFromConfig(config) {
|
|
|
59
75
|
* 此处仅承载最终 imageUri/digest 与容器启动配置,之后复用镜像部署链。
|
|
60
76
|
*/
|
|
61
77
|
function createImageArtifactFromBuild(config, build) {
|
|
62
|
-
var _a
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
: undefined;
|
|
78
|
+
var _a;
|
|
79
|
+
const { imageConfig } = config;
|
|
80
|
+
const imageType = imageConfig.imageType;
|
|
81
|
+
const registryId = resolveBuildRegistryId(imageConfig);
|
|
67
82
|
return {
|
|
68
83
|
kind: 'image',
|
|
69
84
|
deployMode: 'image',
|
|
@@ -71,14 +86,14 @@ function createImageArtifactFromBuild(config, build) {
|
|
|
71
86
|
imageDigest: build.imageDigest,
|
|
72
87
|
imageType,
|
|
73
88
|
registryId,
|
|
74
|
-
imagePort: types_1.IMAGE_FUNCTION_PORT,
|
|
89
|
+
imagePort: (_a = imageConfig.imagePort) !== null && _a !== void 0 ? _a : types_1.IMAGE_FUNCTION_PORT,
|
|
75
90
|
effectiveStrategy: 'local',
|
|
76
|
-
entryPoint:
|
|
77
|
-
command:
|
|
78
|
-
args:
|
|
79
|
-
commandList:
|
|
80
|
-
argsList:
|
|
81
|
-
containerImageAccelerate:
|
|
91
|
+
entryPoint: imageConfig.entryPoint,
|
|
92
|
+
command: imageConfig.command,
|
|
93
|
+
args: imageConfig.args,
|
|
94
|
+
commandList: imageConfig.commandList,
|
|
95
|
+
argsList: imageConfig.argsList,
|
|
96
|
+
containerImageAccelerate: imageConfig.containerImageAccelerate
|
|
82
97
|
};
|
|
83
98
|
}
|
|
84
99
|
/**
|
|
@@ -89,30 +104,29 @@ function createImageArtifactFromBuild(config, build) {
|
|
|
89
104
|
* effectiveStrategy 标记为 cloud,便于结果层如实回传实际生效的策略。
|
|
90
105
|
*/
|
|
91
106
|
function createImageArtifactFromCloudBuild(config, build) {
|
|
92
|
-
var _a
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
var _a;
|
|
108
|
+
const { imageConfig } = config;
|
|
109
|
+
const imageType = imageConfig.imageType;
|
|
110
|
+
// 云端构建默认推送到个人版 TCR(CCR);企业版实例 ID 位于 imageConfig.build.registryId,
|
|
111
|
+
// 需继续透传到 Stage B 的 SCF ImageConfig,避免构建成功后拉取镜像时丢失 RegistryId。
|
|
112
|
+
const registryId = resolveBuildRegistryId(imageConfig);
|
|
97
113
|
return {
|
|
98
114
|
kind: 'image',
|
|
99
115
|
deployMode: 'image',
|
|
100
116
|
imageUri: build.imageUri,
|
|
101
117
|
imageDigest: build.imageDigest,
|
|
102
|
-
// 云端构建默认推送到个人版 TCR(CCR);企业版实例 ID 位于 build.registryId,
|
|
103
|
-
// 需继续透传到 Stage B 的 SCF ImageConfig,避免构建成功后拉取镜像时丢失 RegistryId。
|
|
104
118
|
imageType,
|
|
105
119
|
registryId,
|
|
106
|
-
imagePort: types_1.IMAGE_FUNCTION_PORT,
|
|
120
|
+
imagePort: (_a = imageConfig.imagePort) !== null && _a !== void 0 ? _a : types_1.IMAGE_FUNCTION_PORT,
|
|
107
121
|
effectiveStrategy: 'cloud',
|
|
108
122
|
buildId: build.buildId,
|
|
109
123
|
logsUrl: build.logsUrl,
|
|
110
|
-
entryPoint:
|
|
111
|
-
command:
|
|
112
|
-
args:
|
|
113
|
-
commandList:
|
|
114
|
-
argsList:
|
|
115
|
-
containerImageAccelerate:
|
|
124
|
+
entryPoint: imageConfig.entryPoint,
|
|
125
|
+
command: imageConfig.command,
|
|
126
|
+
args: imageConfig.args,
|
|
127
|
+
commandList: imageConfig.commandList,
|
|
128
|
+
argsList: imageConfig.argsList,
|
|
129
|
+
containerImageAccelerate: imageConfig.containerImageAccelerate
|
|
116
130
|
};
|
|
117
131
|
}
|
|
118
132
|
/** 将构建产出的 tag 地址与 digest 合成为 SCF 支持的不可变镜像引用 */
|