Skip to content

Commit 01c2413

Browse files
authored
Merge pull request #1187 from salesforcecli/sh/deploy-url-in-resume
fix: deploy url in resume
2 parents a858e1c + 5c7b487 commit 01c2413

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/commands/project/deploy/resume.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ import { Duration } from '@salesforce/kit';
1313
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
1414
import { DeployProgress } from '../../../utils/progressBar.js';
1515
import { API, DeployResultJson } from '../../../utils/types.js';
16-
import { buildComponentSet, determineExitCode, executeDeploy, isNotResumable } from '../../../utils/deploy.js';
16+
import {
17+
buildComponentSet,
18+
buildDeployUrl,
19+
determineExitCode,
20+
executeDeploy,
21+
isNotResumable,
22+
} from '../../../utils/deploy.js';
1723
import { DeployCache } from '../../../utils/deployCache.js';
1824
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
1925
import { coverageFormattersFlag } from '../../../utils/flags.js';
@@ -79,6 +85,8 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
7985

8086
public static errorCodes = toHelpSection('ERROR CODES', DEPLOY_STATUS_CODES_DESCRIPTIONS);
8187

88+
private deployUrl?: string;
89+
8290
public async run(): Promise<DeployResultJson> {
8391
const [{ flags }, cache] = await Promise.all([this.parse(DeployMetadataResume), DeployCache.create()]);
8492
const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id'], true);
@@ -87,11 +95,11 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
8795
const deployOpts = { ...cache.maybeGet(jobId), async: false };
8896

8997
let result: DeployResult;
98+
const org = await Org.create({ aliasOrUsername: deployOpts['target-org'] });
9099

91100
// If we already have a status from cache that is not resumable, display a warning and the deploy result.
92101
if (isNotResumable(deployOpts.status)) {
93102
this.warn(messages.getMessage('warning.DeployNotResumable', [jobId, deployOpts.status]));
94-
const org = await Org.create({ aliasOrUsername: deployOpts['target-org'] });
95103
const componentSet = await buildComponentSet({ ...deployOpts, wait: Duration.seconds(0) });
96104
const mdapiDeploy = new MetadataApiDeploy({
97105
// setting an API version here won't matter since we're just checking deploy status
@@ -125,6 +133,8 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
125133
);
126134

127135
this.log(`Deploy ID: ${ansis.bold(jobId)}`);
136+
this.deployUrl = buildDeployUrl(org, jobId);
137+
this.log(`Deploy URL: ${ansis.bold(this.deployUrl)}`);
128138
new DeployProgress(deploy, this.jsonEnabled()).start();
129139
result = await deploy.pollStatus(500, wait.seconds);
130140

@@ -146,6 +156,13 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
146156

147157
if (!this.jsonEnabled()) formatter.display();
148158

149-
return formatter.getJson();
159+
return this.mixinUrlMeta(await formatter.getJson());
160+
}
161+
162+
private mixinUrlMeta(json: DeployResultJson): DeployResultJson {
163+
if (this.deployUrl) {
164+
json.deployUrl = this.deployUrl;
165+
}
166+
return json;
150167
}
151168
}

0 commit comments

Comments
 (0)