Skip to content

Commit

Permalink
feat: build deploy URL using ID
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarvin8 committed Oct 14, 2024
1 parent a4d3848 commit 23bd739
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/commands/project/deploy/quick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Messages, Org } from '@salesforce/core';
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
import { MetadataApiDeploy, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { Duration } from '@salesforce/kit';
import { determineExitCode, resolveApi } from '../../../utils/deploy.js';
import { determineExitCode, resolveApi, buildDeployUrl } from '../../../utils/deploy.js';
import { DeployCache } from '../../../utils/deployCache.js';
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResultFormatter.js';
Expand Down Expand Up @@ -91,6 +91,8 @@ export default class DeployMetadataQuick extends SfCommand<DeployResultJson> {
rest: api === API['REST'],
});
this.log(`Deploy ID: ${ansis.bold(deployId)}`);
const deployUrl = buildDeployUrl(deployId);
this.log(`Deploy URL: ${ansis.bold(deployUrl)}`);

if (flags.async) {
const asyncFormatter = new AsyncDeployResultFormatter(deployId);
Expand Down
10 changes: 9 additions & 1 deletion src/commands/project/deploy/resume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { Duration } from '@salesforce/kit';
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { API, DeployResultJson } from '../../../utils/types.js';
import { buildComponentSet, determineExitCode, executeDeploy, isNotResumable } from '../../../utils/deploy.js';
import {
buildComponentSet,
determineExitCode,
executeDeploy,
isNotResumable,
buildDeployUrl,
} from '../../../utils/deploy.js';
import { DeployCache } from '../../../utils/deployCache.js';
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
import { coverageFormattersFlag } from '../../../utils/flags.js';
Expand Down Expand Up @@ -125,6 +131,8 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
);

this.log(`Deploy ID: ${ansis.bold(jobId)}`);
const deployUrl = buildDeployUrl(jobId);
this.log(`Deploy URL: ${ansis.bold(deployUrl)}`);
new DeployProgress(deploy, this.jsonEnabled()).start();
result = await deploy.pollStatus(500, wait.seconds);

Expand Down
4 changes: 3 additions & 1 deletion src/commands/project/deploy/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResul
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
import { AsyncDeployResultJson, DeployResultJson, TestLevel } from '../../../utils/types.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { executeDeploy, resolveApi, validateTests, determineExitCode } from '../../../utils/deploy.js';
import { executeDeploy, resolveApi, validateTests, determineExitCode, buildDeployUrl } from '../../../utils/deploy.js';
import { DeployCache } from '../../../utils/deployCache.js';
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
import { ConfigVars } from '../../../configMeta.js';
Expand Down Expand Up @@ -246,6 +246,8 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
throw new SfError('The deploy id is not available.');
}
this.log(`Deploy ID: ${ansis.bold(deploy.id)}`);
const deployUrl = buildDeployUrl(deploy.id);
this.log(`Deploy URL: ${ansis.bold(deployUrl)}`);

if (flags.async) {
if (flags['coverage-formatters']) {
Expand Down
4 changes: 3 additions & 1 deletion src/commands/project/deploy/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResul
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
import { DeployProgress } from '../../../utils/progressBar.js';
import { DeployResultJson, TestLevel } from '../../../utils/types.js';
import { executeDeploy, resolveApi, determineExitCode, validateTests } from '../../../utils/deploy.js';
import { executeDeploy, resolveApi, determineExitCode, validateTests, buildDeployUrl } from '../../../utils/deploy.js';
import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js';
import { ConfigVars } from '../../../configMeta.js';
import { coverageFormattersFlag, fileOrDirFlag, testLevelFlag, testsFlag } from '../../../utils/flags.js';
Expand Down Expand Up @@ -196,6 +196,8 @@ export default class DeployMetadataValidate extends SfCommand<DeployResultJson>
throw new SfError('The deploy id is not available.');
}
this.log(`Deploy ID: ${ansis.bold(deploy.id)}`);
const deployUrl = buildDeployUrl(deploy.id);
this.log(`Deploy URL: ${ansis.bold(deployUrl)}`);

if (flags.async) {
const asyncFormatter = new AsyncDeployResultFormatter(deploy.id);
Expand Down
7 changes: 6 additions & 1 deletion src/utils/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { ConfigAggregator, Messages, Org, SfError, SfProject } from '@salesforce/core';
import { ConfigAggregator, Messages, Org, OrgConfigProperties, SfError, SfProject } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { Nullable } from '@salesforce/ts-types';
import {
Expand Down Expand Up @@ -241,3 +241,8 @@ const buildApiOptions = (opts: Partial<DeployOptions>): MetadataApiDeployOptions
...(opts['test-level'] ? { testLevel: opts['test-level'] } : {}),
purgeOnDelete: opts['purge-on-delete'] ?? false,
});

export function buildDeployUrl(deployId: string): string {
const orgInstanceUrl = OrgConfigProperties.ORG_INSTANCE_URL;
return `${orgInstanceUrl}/lightning/setup/DeployStatus/page?address=%2Fchangemgmt%2FmonitorDeploymentsDetails.apexp%3FasyncId%3D${deployId}%26retURL%3D%252Fchangemgmt%252FmonitorDeployment.apexp`;
}

0 comments on commit 23bd739

Please sign in to comment.