@@ -13,7 +13,13 @@ import { Duration } from '@salesforce/kit';
1313import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js' ;
1414import { DeployProgress } from '../../../utils/progressBar.js' ;
1515import { 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' ;
1723import { DeployCache } from '../../../utils/deployCache.js' ;
1824import { DEPLOY_STATUS_CODES_DESCRIPTIONS } from '../../../utils/errorCodes.js' ;
1925import { 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