openxiangda 1.0.184 → 1.0.186
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/application-environments.js +36 -0
- package/lib/cli.js +30 -16
- package/package.json +1 -1
|
@@ -115,6 +115,33 @@ function normalizeManagedReleaseSourceRevision(
|
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
function normalizeManagedChangeSourceBase(
|
|
119
|
+
target,
|
|
120
|
+
sourceBase,
|
|
121
|
+
releaseSourceRevision
|
|
122
|
+
) {
|
|
123
|
+
const logicalApp = target?.logicalApp || target?.state?.logicalApp;
|
|
124
|
+
if (!logicalApp?.sourceRepositoryId) {
|
|
125
|
+
return cloneJsonValue(sourceBase);
|
|
126
|
+
}
|
|
127
|
+
return normalizeManagedReleaseSourceRevision(
|
|
128
|
+
target,
|
|
129
|
+
{
|
|
130
|
+
...(sourceBase || {}),
|
|
131
|
+
repositoryId: sourceBase?.repo,
|
|
132
|
+
repoAliases: [
|
|
133
|
+
sourceBase?.repo,
|
|
134
|
+
releaseSourceRevision?.repo,
|
|
135
|
+
releaseSourceRevision?.repositoryId,
|
|
136
|
+
...(Array.isArray(releaseSourceRevision?.repoAliases)
|
|
137
|
+
? releaseSourceRevision.repoAliases
|
|
138
|
+
: []),
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
{ errorCode: 'RELEASE_SOURCE_BASE_REPOSITORY_MISMATCH' }
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
118
145
|
function hasStateResourceMappings(value) {
|
|
119
146
|
if (Array.isArray(value)) return value.length > 0;
|
|
120
147
|
if (!value || typeof value !== 'object') {
|
|
@@ -349,11 +376,19 @@ function withManagedReleaseForwardedFlags(stepId, args = [], flags = {}) {
|
|
|
349
376
|
return forwarded;
|
|
350
377
|
}
|
|
351
378
|
|
|
379
|
+
function withReleaseClientSessionArgs(args = [], flags = {}) {
|
|
380
|
+
const clientSessionId = String(flags['client-session-id'] || '').trim();
|
|
381
|
+
return clientSessionId
|
|
382
|
+
? [...args, '--client-session-id', clientSessionId]
|
|
383
|
+
: [...args];
|
|
384
|
+
}
|
|
385
|
+
|
|
352
386
|
module.exports = {
|
|
353
387
|
bindEnvironmentTarget,
|
|
354
388
|
buildCandidateBundle,
|
|
355
389
|
canonicalJson,
|
|
356
390
|
normalizeEnvironmentKind,
|
|
391
|
+
normalizeManagedChangeSourceBase,
|
|
357
392
|
normalizeManagedReleaseSourceRevision,
|
|
358
393
|
normalizeTargetName,
|
|
359
394
|
hasStateResourceMappings,
|
|
@@ -365,5 +400,6 @@ module.exports = {
|
|
|
365
400
|
saveCandidate,
|
|
366
401
|
sha256Canonical,
|
|
367
402
|
withManagedReleaseForwardedFlags,
|
|
403
|
+
withReleaseClientSessionArgs,
|
|
368
404
|
writePrivateJsonAtomic,
|
|
369
405
|
};
|
package/lib/cli.js
CHANGED
|
@@ -131,6 +131,7 @@ const {
|
|
|
131
131
|
bindEnvironmentTarget,
|
|
132
132
|
buildCandidateBundle,
|
|
133
133
|
normalizeEnvironmentKind,
|
|
134
|
+
normalizeManagedChangeSourceBase,
|
|
134
135
|
normalizeManagedReleaseSourceRevision,
|
|
135
136
|
readCandidate,
|
|
136
137
|
readJsonInput,
|
|
@@ -140,6 +141,7 @@ const {
|
|
|
140
141
|
saveCandidate,
|
|
141
142
|
sha256Canonical,
|
|
142
143
|
withManagedReleaseForwardedFlags,
|
|
144
|
+
withReleaseClientSessionArgs,
|
|
143
145
|
} = require('./application-environments');
|
|
144
146
|
const { startDeveloperCenter } = require('./developer-center');
|
|
145
147
|
const {
|
|
@@ -1471,6 +1473,7 @@ function changeIdFromStep(step) {
|
|
|
1471
1473
|
async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
1472
1474
|
const changeId = readStringFlag(flags, 'change');
|
|
1473
1475
|
const deploymentId = readStringFlag(flags, 'deployment-id') || null;
|
|
1476
|
+
const clientSessionId = readStringFlag(flags, 'client-session-id');
|
|
1474
1477
|
if (!changeId) {
|
|
1475
1478
|
fail('用法: openxiangda release publish --change <id> --profile <name>');
|
|
1476
1479
|
}
|
|
@@ -1613,6 +1616,10 @@ async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
|
1613
1616
|
id: 'lease-and-capture',
|
|
1614
1617
|
command: `openxiangda release begin --change ${changeId} --profile ${target.profileName}${
|
|
1615
1618
|
target.targetName ? ` --environment ${target.targetName}` : ''
|
|
1619
|
+
}${
|
|
1620
|
+
clientSessionId
|
|
1621
|
+
? ` --client-session-id ${clientSessionId}`
|
|
1622
|
+
: ''
|
|
1616
1623
|
} --freeze-app-capture`,
|
|
1617
1624
|
status: 'pending',
|
|
1618
1625
|
},
|
|
@@ -1658,21 +1665,24 @@ async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
|
1658
1665
|
const runnable = [
|
|
1659
1666
|
{
|
|
1660
1667
|
id: 'lease-and-capture',
|
|
1661
|
-
args:
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1668
|
+
args: withReleaseClientSessionArgs(
|
|
1669
|
+
[
|
|
1670
|
+
'release',
|
|
1671
|
+
'begin',
|
|
1672
|
+
'--change',
|
|
1673
|
+
changeId,
|
|
1674
|
+
'--profile',
|
|
1675
|
+
target.profileName,
|
|
1676
|
+
...(target.targetName
|
|
1677
|
+
? ['--environment', target.targetName]
|
|
1678
|
+
: []),
|
|
1679
|
+
...(deploymentId
|
|
1680
|
+
? ['--deployment-id', deploymentId]
|
|
1681
|
+
: []),
|
|
1682
|
+
'--freeze-app-capture',
|
|
1683
|
+
],
|
|
1684
|
+
flags
|
|
1685
|
+
),
|
|
1676
1686
|
},
|
|
1677
1687
|
...steps,
|
|
1678
1688
|
{
|
|
@@ -4921,7 +4931,6 @@ async function ensureChangeBaseline(
|
|
|
4921
4931
|
return stored;
|
|
4922
4932
|
}
|
|
4923
4933
|
const activeLease = getUsableStoredPublishLease(target);
|
|
4924
|
-
const sourceBase = resolveChangeSourceBase(changeId, flags);
|
|
4925
4934
|
const releaseSourceRevision = normalizeManagedReleaseSourceRevision(
|
|
4926
4935
|
target,
|
|
4927
4936
|
prepareReleaseSourceRevision({
|
|
@@ -4929,6 +4938,11 @@ async function ensureChangeBaseline(
|
|
|
4929
4938
|
}),
|
|
4930
4939
|
{ errorCode: 'RELEASE_SOURCE_REPOSITORY_MISMATCH' }
|
|
4931
4940
|
);
|
|
4941
|
+
const sourceBase = normalizeManagedChangeSourceBase(
|
|
4942
|
+
target,
|
|
4943
|
+
resolveChangeSourceBase(changeId, flags),
|
|
4944
|
+
releaseSourceRevision
|
|
4945
|
+
);
|
|
4932
4946
|
|
|
4933
4947
|
const data = await requestWithAuth(
|
|
4934
4948
|
config,
|