@uipath/solution-tool 1.206.0-preview.306 → 1.207.0-preview.307
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/dist/THIRD-PARTY-NOTICES.md +4 -4
- package/dist/{archive-extract-ma0gy822.js → archive-extract-afgwacbg.js} +3 -3
- package/dist/{cleanup-command-service-abtxpefz.js → cleanup-command-service-0j6qxj96.js} +20 -15
- package/dist/deploy-delete-service-ghyetrvj.js +23 -0
- package/dist/deploy-run-service-sz77fpsz.js +24 -0
- package/dist/{deploy-status-service-k1gycn13.js → deploy-status-service-aj4m61hg.js} +49 -25
- package/dist/deploy.js +21 -20
- package/dist/{deployment-search-bjdwqh5w.js → deployment-search-mkvzgeq4.js} +9 -9
- package/dist/{embedded-file-reader-pxpwcq3n.js → embedded-file-reader-k94wt612.js} +16 -16
- package/dist/feed-resolver-yj94m9j1.js +31 -0
- package/dist/feed-scope-failure-7abh61sj.js +20 -0
- package/dist/{feed-session-ytew8k2j.js → feed-session-z8t87r5w.js} +6 -6
- package/dist/{first-party-service-6gf3n6d8.js → first-party-service-bmtxd7wx.js} +1 -1
- package/dist/folder-runtime-check-8nf63er2.js +25 -0
- package/dist/{governance-options-40m81z8h.js → governance-options-ft8bqz4p.js} +7 -7
- package/dist/{packager-tool-v3ze7wmr.js → index-6ma58k47.js} +33 -708
- package/dist/{index-yjvmjpdn.js → index-j3tpb2cr.js} +12 -11
- package/dist/{index-p3x7ztdr.js → index-jy1760qy.js} +1 -1
- package/dist/{index-2bn3jzn9.js → index-nbs04tqr.js} +9 -7
- package/dist/index.js +26 -26
- package/dist/init.js +10 -10
- package/dist/{list-0k8c4rt6.js → list-3a1tdrgm.js} +11 -11
- package/dist/models/pack-command-types.d.ts +12 -0
- package/dist/{node-6ay6nbnq.js → node-83xy0gm0.js} +6 -6
- package/dist/pack-command-service-42p3t8xa.js +32 -0
- package/dist/{pack-project-2g2ncn2k.js → pack-project-w514zr5v.js} +21 -18
- package/dist/pack.js +25 -22
- package/dist/{package-id-56k44s7y.js → package-id-2dgfbh5h.js} +3 -3
- package/dist/{packager-tool-2zn98p5r.js → packager-tool-0gyqtxvs.js} +4 -4
- package/dist/{packager-tool-vgrswa8p.js → packager-tool-1db1wqdy.js} +30 -8
- package/dist/{packager-tool-vx2c68sb.js → packager-tool-1dsxhz1r.js} +2 -2
- package/dist/{packager-tool-xxf8f4v2.js → packager-tool-2syv199e.js} +9 -5
- package/dist/packager-tool-3ft8hywr.js +449 -0
- package/dist/{packager-tool-829w06ns.js → packager-tool-3qach0s4.js} +14 -8
- package/dist/{packager-tool-bkmwknfn.js → packager-tool-4f1k64fh.js} +8 -74
- package/dist/{packager-tool-7v03ncmv.js → packager-tool-70ag56bf.js} +49 -24
- package/dist/{packager-tool-5e4gps62.js → packager-tool-71sz9598.js} +20 -8
- package/dist/{packager-tool-23g7kn35.js → packager-tool-7j920ac5.js} +18 -11
- package/dist/packager-tool-7s842xrq.js +140 -0
- package/dist/{packager-tool-s8q14fth.js → packager-tool-849ch2tq.js} +4 -6
- package/dist/{packager-tool-aws5w512.js → packager-tool-887bkh9y.js} +1 -1
- package/dist/{packager-tool-f5pzh184.js → packager-tool-a566400t.js} +26 -10
- package/dist/packager-tool-a813na66.js +75 -0
- package/dist/{packager-tool-c8x0tpe4.js → packager-tool-af8n6rqz.js} +85 -30
- package/dist/{packager-tool-y1304xzm.js → packager-tool-bpdyy6vs.js} +530 -204
- package/dist/{packager-tool-fx4ws49n.js → packager-tool-cenfraf4.js} +2 -2
- package/dist/{packager-tool-0z4aq300.js → packager-tool-cwqy5rb5.js} +119 -52
- package/dist/{packager-tool-a7s0gbxs.js → packager-tool-devc4w73.js} +7 -2
- package/dist/{packager-tool-pqk9v4h7.js → packager-tool-fbajevvm.js} +52 -15
- package/dist/{packager-tool-r0ha8c95.js → packager-tool-fz96p75n.js} +3 -3
- package/dist/{packager-tool-m07vyk89.js → packager-tool-gb3dq79g.js} +36 -9
- package/dist/{packager-tool-h8tksb5s.js → packager-tool-gns0nxbt.js} +28 -9
- package/dist/{packager-tool-wjvks6st.js → packager-tool-h8wam8pt.js} +15 -6
- package/dist/{packager-tool-z4cbca95.js → packager-tool-hczpvrc1.js} +6 -6
- package/dist/{packager-tool-t39pjz7n.js → packager-tool-jtvhkavz.js} +48 -6
- package/dist/{packager-tool-p5322gew.js → packager-tool-kmwjscby.js} +88 -10
- package/dist/{packager-tool-ppj5f4y7.js → packager-tool-n1zrk6zv.js} +4 -2
- package/dist/{packager-tool-2qsbh4kd.js → packager-tool-ncgpx1ce.js} +50 -12
- package/dist/{packager-tool-f15an17m.js → packager-tool-p1xfsv6c.js} +92 -4
- package/dist/{packager-tool-egc54x78.js → packager-tool-qhht1tc9.js} +2408 -771
- package/dist/packager-tool-r7fmsz2t.js +741 -0
- package/dist/{packager-tool-resolver-30hxk8vm.js → packager-tool-resolver-mynfj0rt.js} +6 -6
- package/dist/{packager-tool-ay4j9x92.js → packager-tool-s9tyw75r.js} +19 -8
- package/dist/{packager-tool-ckrt4gyr.js → packager-tool-t9zked1m.js} +3 -3
- package/dist/{packager-tool-1ctvbx0h.js → packager-tool-tr3ttz5c.js} +1 -1
- package/dist/{packager-tool-chff74yz.js → packager-tool-tt9v40x6.js} +3010 -846
- package/dist/{packager-tool-k9dk39tg.js → packager-tool-txygqgb2.js} +3 -3
- package/dist/packager-tool-v6jcys3s.js +46 -0
- package/dist/packager-tool-w0tmr9xe.js +279 -0
- package/dist/packager-tool-w35s60sx.js +179 -0
- package/dist/{packager-tool-axqk17xw.js → packager-tool-xbfr6y2x.js} +142 -34
- package/dist/{packager-tool-m5mwc6by.js → packager-tool-zsv8208n.js} +22 -18
- package/dist/{packager-tool-vrw36pdb.js → packager-tool-ztxsccjk.js} +140 -10
- package/dist/packager-tool.js +2 -2
- package/dist/prepare-solution-resources-g9y01pgd.js +26 -0
- package/dist/{project-command-utils-82tja3k0.js → project-command-utils-yxrgwzf9.js} +20 -13
- package/dist/project-contributions-c8v3bwjr.js +31 -0
- package/dist/project-identity-telemetry-yxdhswyq.js +18 -0
- package/dist/publish.js +14 -14
- package/dist/{resource-mutations-h6wfdqr4.js → resource-mutations-dn4f8xr1.js} +9 -9
- package/dist/{resource-version-lookup-xzgnvr48.js → resource-version-lookup-mksxc1dc.js} +9 -9
- package/dist/resource.js +9 -9
- package/dist/{restore-command-service-bqs7r9y3.js → restore-command-service-ztbt2ejp.js} +20 -15
- package/dist/run-service-r52wgf69.js +1056 -0
- package/dist/services/deploy-activate-service.d.ts +5 -2
- package/dist/services/deploy-config-file.d.ts +24 -0
- package/dist/services/deploy-delete-service.d.ts +1 -1
- package/dist/services/deploy-run-service.d.ts +8 -1
- package/dist/services/deploy-uninstall-service.d.ts +4 -2
- package/dist/services/deploy-upgrade-service.d.ts +23 -2
- package/dist/services/deployment-feed-locator.d.ts +19 -6
- package/dist/services/deployment-links.d.ts +16 -0
- package/dist/services/deployment-progress.d.ts +10 -0
- package/dist/services/deployment-search.d.ts +15 -2
- package/dist/services/deployment-state.d.ts +9 -0
- package/dist/services/feed-resolver.d.ts +17 -0
- package/dist/services/feed-selection.d.ts +59 -0
- package/dist/services/folder-runtime-check.d.ts +107 -0
- package/dist/services/incomplete-feed-sweep.d.ts +6 -0
- package/dist/services/pack-command-service.d.ts +6 -0
- package/dist/services/pack-project.d.ts +1 -1
- package/dist/services/package-metadata-rewrite.d.ts +13 -0
- package/dist/services/personal-workspace-resolver.d.ts +4 -1
- package/dist/services/prepare-solution-resources.d.ts +11 -6
- package/dist/services/project-contributions.d.ts +26 -2
- package/dist/services/project-identity-telemetry.d.ts +31 -0
- package/dist/services/solution-members.d.ts +31 -0
- package/dist/{ship-telemetry-19gx83af.js → ship-telemetry-9djqndmy.js} +4 -4
- package/dist/{solution-auth-jxcgd2m0.js → solution-auth-0e3qm74f.js} +3 -3
- package/dist/{solution-definition-helper-tqwd6cxn.js → solution-definition-helper-dreejga4.js} +1 -1
- package/dist/{solution-identity-c23d9bfv.js → solution-identity-j63p6n81.js} +4 -4
- package/dist/templates/AGENTS.md +131 -24
- package/dist/tool.js +26 -26
- package/package.json +2 -2
- package/dist/deploy-delete-service-as1jfycj.js +0 -23
- package/dist/deploy-run-service-gs1xv1y1.js +0 -23
- package/dist/feed-resolver-x0kt3yrw.js +0 -27
- package/dist/feed-scope-failure-9p8w0j1v.js +0 -20
- package/dist/pack-command-service-jzbch4eb.js +0 -29
- package/dist/packager-tool-qpryf1x2.js +0 -74
- package/dist/packager-tool-vrqbbh01.js +0 -182
- package/dist/prepare-solution-resources-h7zvnncd.js +0 -26
- package/dist/project-contributions-xx560n8y.js +0 -27
- package/dist/run-service-ekbx2jdg.js +0 -506
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError,
|
|
3
|
+
extractErrorDetails
|
|
4
|
+
} from "./packager-tool-gb3dq79g.js";
|
|
5
|
+
import {
|
|
6
|
+
logger,
|
|
7
|
+
PollOutcome,
|
|
8
|
+
mapPollFailure,
|
|
9
|
+
quoteForShell
|
|
10
|
+
} from "./packager-tool-xbfr6y2x.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveFolder
|
|
13
|
+
} from "./packager-tool-qhht1tc9.js";
|
|
14
|
+
import {
|
|
15
|
+
Configuration2,
|
|
16
|
+
PipelinesApi,
|
|
17
|
+
DeploymentSearchNeedsUserSessionError,
|
|
18
|
+
isAuthRefusal,
|
|
19
|
+
classifyFeedSession2,
|
|
20
|
+
feedSessionRefusal2,
|
|
21
|
+
feedSessionRefusalAsync2
|
|
22
|
+
} from "./packager-tool-hczpvrc1.js";
|
|
23
|
+
import {
|
|
24
|
+
Configuration3,
|
|
25
|
+
SolutionDeploymentAction2,
|
|
26
|
+
DeploymentsApi2
|
|
27
|
+
} from "./packager-tool-2syv199e.js";
|
|
28
|
+
import {
|
|
29
|
+
getSolutionAuthContext2
|
|
30
|
+
} from "./packager-tool-n1zrk6zv.js";
|
|
31
|
+
import {
|
|
32
|
+
readDeploymentByKeyAsync2,
|
|
33
|
+
findDeploymentsByPackageName2,
|
|
34
|
+
DeploymentSearchCapError2,
|
|
35
|
+
blocksRedeploy2,
|
|
36
|
+
MAX_LISTED_DEPLOYMENTS2,
|
|
37
|
+
formatExistingDeployments2,
|
|
38
|
+
findDeploymentsByName2,
|
|
39
|
+
findDeploymentBestEffort2,
|
|
40
|
+
newestDeploymentRow2,
|
|
41
|
+
interpretFailedDeployPoll2,
|
|
42
|
+
resolveInstalledFolder2
|
|
43
|
+
} from "./packager-tool-3qach0s4.js";
|
|
44
|
+
import {
|
|
45
|
+
activateDeployment,
|
|
46
|
+
buildDeploymentLinks,
|
|
47
|
+
readDeployConfigFileAsync,
|
|
48
|
+
NO_SERVER_REASON,
|
|
49
|
+
describeValidationFailureAsync,
|
|
50
|
+
describeDeploymentFailureAsync,
|
|
51
|
+
ACKNOWLEDGE_PERMANENT_DELETION_FLAG,
|
|
52
|
+
finiteOr,
|
|
53
|
+
runInstallToOutcomeAsync
|
|
54
|
+
} from "./packager-tool-ztxsccjk.js";
|
|
55
|
+
import {
|
|
56
|
+
resolveParentFolder,
|
|
57
|
+
resolveFolderInfo,
|
|
58
|
+
feedScopeInitOverride2,
|
|
59
|
+
feedSelectorFlag2,
|
|
60
|
+
tenantFlag2,
|
|
61
|
+
deleteDeploymentCommand2,
|
|
62
|
+
describeFeedResolutionFailureAsync2,
|
|
63
|
+
resolveFeedScope2
|
|
64
|
+
} from "./packager-tool-7j920ac5.js";
|
|
65
|
+
import {
|
|
66
|
+
linkedProcessNamesFromConfig2,
|
|
67
|
+
checkFolderRuntimesAsync2,
|
|
68
|
+
logFolderRuntimeWarnings2
|
|
69
|
+
} from "./packager-tool-w0tmr9xe.js";
|
|
70
|
+
import {
|
|
71
|
+
formatDeploymentFailureDetails,
|
|
72
|
+
hasServerErrorCode,
|
|
73
|
+
DRAFT_VERSION_MISMATCH_CODE,
|
|
74
|
+
leavesPendingDraft,
|
|
75
|
+
installLandedDespiteStatus,
|
|
76
|
+
explainPipelineStatusAfterInstall
|
|
77
|
+
} from "./packager-tool-2pxe2r4j.js";
|
|
78
|
+
import {
|
|
79
|
+
pendingResourceApis,
|
|
80
|
+
reportedActivationStatus,
|
|
81
|
+
readPendingResourcesAsync,
|
|
82
|
+
appendDeploymentStateInstructions,
|
|
83
|
+
needsPendingResources,
|
|
84
|
+
deploymentNextSteps
|
|
85
|
+
} from "./packager-tool-h8wam8pt.js";
|
|
86
|
+
|
|
87
|
+
// src/services/deploy-run-service.ts
|
|
88
|
+
var DEFAULT_TIMEOUT_SECONDS = 360;
|
|
89
|
+
var DEFAULT_POLL_INTERVAL_MS = 5000;
|
|
90
|
+
var PROCESS_RESOURCE_MAPPING_ERROR = /(?:AgentProcessResource|FlowProcessResource)\s*->\s*ReleaseDto/;
|
|
91
|
+
var PROCESS_KEY_MAPPING_ERROR = /Destination Member:\s*ProcessKey|Invalid argument 'Key'/;
|
|
92
|
+
function buildDeploymentFailureInstructions(instructions, pipelineDeploymentId) {
|
|
93
|
+
if (!instructions) {
|
|
94
|
+
return "Unknown error";
|
|
95
|
+
}
|
|
96
|
+
const isAgentMappingFailure = PROCESS_RESOURCE_MAPPING_ERROR.test(instructions) && PROCESS_KEY_MAPPING_ERROR.test(instructions);
|
|
97
|
+
if (!isAgentMappingFailure) {
|
|
98
|
+
return instructions;
|
|
99
|
+
}
|
|
100
|
+
return `${instructions}
|
|
101
|
+
Detected agent/flow process mapping failure: UiPath could not map an agent or flow process resource to an Orchestrator release because ProcessKey/Key is missing. This is a platform-side validation issue for this package; retrying the same deployment is unlikely to succeed. Rebuild or publish the solution without agent/flow process resources, or contact UiPath support with pipeline deployment ID ${pipelineDeploymentId}.`;
|
|
102
|
+
}
|
|
103
|
+
var fail = (reason, message, instructions, extras = {}) => ({
|
|
104
|
+
ok: false,
|
|
105
|
+
reason,
|
|
106
|
+
message,
|
|
107
|
+
instructions,
|
|
108
|
+
exitCode: extras.exitCode ?? 1,
|
|
109
|
+
pipelineDeploymentId: extras.pipelineDeploymentId,
|
|
110
|
+
errorCode: extras.errorCode,
|
|
111
|
+
retry: extras.retry,
|
|
112
|
+
...extras.deploymentKey !== undefined && {
|
|
113
|
+
deploymentKey: extras.deploymentKey
|
|
114
|
+
},
|
|
115
|
+
...extras.permanentDeletionResources !== undefined && {
|
|
116
|
+
permanentDeletionResources: extras.permanentDeletionResources
|
|
117
|
+
},
|
|
118
|
+
...extras.permanentlyDeletedResources !== undefined && {
|
|
119
|
+
permanentlyDeletedResources: extras.permanentlyDeletedResources
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var failPermanentDeletion = (refusal, pipelineDeploymentId, deploymentKey) => fail(refusal.reason, refusal.message, refusal.instructions, {
|
|
123
|
+
...refusal.classification,
|
|
124
|
+
pipelineDeploymentId,
|
|
125
|
+
deploymentKey,
|
|
126
|
+
permanentDeletionResources: refusal.resources
|
|
127
|
+
});
|
|
128
|
+
async function readInstalledFolderAsync(auth, deploymentName, deploymentKey, scope) {
|
|
129
|
+
if (deploymentKey) {
|
|
130
|
+
const [, info] = await catchError(readDeploymentByKeyAsync2(auth, deploymentKey, { scope }));
|
|
131
|
+
if (info?.deploymentKey === deploymentKey && info.installedRootFolderKey) {
|
|
132
|
+
return { installedRootFolderKey: info.installedRootFolderKey };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return findDeploymentBestEffort2(auth, deploymentName, scope, {
|
|
136
|
+
deploymentKey
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function makeFolderKeyResolver(options) {
|
|
140
|
+
return async (folderKey) => {
|
|
141
|
+
const folder = await resolveFolder({ folderKey }, {
|
|
142
|
+
tenant: options.tenant,
|
|
143
|
+
loginValidity: options.loginValidity,
|
|
144
|
+
envFilePath: options.envFilePath
|
|
145
|
+
});
|
|
146
|
+
return folder ? { name: folder.displayName, path: folder.path } : undefined;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async function deployRunAsync2(options) {
|
|
150
|
+
const [authError, auth] = await catchError(getSolutionAuthContext2({
|
|
151
|
+
tenant: options.tenant,
|
|
152
|
+
loginValidity: options.loginValidity,
|
|
153
|
+
envFilePath: options.envFilePath
|
|
154
|
+
}));
|
|
155
|
+
if (authError) {
|
|
156
|
+
return fail("auth_failed", authError.message, authError.message);
|
|
157
|
+
}
|
|
158
|
+
let feedScope = { kind: "tenant" };
|
|
159
|
+
if (options.personalWorkspace || options.feed !== undefined) {
|
|
160
|
+
if (options.personalWorkspace) {
|
|
161
|
+
const refusal = refuseFeedForSession(auth, "Deploying into a Personal Workspace");
|
|
162
|
+
if (refusal) {
|
|
163
|
+
return refusal;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const [scopeError, scope] = await catchError(resolveFeedScope2({
|
|
167
|
+
personalWorkspace: options.personalWorkspace,
|
|
168
|
+
feed: options.feed,
|
|
169
|
+
tenant: options.tenant,
|
|
170
|
+
loginValidity: options.loginValidity,
|
|
171
|
+
envFilePath: options.envFilePath
|
|
172
|
+
}));
|
|
173
|
+
if (scopeError) {
|
|
174
|
+
const failure = await describeFeedResolutionFailureAsync2(scopeError, options, auth);
|
|
175
|
+
return fail(options.feed !== undefined ? "feed_resolution_failed" : "personal_workspace_deploy_failed", failure.message, failure.instructions, { errorCode: failure.errorCode, retry: failure.retry });
|
|
176
|
+
}
|
|
177
|
+
feedScope = scope;
|
|
178
|
+
if (feedScope.kind !== "tenant") {
|
|
179
|
+
const refusal = await refuseFeedForSessionAsync(auth, feedScope, `Deploying into the feed '${feedScope.name ?? feedScope.folderKey}'`);
|
|
180
|
+
if (refusal) {
|
|
181
|
+
return refusal;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const blocked = adviseForApplication(auth, await guardExistingDeployment(auth, options, feedScope)) ?? adviseForApplication(auth, await guardPendingDraft(auth, options, feedScope));
|
|
186
|
+
if (blocked) {
|
|
187
|
+
return blocked;
|
|
188
|
+
}
|
|
189
|
+
let parentFolderPath;
|
|
190
|
+
if (feedScope.kind !== "tenant") {
|
|
191
|
+
const [locationError, location] = await catchError(resolveFeedDeployLocation(feedScope, options));
|
|
192
|
+
if (locationError instanceof FeedFolderLookupError) {
|
|
193
|
+
const { errorCode, retry } = await extractErrorDetails(locationError.lookupFailure.cause ?? locationError.lookupFailure);
|
|
194
|
+
return fail("feed_resolution_failed", locationError.message, FEED_FOLDER_LOOKUP_INSTRUCTIONS, { errorCode, retry });
|
|
195
|
+
}
|
|
196
|
+
if (locationError) {
|
|
197
|
+
return fail("location_outside_feed", locationError.message, "Pass a --parent-folder-path / --parent-folder-key inside the feed folder, or omit it to deploy into the feed folder itself.");
|
|
198
|
+
}
|
|
199
|
+
parentFolderPath = location.folderFQN || undefined;
|
|
200
|
+
} else {
|
|
201
|
+
const [folderError, resolved] = await catchError(resolveParentFolder({
|
|
202
|
+
folderPath: options.parentFolderPath,
|
|
203
|
+
folderKey: options.parentFolderKey,
|
|
204
|
+
personalWorkspace: options.personalWorkspace,
|
|
205
|
+
tenant: options.tenant,
|
|
206
|
+
loginValidity: options.loginValidity,
|
|
207
|
+
envFilePath: options.envFilePath
|
|
208
|
+
}));
|
|
209
|
+
if (folderError) {
|
|
210
|
+
return fail("folder_resolution_failed", folderError.message, "Provide a valid --parent-folder-path, --parent-folder-key, or --personal-workspace.");
|
|
211
|
+
}
|
|
212
|
+
parentFolderPath = resolved;
|
|
213
|
+
}
|
|
214
|
+
const scope = feedScopeInitOverride2(feedScope);
|
|
215
|
+
const feedFields = feedScope.kind === "tenant" ? { feedKind: feedScope.kind } : {
|
|
216
|
+
feedKind: feedScope.kind,
|
|
217
|
+
deploymentName: options.deploymentName,
|
|
218
|
+
packageName: options.packageName,
|
|
219
|
+
packageVersion: options.packageVersion
|
|
220
|
+
};
|
|
221
|
+
const configuration = new Configuration2({
|
|
222
|
+
basePath: auth.basePath,
|
|
223
|
+
accessToken: auth.accessToken
|
|
224
|
+
});
|
|
225
|
+
const api = new PipelinesApi(configuration);
|
|
226
|
+
let configBody;
|
|
227
|
+
if (options.configFile) {
|
|
228
|
+
const config = await readDeployConfigFileAsync(options.configFile);
|
|
229
|
+
if (!config.ok) {
|
|
230
|
+
return fail(config.reason, config.message, config.instructions, {
|
|
231
|
+
errorCode: config.errorCode,
|
|
232
|
+
retry: config.retry
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
configBody = config.body;
|
|
236
|
+
}
|
|
237
|
+
const succeed = async (success) => {
|
|
238
|
+
const [, found] = await catchError(checkFolderRuntimesAsync2({
|
|
239
|
+
auth,
|
|
240
|
+
packageName: options.packageName,
|
|
241
|
+
packageVersion: options.packageVersion,
|
|
242
|
+
scope,
|
|
243
|
+
deploymentKey: success.deploymentKey,
|
|
244
|
+
folderPath: success.folderPath,
|
|
245
|
+
configuredLinks: linkedProcessNamesFromConfig2(configBody),
|
|
246
|
+
personalWorkspace: feedScope.kind === "personal",
|
|
247
|
+
tenant: options.tenant,
|
|
248
|
+
loginValidity: options.loginValidity,
|
|
249
|
+
envFilePath: options.envFilePath,
|
|
250
|
+
signal: options.signal
|
|
251
|
+
}));
|
|
252
|
+
const warnings = logFolderRuntimeWarnings2(found ?? []);
|
|
253
|
+
return warnings.length > 0 ? { ...success, warnings } : success;
|
|
254
|
+
};
|
|
255
|
+
const installAsync = async () => {
|
|
256
|
+
const [installError, installResult] = await catchError(api.pipelinesInstall({
|
|
257
|
+
deploymentName: options.deploymentName,
|
|
258
|
+
packageName: options.packageName,
|
|
259
|
+
packageVersion: options.packageVersion,
|
|
260
|
+
solutionRootFolderName: options.folderName,
|
|
261
|
+
folderFullyQualifiedName: parentFolderPath,
|
|
262
|
+
body: configBody
|
|
263
|
+
}, scope));
|
|
264
|
+
if (installError || !installResult?.pipelineDeploymentId) {
|
|
265
|
+
if (!installError) {
|
|
266
|
+
return fail(installFailureReason(feedScope), "The install request returned no pipeline deployment.", installFailureHint(feedScope, options));
|
|
267
|
+
}
|
|
268
|
+
const detail = await extractErrorDetails(installError, {
|
|
269
|
+
forbiddenMessage: installForbiddenMessage(feedScope, parentFolderPath ?? options.parentFolderKey)
|
|
270
|
+
});
|
|
271
|
+
if (hasServerErrorCode(detail.details, DRAFT_VERSION_MISMATCH_CODE)) {
|
|
272
|
+
return fail("pending_draft", detail.message, `${pendingDraftHint(feedScope, options)} Details: ${detail.details}`, { errorCode: detail.errorCode, retry: detail.retry });
|
|
273
|
+
}
|
|
274
|
+
return fail(installFailureReason(feedScope), detail.message, `${installFailureHint(feedScope, options)} Details: ${detail.details}`, { errorCode: detail.errorCode, retry: detail.retry });
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
ok: true,
|
|
278
|
+
pipelineDeploymentId: installResult.pipelineDeploymentId
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
const keepCopiesHint = "remove those links from the --config-file (uip solution deploy config unlink <file> <resource>) and re-run";
|
|
282
|
+
const run = await runInstallToOutcomeAsync({
|
|
283
|
+
api,
|
|
284
|
+
auth,
|
|
285
|
+
deploymentName: options.deploymentName,
|
|
286
|
+
scope,
|
|
287
|
+
signal: options.signal,
|
|
288
|
+
timeoutSeconds: finiteOr(options.timeout, DEFAULT_TIMEOUT_SECONDS),
|
|
289
|
+
pollIntervalMs: finiteOr(options.pollInterval, DEFAULT_POLL_INTERVAL_MS),
|
|
290
|
+
logPrefix: "deploy",
|
|
291
|
+
acknowledge: options.acknowledgePermanentDeletion === true,
|
|
292
|
+
install: installAsync,
|
|
293
|
+
consentWording: () => ({
|
|
294
|
+
verb: "Deploying",
|
|
295
|
+
confirmHint: `re-run the same command with ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}`,
|
|
296
|
+
keepCopiesHint
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
if (run.kind === "install_refused") {
|
|
300
|
+
return run.failure;
|
|
301
|
+
}
|
|
302
|
+
if (run.kind === "consent_refused") {
|
|
303
|
+
return failPermanentDeletion(run.refusal, run.pipelineDeploymentId, run.deploymentKey);
|
|
304
|
+
}
|
|
305
|
+
const { pipelineDeploymentId, pollResult, permanentlyDeletedResources } = run;
|
|
306
|
+
const folderPath = parentFolderPath ? `${parentFolderPath}/${options.folderName}` : options.folderName;
|
|
307
|
+
if (pollResult.outcome !== PollOutcome.Completed || !pollResult.data) {
|
|
308
|
+
const recoveryKey = pollResult.data?.deploymentKey || undefined;
|
|
309
|
+
const recoveryDeployment = recoveryKey ? await findDeploymentBestEffort2(auth, options.deploymentName, scope, { deploymentKey: recoveryKey }) : undefined;
|
|
310
|
+
const recovery = interpretFailedDeployPoll2(recoveryDeployment);
|
|
311
|
+
const recoveredSuccess = async () => {
|
|
312
|
+
const resolvedFolder = await resolveInstalledFolder2(recoveryDeployment, {
|
|
313
|
+
folderName: options.folderName,
|
|
314
|
+
folderPath,
|
|
315
|
+
parentFolderPath
|
|
316
|
+
}, makeFolderKeyResolver(options));
|
|
317
|
+
return {
|
|
318
|
+
ok: true,
|
|
319
|
+
...buildDeploymentLinks(auth, recoveryDeployment?.key, recoveryDeployment?.installedRootFolderKey, feedScope.folderKey),
|
|
320
|
+
...feedFields,
|
|
321
|
+
...permanentlyDeletedResources && {
|
|
322
|
+
permanentlyDeletedResources
|
|
323
|
+
},
|
|
324
|
+
status: "DeploymentSucceeded",
|
|
325
|
+
deploymentKey: recoveryDeployment?.key,
|
|
326
|
+
pipelineDeploymentId,
|
|
327
|
+
instanceId: recoveryDeployment?.instanceId == null ? undefined : recoveryDeployment.instanceId,
|
|
328
|
+
folderName: resolvedFolder.folderName,
|
|
329
|
+
folderPath: resolvedFolder.folderPath,
|
|
330
|
+
...resolvedFolder.requestedMatched ? {} : { requestedFolderName: options.folderName }
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
if (recovery?.kind === "Active") {
|
|
334
|
+
return succeed({
|
|
335
|
+
...await recoveredSuccess(),
|
|
336
|
+
activationStatus: "SuccessfulActivate"
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (recoveryDeployment && (recovery?.kind === "NeedsSetupToActivate" || recovery?.kind === "ReadyToActivate")) {
|
|
340
|
+
return succeed({
|
|
341
|
+
...await recoveredSuccess(),
|
|
342
|
+
...await describeInstalledNotLiveAsync(auth, recoveryDeployment, scope, feedScope)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (recovery?.kind === "ActivationFailed") {
|
|
346
|
+
return fail("activation_failed_post_deploy", `Deployment '${options.deploymentName}' completed but activation failed.`, `Inspect activation details in Orchestrator, then retry with: uip solution deploy activate ${options.deploymentName}${feedSelectorFlag2(feedScope)}.`, { pipelineDeploymentId });
|
|
347
|
+
}
|
|
348
|
+
if (recovery?.kind === "DeployFailed") {
|
|
349
|
+
const reason = recoveryDeployment ? await describeDeploymentFailureAsync(auth, recoveryDeployment, SolutionDeploymentAction2.Install, scope, options.signal) : NO_SERVER_REASON;
|
|
350
|
+
return fail("deploy_failed", `Deployment '${options.deploymentName}' failed (OperationStatus: ${recovery.operationStatus}): ${reason}`, `${inspectHint(pipelineDeploymentId, feedScope)} Fix the underlying issue and retry: uip solution deploy run.`, { pipelineDeploymentId });
|
|
351
|
+
}
|
|
352
|
+
const { reason, message, exitCode, errorCode, retry } = mapPollFailure(pollResult, "Deployment");
|
|
353
|
+
return fail(reason, message, `Deployment may still be in progress. ${followHint(pipelineDeploymentId, feedScope)}`, { exitCode, pipelineDeploymentId, errorCode, retry });
|
|
354
|
+
}
|
|
355
|
+
const finalStatus = pollResult.data;
|
|
356
|
+
if (!finalStatus) {
|
|
357
|
+
return fail("no_final_status", "Deployment did not return a final status.", followHint(pipelineDeploymentId, feedScope), { pipelineDeploymentId });
|
|
358
|
+
}
|
|
359
|
+
const landedDespiteStatus = installLandedDespiteStatus(finalStatus);
|
|
360
|
+
if (finalStatus.status !== "DeploymentSucceeded" && !landedDespiteStatus) {
|
|
361
|
+
const classification = finalStatus.status === "ValidationFailed" || finalStatus.status === "ConflictFixingError" ? {
|
|
362
|
+
errorCode: "invalid_argument",
|
|
363
|
+
retry: "RetryWillNotFix"
|
|
364
|
+
} : {};
|
|
365
|
+
const fromPipeline = formatDeploymentFailureDetails(pipelineDeploymentId, finalStatus);
|
|
366
|
+
const details = finalStatus.synthesizedOperation !== undefined && finalStatus.deploymentKey ? await describeSynthesizedFailureAsync(auth, finalStatus.deploymentKey, scope, options.signal, fromPipeline) : fromPipeline;
|
|
367
|
+
const draftNote = leavesPendingDraft(finalStatus.status) ? `
|
|
368
|
+
Nothing was installed. The rejected attempt is kept as a pending draft${finalStatus.deploymentKey ? ` (${finalStatus.deploymentKey})` : ""}: fix the configuration and re-run this command, and the server re-validates that draft with the new file (settings and resource links the file does not name keep the values the draft was rejected with). When this was the first deploy of the name, every other version is refused until the draft is gone; to deploy another version, delete it: ${deleteDraftCommand(feedScope, options)}.${finalStatus.deploymentKey ? ` When this was an update of an existing deployment, you can discard the draft and upgrade the live version instead: uip solution deploy upgrade ${finalStatus.deploymentKey} --discard-draft --version ${options.packageVersion}${tenantFlag2(options)}` : ""}` : "";
|
|
369
|
+
return fail("deploy_failed", `Deployment failed with status: ${finalStatus.status}`, `${buildDeploymentFailureInstructions(details, pipelineDeploymentId)}${draftNote}`, { pipelineDeploymentId, ...classification });
|
|
370
|
+
}
|
|
371
|
+
const installedFolder = await readInstalledFolderAsync(auth, options.deploymentName, finalStatus.deploymentKey || undefined, scope);
|
|
372
|
+
const resolvedFolder = await resolveInstalledFolder2(installedFolder, {
|
|
373
|
+
folderName: options.folderName,
|
|
374
|
+
folderPath,
|
|
375
|
+
parentFolderPath
|
|
376
|
+
}, makeFolderKeyResolver(options));
|
|
377
|
+
const baseSuccess = {
|
|
378
|
+
ok: true,
|
|
379
|
+
...buildDeploymentLinks(auth, finalStatus.deploymentKey, installedFolder?.installedRootFolderKey, feedScope.folderKey),
|
|
380
|
+
...feedFields,
|
|
381
|
+
...permanentlyDeletedResources && { permanentlyDeletedResources },
|
|
382
|
+
status: finalStatus.status,
|
|
383
|
+
deploymentKey: finalStatus.deploymentKey,
|
|
384
|
+
pipelineDeploymentId,
|
|
385
|
+
instanceId: finalStatus.instanceId,
|
|
386
|
+
folderName: resolvedFolder.folderName,
|
|
387
|
+
folderPath: resolvedFolder.folderPath,
|
|
388
|
+
...resolvedFolder.requestedMatched ? {} : { requestedFolderName: options.folderName }
|
|
389
|
+
};
|
|
390
|
+
if (landedDespiteStatus) {
|
|
391
|
+
const described = await describeInstalledRunAsync(auth, options.deploymentName, options.packageName, finalStatus, scope, feedScope);
|
|
392
|
+
return succeed({
|
|
393
|
+
...baseSuccess,
|
|
394
|
+
...described,
|
|
395
|
+
nextSteps: [
|
|
396
|
+
explainPipelineStatusAfterInstall(finalStatus),
|
|
397
|
+
...described.nextSteps ?? []
|
|
398
|
+
]
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (options.skipActivate) {
|
|
402
|
+
return succeed({ ...baseSuccess, activationStatus: "Skipped" });
|
|
403
|
+
}
|
|
404
|
+
if (reportedActivationStatus(finalStatus.deploymentResult) === "NeedsSetupToActivate") {
|
|
405
|
+
return succeed({
|
|
406
|
+
...baseSuccess,
|
|
407
|
+
...await describeInstalledRunAsync(auth, options.deploymentName, options.packageName, finalStatus, scope, feedScope)
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
const activationResult = await activateDeployment(auth, options.deploymentName, {
|
|
411
|
+
timeoutSeconds: options.timeout ?? 360,
|
|
412
|
+
pollIntervalMs: options.pollInterval ?? 5000,
|
|
413
|
+
signal: options.signal,
|
|
414
|
+
scope
|
|
415
|
+
});
|
|
416
|
+
if (activationResult.kind === "RequestFailed") {
|
|
417
|
+
const refused = activationResult.deployment;
|
|
418
|
+
if (refused && refused.key === finalStatus.deploymentKey && refused.operationStatus === "Successful" && refused.activationStatus === "NeedsSetupToActivate") {
|
|
419
|
+
return succeed({
|
|
420
|
+
...baseSuccess,
|
|
421
|
+
...await describeInstalledNotLiveAsync(auth, refused, scope, feedScope)
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
const fallback = activationResult.phase === "preActivateSteps" ? `Deployment '${options.deploymentName}' was deployed successfully but pre-activate steps lookup failed. Retry activation with: uip solution deploy activate ${options.deploymentName}${feedSelectorFlag2(feedScope)}. Details: ${activationResult.details}` : `Deployment '${options.deploymentName}' was deployed successfully but activation failed. Retry activation with: uip solution deploy activate ${options.deploymentName}${feedSelectorFlag2(feedScope)}. Details: ${activationResult.details}`;
|
|
425
|
+
const pendingResources = refused && needsPendingResources(refused) ? await readPendingResourcesAsync(pendingResourceApis(auth), refused, scope) : undefined;
|
|
426
|
+
return fail("activation_request_failed", activationResult.message, appendDeploymentStateInstructions(fallback, refused, pendingResources, feedSelectorFlag2(feedScope)), { pipelineDeploymentId, permanentlyDeletedResources });
|
|
427
|
+
}
|
|
428
|
+
if (activationResult.kind === "PollFailed") {
|
|
429
|
+
const { message, exitCode, errorCode, retry } = mapPollFailure(activationResult.poll, "Activation");
|
|
430
|
+
return fail("activation_poll_failed", message, `Deployment '${options.deploymentName}' was deployed successfully but activation polling did not complete. Activation may still be in progress; check with: ${listCommand(feedScope)}.`, {
|
|
431
|
+
exitCode,
|
|
432
|
+
pipelineDeploymentId,
|
|
433
|
+
errorCode,
|
|
434
|
+
retry,
|
|
435
|
+
permanentlyDeletedResources
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
if (activationResult.kind === "ActivationFailed") {
|
|
439
|
+
return fail("activation_failed", `Activation failed with status: ${activationResult.status}`, activationResult.errorMessage, { pipelineDeploymentId, permanentlyDeletedResources });
|
|
440
|
+
}
|
|
441
|
+
const activationStatus = activationResult.kind === "Success" ? activationResult.status : "NoInstance";
|
|
442
|
+
const activationInstanceId = activationResult.kind === "Success" ? activationResult.instanceId : undefined;
|
|
443
|
+
const finalInstanceId = activationInstanceId == null ? baseSuccess.instanceId : activationInstanceId;
|
|
444
|
+
return succeed({
|
|
445
|
+
...baseSuccess,
|
|
446
|
+
activationStatus,
|
|
447
|
+
instanceId: finalInstanceId
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
async function describeInstalledRunAsync(auth, deploymentName, packageName, finalStatus, scope, feedScope) {
|
|
451
|
+
const key = finalStatus.deploymentKey || undefined;
|
|
452
|
+
const record = finalStatus.deploymentResult;
|
|
453
|
+
const reported = reportedActivationStatus(record);
|
|
454
|
+
const row = key && !reported ? await findDeploymentBestEffort2(auth, deploymentName, scope, {
|
|
455
|
+
deploymentKey: key
|
|
456
|
+
}) : undefined;
|
|
457
|
+
if (row) {
|
|
458
|
+
return describeInstalledNotLiveAsync(auth, row, scope, feedScope);
|
|
459
|
+
}
|
|
460
|
+
if (record?.status === "SuccessfulActivate") {
|
|
461
|
+
return { activationStatus: "SuccessfulActivate" };
|
|
462
|
+
}
|
|
463
|
+
const actions = record?.actions ?? [];
|
|
464
|
+
const activationStatus = reported ?? (actions.includes("SetupActivation") ? "NeedsSetupToActivate" : actions.includes("Activate") ? "ReadyToActivate" : "Inactive");
|
|
465
|
+
return describeInstalledNotLiveAsync(auth, {
|
|
466
|
+
name: deploymentName,
|
|
467
|
+
key,
|
|
468
|
+
packageName,
|
|
469
|
+
operation: record?.operation ?? finalStatus.synthesizedOperation,
|
|
470
|
+
operationStatus: record?.operationStatus ?? "Successful",
|
|
471
|
+
activationStatus,
|
|
472
|
+
packageVersion: record?.packageVersion,
|
|
473
|
+
currentPackageVersion: record?.packageVersion
|
|
474
|
+
}, scope, feedScope);
|
|
475
|
+
}
|
|
476
|
+
async function describeInstalledNotLiveAsync(auth, deployment, scope, feedScope) {
|
|
477
|
+
const pendingResources = needsPendingResources(deployment) && deployment.key ? await readPendingResourcesAsync(pendingResourceApis(auth), { name: deployment.name, key: deployment.key }, scope) : undefined;
|
|
478
|
+
const nextSteps = deploymentNextSteps(deployment, pendingResources, feedSelectorFlag2(feedScope));
|
|
479
|
+
return {
|
|
480
|
+
activationStatus: deployment.activationStatus ?? "Inactive",
|
|
481
|
+
...pendingResources ? { pendingResources } : {},
|
|
482
|
+
...nextSteps && nextSteps.length > 0 ? { nextSteps } : {}
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
function inspectHint(pipelineDeploymentId, scope) {
|
|
486
|
+
if (scope.kind === "tenant") {
|
|
487
|
+
return `Inspect failure details with: uip solution deploy status ${pipelineDeploymentId}.`;
|
|
488
|
+
}
|
|
489
|
+
return `Inspect it with: ${listCommand(scope)}.`;
|
|
490
|
+
}
|
|
491
|
+
function followHint(pipelineDeploymentId, scope) {
|
|
492
|
+
if (scope.kind === "tenant") {
|
|
493
|
+
return `Check status with: uip solution deploy status ${pipelineDeploymentId}.`;
|
|
494
|
+
}
|
|
495
|
+
return `Check it with: ${listCommand(scope)}.`;
|
|
496
|
+
}
|
|
497
|
+
function listCommand(scope) {
|
|
498
|
+
if (scope.kind === "personal") {
|
|
499
|
+
return "uip solution deploy list --personal-workspace";
|
|
500
|
+
}
|
|
501
|
+
if (scope.kind === "folder") {
|
|
502
|
+
return `uip solution deploy list --feed ${scope.folderKey ?? "<name-or-key>"}`;
|
|
503
|
+
}
|
|
504
|
+
return "uip solution deploy list";
|
|
505
|
+
}
|
|
506
|
+
function adviseForApplication(auth, failure) {
|
|
507
|
+
if (!failure || classifyFeedSession2(auth) !== "application") {
|
|
508
|
+
return failure;
|
|
509
|
+
}
|
|
510
|
+
logger.warn(`${failure.message} Deploying anyway: under an external app (client-credentials) login this check only warns, so a pipeline keeps the outcome it had before the check could run. ${failure.instructions}`);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
function refuseFeedForSession(session, action) {
|
|
514
|
+
const verdict = classifyFeedSession2(session);
|
|
515
|
+
if (verdict === "user") {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
return feedRefusalFailure(feedSessionRefusal2(verdict, action, FEED_REFUSAL_ALTERNATIVE));
|
|
519
|
+
}
|
|
520
|
+
async function refuseFeedForSessionAsync(session, scope, action) {
|
|
521
|
+
if (!scope.folderKey) {
|
|
522
|
+
return refuseFeedForSession(session, action);
|
|
523
|
+
}
|
|
524
|
+
const refusal = await feedSessionRefusalAsync2(session, scope.folderKey, "write", action, FEED_REFUSAL_ALTERNATIVE);
|
|
525
|
+
return refusal ? feedRefusalFailure(refusal) : undefined;
|
|
526
|
+
}
|
|
527
|
+
var FEED_REFUSAL_ALTERNATIVE = "deploy the package to the tenant feed";
|
|
528
|
+
function feedRefusalFailure(refusal) {
|
|
529
|
+
return fail("feed_requires_user_session", refusal.message, refusal.instructions, { errorCode: "permission_denied", retry: "RetryWillNotFix" });
|
|
530
|
+
}
|
|
531
|
+
async function describeSynthesizedFailureAsync(auth, deploymentKey, scope, signal, fromPipeline) {
|
|
532
|
+
const deploymentsApi = new DeploymentsApi2(new Configuration3({
|
|
533
|
+
basePath: auth.basePath,
|
|
534
|
+
accessToken: auth.accessToken
|
|
535
|
+
}));
|
|
536
|
+
const reason = await describeValidationFailureAsync(deploymentsApi, deploymentKey, SolutionDeploymentAction2.Install, scope, signal);
|
|
537
|
+
return reason === NO_SERVER_REASON ? fromPipeline : `Validation: ${reason}
|
|
538
|
+
${fromPipeline}`;
|
|
539
|
+
}
|
|
540
|
+
function pendingDraftHint(scope, options) {
|
|
541
|
+
const cause = `'${options.deploymentName}' has a pending draft for another version: an earlier attempt that never completed, usually one rejected by validation. To retry that draft with a corrected configuration, re-run this command with the draft's --package-version (the message names it).`;
|
|
542
|
+
const firstDeploy = ` If that attempt was the first deploy of '${options.deploymentName}', nothing is installed to upgrade: to deploy ${options.packageVersion} instead, delete the draft with ${deleteDraftCommand(scope, options)}, then re-run this command.`;
|
|
543
|
+
if (scope.kind === "folder") {
|
|
544
|
+
return `${cause}${firstDeploy} To discard it and upgrade the live deployment to ${options.packageVersion} instead: uip solution deploy upgrade <deployment-key> --discard-draft --version ${options.packageVersion}${tenantFlag2(options)} (Key from ${listCommand(scope)}).`;
|
|
545
|
+
}
|
|
546
|
+
const workspace = scope.kind === "personal" ? " --personal-workspace" : "";
|
|
547
|
+
return `${cause}${firstDeploy} To discard it and upgrade the live deployment to ${options.packageVersion} instead: uip solution deploy upgrade --name ${quoteForShell(options.deploymentName)} --package-name ${quoteForShell(options.packageName)}${workspace} --discard-draft --version ${options.packageVersion}${tenantFlag2(options)} (under an external app, pass the deployment's key in place of --name and --package-name).`;
|
|
548
|
+
}
|
|
549
|
+
function installFailureReason(scope) {
|
|
550
|
+
if (scope.kind === "personal") {
|
|
551
|
+
return "personal_workspace_deploy_failed";
|
|
552
|
+
}
|
|
553
|
+
if (scope.kind === "folder") {
|
|
554
|
+
return "feed_deploy_failed";
|
|
555
|
+
}
|
|
556
|
+
return "install_request_failed";
|
|
557
|
+
}
|
|
558
|
+
function installFailureHint(scope, options) {
|
|
559
|
+
if (scope.kind === "personal") {
|
|
560
|
+
return "Ensure the package was published to your Personal Workspace first: uip solution publish <package> --personal-workspace.";
|
|
561
|
+
}
|
|
562
|
+
if (scope.kind === "folder") {
|
|
563
|
+
return `Ensure the package was published to the feed first: uip solution publish <package> --feed ${options.feed ?? "<name-or-key>"}.`;
|
|
564
|
+
}
|
|
565
|
+
return "Check package name/version with: uip solution packages list.";
|
|
566
|
+
}
|
|
567
|
+
function installForbiddenMessage(scope, folder) {
|
|
568
|
+
const target = scope.kind === "personal" ? "your Personal Workspace" : folder ? `folder '${folder}'` : "the tenant root";
|
|
569
|
+
return `Forbidden (403). Your account has no permission to deploy into ${target}. ` + "Ask a tenant administrator for SolutionDeployments.Create (tenant) or FolderSolutionDeployments.Create (that folder), " + "or deploy into another folder with --parent-folder-path, or into --personal-workspace. " + "An external app also needs the Solutions.Deployments.Write scope.";
|
|
570
|
+
}
|
|
571
|
+
function scopeLabel(scope) {
|
|
572
|
+
if (scope.kind === "personal") {
|
|
573
|
+
return "your Personal Workspace";
|
|
574
|
+
}
|
|
575
|
+
if (scope.kind === "folder") {
|
|
576
|
+
return scope.name ? `feed '${scope.name}'` : "the target feed";
|
|
577
|
+
}
|
|
578
|
+
return "this tenant";
|
|
579
|
+
}
|
|
580
|
+
function buildDeploymentExistsMessage(packageName, scope, existing, folderByKey) {
|
|
581
|
+
return `Package '${packageName}' is already deployed in ${scopeLabel(scope)}. ` + "Running deploy again creates a second, separate deployment — it does not update the one that is already there. " + `Existing: ${formatExistingDeployments2(existing, folderByKey)}.`;
|
|
582
|
+
}
|
|
583
|
+
function buildDeploymentExistsInstructions(options) {
|
|
584
|
+
const { packageName, scope, existing, requestedDeploymentName } = options;
|
|
585
|
+
const parts = [];
|
|
586
|
+
const first = existing[0];
|
|
587
|
+
const selfInflicted = requestedDeploymentName !== undefined && existing.some((d) => d.name === requestedDeploymentName);
|
|
588
|
+
if (existing.length > 0 && existing.every((d) => d.operationStatus === "InProgress")) {
|
|
589
|
+
parts.push(`Wait for the operation on '${first.name}' to finish, then decide whether to upgrade it or deploy a separate copy.`);
|
|
590
|
+
} else if (selfInflicted) {
|
|
591
|
+
parts.push(`'${requestedDeploymentName}' is the name you passed on --name, so an earlier run of this command probably created it. Check where it got to with: uip solution deploy status <pipeline-deployment-id>.`);
|
|
592
|
+
} else {
|
|
593
|
+
parts.push(first?.key ? `To update the existing deployment instead, upgrade it in place — running deploy again does not upgrade it: uip solution deploy upgrade ${first.key}.` : "To update the existing deployment instead, upgrade it in place with 'uip solution deploy upgrade <deployment-key>' — running deploy again does not upgrade it.");
|
|
594
|
+
if (first?.name) {
|
|
595
|
+
parts.push(`To remove it first, run: uip solution deploy uninstall '${first.name}'${feedSelectorFlag2(scope)} --yes.`);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
parts.push(`To see every deployment and its state, run: uip solution deploy list${feedSelectorFlag2(scope)}.`);
|
|
599
|
+
parts.push(scope.kind === "tenant" ? "To create a second, separate deployment anyway, re-run this command with --yes and a different --name: re-using an existing deployment's name updates that deployment in place instead." : "To create a second, separate deployment anyway, re-run with --yes and a different --name (re-using an existing deployment's name updates that deployment in place) — Orchestrator may still refuse it while the existing deployment is running or in a failed state.");
|
|
600
|
+
if (existing.length === 0) {
|
|
601
|
+
parts.unshift(`A deployment of '${packageName}' already exists in ${scopeLabel(scope)}.`);
|
|
602
|
+
} else if (options.includeInventory) {
|
|
603
|
+
parts.unshift(`Existing: ${formatExistingDeployments2(existing)}.`);
|
|
604
|
+
}
|
|
605
|
+
return parts.join(" ");
|
|
606
|
+
}
|
|
607
|
+
async function resolveDeploymentFolders(deployments, options) {
|
|
608
|
+
const resolveByKey = makeFolderKeyResolver(options);
|
|
609
|
+
const keys = [
|
|
610
|
+
...new Set(deployments.slice(0, MAX_LISTED_DEPLOYMENTS2).map((deployment) => deployment.installedRootFolderKey).filter((key) => Boolean(key)))
|
|
611
|
+
];
|
|
612
|
+
const resolved = new Map;
|
|
613
|
+
await Promise.all(keys.map(async (key) => {
|
|
614
|
+
const [lookupError, folder] = await catchError(resolveByKey(key));
|
|
615
|
+
const label = folder?.path ?? folder?.name;
|
|
616
|
+
if (!lookupError && label) {
|
|
617
|
+
resolved.set(key, label);
|
|
618
|
+
}
|
|
619
|
+
}));
|
|
620
|
+
return resolved;
|
|
621
|
+
}
|
|
622
|
+
async function guardPendingDraft(auth, options, scope) {
|
|
623
|
+
const [lookupError, rows] = await catchError(findDeploymentsByName2(auth, options.deploymentName, feedScopeInitOverride2(scope)));
|
|
624
|
+
if (lookupError instanceof DeploymentSearchNeedsUserSessionError || lookupError && classifyFeedSession2(auth) === "application" && isAuthRefusal(lookupError)) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
if (lookupError) {
|
|
628
|
+
logger.warn(`Skipped the pending-draft check for '${options.deploymentName}': the deployment lookup failed (${lookupError.message}). Deploying anyway — if this deployment has a pending draft for another version, the server may install that draft's version instead of ${options.packageVersion}. Check it with 'uip solution deploy list'.`);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
const draft = newestDeploymentRow2(rows);
|
|
632
|
+
if (draft?.operationStatus !== "Draft") {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
const draftVersion = draft.targetPackageVersion ?? draft.packageVersion;
|
|
636
|
+
if (draft.operation === "ActivationSetup") {
|
|
637
|
+
return fail("pending_draft", `Deployment '${options.deploymentName}' has an unfinished Setup activation (${draft.key}): the Orchestrator "Setup activation" wizard was started on version ${draftVersion ?? "<version>"} and not completed.`, `While that draft exists the server would run it in place of this deploy, or refuse a different version. Finish the setup in Orchestrator (Solutions, the deployment, Setup activation); or discard it — in Orchestrator (Delete draft), or with uip solution deploy upgrade ${draft.key} --discard-draft${draft.currentPackageVersion ? ` --version ${draft.currentPackageVersion}` : ""}${tenantFlag2(options)} — then re-run this command.`, { errorCode: "invalid_argument", retry: "RetryWillNotFix" });
|
|
638
|
+
}
|
|
639
|
+
if (!draftVersion || draftVersion.toLowerCase() === options.packageVersion.toLowerCase()) {
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
const liveVersion = draft.currentPackageVersion;
|
|
643
|
+
const firstInstall = draft.operation === "Install";
|
|
644
|
+
const reuse = firstInstall ? `any version other than the draft's ${draftVersion} is refused` : `asking for the live version installs the draft's ${draftVersion} instead, and any other version is refused`;
|
|
645
|
+
let discard;
|
|
646
|
+
if (firstInstall) {
|
|
647
|
+
discard = `delete the draft — ${deleteDraftCommand(scope, options)}, or Delete draft in Orchestrator —`;
|
|
648
|
+
} else if (!liveVersion) {
|
|
649
|
+
discard = "delete it in Orchestrator (Delete draft)";
|
|
650
|
+
} else {
|
|
651
|
+
discard = `discard it — in Orchestrator (Delete draft), or with uip solution deploy upgrade ${draft.key} --discard-draft --version ${liveVersion}${tenantFlag2(options)}, which also re-applies the live version unchanged —`;
|
|
652
|
+
}
|
|
653
|
+
return fail("pending_draft", `Deployment '${options.deploymentName}' has a pending draft (${draft.key}) for version ${draftVersion}: an earlier attempt that never completed, usually one rejected by validation, or one still running.`, `The server reuses that draft for the name, so this request would not deploy ${options.packageVersion}: ${reuse}. To retry the draft with a corrected configuration, re-run with --package-version ${draftVersion}.
|
|
654
|
+
To deploy ${options.packageVersion} instead, ${discard} then re-run this command.`, { errorCode: "invalid_argument", retry: "RetryWillNotFix" });
|
|
655
|
+
}
|
|
656
|
+
function deleteDraftCommand(scope, options) {
|
|
657
|
+
return deleteDeploymentCommand2(options.deploymentName, feedSelectorFlag2(scope), options);
|
|
658
|
+
}
|
|
659
|
+
async function guardExistingDeployment(auth, options, scope) {
|
|
660
|
+
if (options.yes) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
const [lookupError, deployments] = await catchError(findDeploymentsByPackageName2(auth, options.packageName, {
|
|
664
|
+
scope: feedScopeInitOverride2(scope)
|
|
665
|
+
}));
|
|
666
|
+
if (lookupError instanceof DeploymentSearchNeedsUserSessionError) {
|
|
667
|
+
logger.warn(`Skipped the already-deployed check for '${options.packageName}': this server's deployment search reads user sessions only, and this is an application (client-credentials) login. Deploying anyway — if a deployment already exists this creates a second one in its own folder. Check what is already deployed in the Orchestrator Solutions UI, or sign in with 'uip login' and re-run.`);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
if (lookupError && !(lookupError instanceof DeploymentSearchCapError2)) {
|
|
671
|
+
logger.warn(`Skipped the already-deployed check for '${options.packageName}': the deployment lookup failed (${lookupError.message}). Deploying anyway — if a deployment already exists this creates a second one in its own folder. 'uip solution deploy list' reads the same search, so it may fail the same way. Check what is already deployed in the Orchestrator Solutions UI, or re-run once the lookup answers.`);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
const capped = lookupError;
|
|
675
|
+
const existing = (capped ? capped.partialRows : deployments).filter(blocksRedeploy2);
|
|
676
|
+
if (existing.length === 0) {
|
|
677
|
+
if (capped) {
|
|
678
|
+
logger.warn(`Skipped the rest of the already-deployed check for '${options.packageName}': ${capped.message} The package's deployment history is too long to read in full, and none of the ${capped.partialRows.length} matching rows read blocks a redeploy. Deploying anyway — if a deployment past those rows exists this creates a second one in its own folder, and a re-run reads the same rows. Check what is already deployed in the Orchestrator Solutions UI.`);
|
|
679
|
+
}
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
return fail("deployment_exists", buildDeploymentExistsMessage(options.packageName, scope, existing, await resolveDeploymentFolders(existing, options)), buildDeploymentExistsInstructions({
|
|
683
|
+
packageName: options.packageName,
|
|
684
|
+
scope,
|
|
685
|
+
existing,
|
|
686
|
+
requestedDeploymentName: options.deploymentName
|
|
687
|
+
}));
|
|
688
|
+
}
|
|
689
|
+
var FEED_FOLDER_LOOKUP_INSTRUCTIONS = "The install needs the feed folder's path, which the CLI reads from Orchestrator Folders when --feed names the feed by key alone; under an external app that lookup needs the OR.Folders scope. Give the application OR.Folders, or the Studio Web (StudioWebS2S) grants so the feed listing can name the feed instead, or run the deploy with a user session ('uip login'). To deploy to the tenant feed, omit --feed.";
|
|
690
|
+
|
|
691
|
+
class FeedFolderLookupError extends Error {
|
|
692
|
+
lookupFailure;
|
|
693
|
+
constructor(folderKey, lookupFailure) {
|
|
694
|
+
super(`The feed folder '${folderKey}' could not be read from Orchestrator: ${lookupFailure.message}`);
|
|
695
|
+
this.lookupFailure = lookupFailure;
|
|
696
|
+
this.name = "FeedFolderLookupError";
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
async function resolveFeedDeployLocation(scope, options) {
|
|
700
|
+
const feedFolder = {
|
|
701
|
+
folderKey: scope.folderKey,
|
|
702
|
+
folderFQN: scope.name ?? ""
|
|
703
|
+
};
|
|
704
|
+
if (scope.kind === "folder" && !scope.name) {
|
|
705
|
+
const [lookupError, feedInfo] = await catchError(resolveFolderInfo({
|
|
706
|
+
folderKey: feedFolder.folderKey,
|
|
707
|
+
tenant: options.tenant,
|
|
708
|
+
loginValidity: options.loginValidity,
|
|
709
|
+
envFilePath: options.envFilePath
|
|
710
|
+
}));
|
|
711
|
+
if (lookupError) {
|
|
712
|
+
throw new FeedFolderLookupError(feedFolder.folderKey, lookupError);
|
|
713
|
+
}
|
|
714
|
+
if (!feedInfo) {
|
|
715
|
+
throw new FeedFolderLookupError(feedFolder.folderKey, new Error("the folder was not found"));
|
|
716
|
+
}
|
|
717
|
+
feedFolder.folderFQN = feedInfo.path;
|
|
718
|
+
}
|
|
719
|
+
if (scope.kind === "personal" || !options.parentFolderPath && !options.parentFolderKey) {
|
|
720
|
+
return feedFolder;
|
|
721
|
+
}
|
|
722
|
+
const resolved = await resolveFolderInfo({
|
|
723
|
+
folderPath: options.parentFolderPath,
|
|
724
|
+
folderKey: options.parentFolderKey,
|
|
725
|
+
tenant: options.tenant,
|
|
726
|
+
loginValidity: options.loginValidity,
|
|
727
|
+
envFilePath: options.envFilePath
|
|
728
|
+
});
|
|
729
|
+
if (!resolved) {
|
|
730
|
+
return feedFolder;
|
|
731
|
+
}
|
|
732
|
+
const withinFeed = resolved.path === feedFolder.folderFQN || resolved.path.startsWith(`${feedFolder.folderFQN}/`);
|
|
733
|
+
if (!withinFeed) {
|
|
734
|
+
throw new Error(`Deploy location '${resolved.path}' is outside the folder feed '${feedFolder.folderFQN}'. The location must be the feed folder or one of its descendants.`);
|
|
735
|
+
}
|
|
736
|
+
return { folderKey: resolved.key, folderFQN: resolved.path };
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export { deployRunAsync2 };
|
|
740
|
+
|
|
741
|
+
//# debugId=5F9ACC317C042FE064756E2164756E21
|