openxiangda 1.0.236 → 1.0.237
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/lib/cli.js +5 -16
- package/lib/delivery-v2-cli.js +30 -0
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -166,7 +166,10 @@ const {
|
|
|
166
166
|
withReleaseClientSessionArgs,
|
|
167
167
|
} = require('./application-environments');
|
|
168
168
|
const { startDeveloperCenter } = require('./developer-center');
|
|
169
|
-
const {
|
|
169
|
+
const {
|
|
170
|
+
createDeliveryV2Cli,
|
|
171
|
+
deliveryV2SourceRevision,
|
|
172
|
+
} = require('./delivery-v2-cli');
|
|
170
173
|
const {
|
|
171
174
|
describeOpenApiOperation,
|
|
172
175
|
listOpenApiOperations,
|
|
@@ -1477,20 +1480,6 @@ function getDeliveryV2Cli() {
|
|
|
1477
1480
|
return deliveryV2Cli;
|
|
1478
1481
|
}
|
|
1479
1482
|
|
|
1480
|
-
function deliveryV2SourceRevision(packageDigest) {
|
|
1481
|
-
return {
|
|
1482
|
-
repo: `sha256:${packageDigest}`,
|
|
1483
|
-
repositoryId: `sha256:${packageDigest}`,
|
|
1484
|
-
repoAliases: [`sha256:${packageDigest}`],
|
|
1485
|
-
baseCommit: packageDigest,
|
|
1486
|
-
treeHash: packageDigest,
|
|
1487
|
-
branch: 'delivery-v2',
|
|
1488
|
-
mainBranch: null,
|
|
1489
|
-
remoteName: null,
|
|
1490
|
-
remoteUrlHash: null,
|
|
1491
|
-
};
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
1483
|
function installDeliveryV2Context(target, run, targets = {}) {
|
|
1495
1484
|
const control = run?.control || {};
|
|
1496
1485
|
const publishLeaseId = String(control.publishLeaseId || '').trim();
|
|
@@ -1509,7 +1498,7 @@ function installDeliveryV2Context(target, run, targets = {}) {
|
|
|
1509
1498
|
'DELIVERY_CONTROL_INVALID: ReleaseRun 缺少 publishLease/baseline/change/session/package 控制信息'
|
|
1510
1499
|
);
|
|
1511
1500
|
}
|
|
1512
|
-
const sourceRevision = deliveryV2SourceRevision(packageDigest);
|
|
1501
|
+
const sourceRevision = deliveryV2SourceRevision(target, packageDigest);
|
|
1513
1502
|
saveChangeBaseline(target, {
|
|
1514
1503
|
baselineId,
|
|
1515
1504
|
appType: target.appType,
|
package/lib/delivery-v2-cli.js
CHANGED
|
@@ -166,6 +166,35 @@ function createClientSessionId() {
|
|
|
166
166
|
.toString('hex')}`;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
function deliveryV2SourceRevision(target, packageDigest) {
|
|
170
|
+
const packageRepositoryId = `sha256:${packageDigest}`;
|
|
171
|
+
const logicalRepositoryId = String(
|
|
172
|
+
target?.logicalApp?.sourceRepositoryId ||
|
|
173
|
+
target?.state?.logicalApp?.sourceRepositoryId ||
|
|
174
|
+
''
|
|
175
|
+
)
|
|
176
|
+
.trim()
|
|
177
|
+
.toLowerCase();
|
|
178
|
+
const repoAliases = Array.from(
|
|
179
|
+
new Set(
|
|
180
|
+
[packageRepositoryId, logicalRepositoryId].filter(value =>
|
|
181
|
+
/^sha256:[a-f0-9]{64}$/.test(value)
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
).sort();
|
|
185
|
+
return {
|
|
186
|
+
repo: packageRepositoryId,
|
|
187
|
+
repositoryId: packageRepositoryId,
|
|
188
|
+
repoAliases,
|
|
189
|
+
baseCommit: packageDigest,
|
|
190
|
+
treeHash: packageDigest,
|
|
191
|
+
branch: 'delivery-v2',
|
|
192
|
+
mainBranch: null,
|
|
193
|
+
remoteName: null,
|
|
194
|
+
remoteUrlHash: null,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
169
198
|
function usageError(message) {
|
|
170
199
|
const error = new Error(message);
|
|
171
200
|
error.code = 'DELIVERY_USAGE_ERROR';
|
|
@@ -213,4 +242,5 @@ function assertDependencies(value) {
|
|
|
213
242
|
|
|
214
243
|
module.exports = {
|
|
215
244
|
createDeliveryV2Cli,
|
|
245
|
+
deliveryV2SourceRevision,
|
|
216
246
|
};
|