@@ -22,6 +22,7 @@ import {
2222 printBlank ,
2323 printWarning ,
2424 setVerbose ,
25+ isVerbose ,
2526 createSpinner ,
2627} from '../utils/output' ;
2728import {
@@ -194,8 +195,8 @@ async function resolveSetup(rawEnv: string | undefined, rawVersion: string | und
194195 // Display info
195196 printInfo ( `Version: ${ deployVersion } ` ) ;
196197 printInfo ( `Environment: ${ env } ` ) ;
197- printInfo ( `Manager: ${ manager . name } (${ manager . host } )` ) ;
198- if ( workers . length > 0 ) printInfo ( `Workers: ${ workers . map ( ( w ) => `${ w . name } (${ w . host } )` ) . join ( ', ' ) } ` ) ;
198+ printInfo ( `Manager: ${ isVerbose ( ) ? ` ${ manager . name } (${ manager . host } )` : manager . name } ` ) ;
199+ if ( workers . length > 0 ) printInfo ( `Workers: ${ workers . map ( ( w ) => isVerbose ( ) ? `${ w . name } (${ w . host } )` : w . name ) . join ( ', ' ) } ` ) ;
199200 printInfo ( `Branch: ${ branchName } ` ) ;
200201 printInfo ( `Targets: ${ targetDesc } ` ) ;
201202 if ( options . only ) printInfo ( `Only: ${ options . only } ` ) ;
@@ -219,6 +220,21 @@ async function resolveSetup(rawEnv: string | undefined, rawVersion: string | und
219220 ) ;
220221 config = loadConfig ( { content : rendered . get ( '.dockflow/config.yml' ) , silent : true } ) ?? config ;
221222
223+ // Validate --only service names before acquiring the lock
224+ if ( options . only ) {
225+ const compose = Compose . loadFromString ( composeContent ) ;
226+ const available = Object . keys ( compose . services ) ;
227+ const filterSet = options . only . split ( ',' ) . map ( ( s ) => s . trim ( ) ) ;
228+ const unknown = filterSet . filter ( s => ! available . includes ( s ) ) ;
229+ if ( unknown . length > 0 ) {
230+ throw new DeployError (
231+ `Unknown service(s): ${ unknown . join ( ', ' ) } . Available: ${ available . join ( ', ' ) } ` ,
232+ ErrorCode . VALIDATION_FAILED ,
233+ 'Use the exact service names defined in your docker-compose file.' ,
234+ ) ;
235+ }
236+ }
237+
222238 // Build context
223239 const orchType = config . orchestrator ?? 'swarm' ;
224240 const managerConn = cluster . manager . connection ;
@@ -255,19 +271,6 @@ async function execute(ctx: DeployContext): Promise<void> {
255271 try {
256272 const compose = Compose . loadFromString ( ctx . composeContent ) ;
257273
258- if ( ctx . options . only ) {
259- const filterSet = new Set ( ctx . options . only . split ( ',' ) . map ( ( s : string ) => s . trim ( ) ) ) ;
260- const composeServiceNames = Object . keys ( compose . services ) ;
261- const unknown = [ ...filterSet ] . filter ( s => ! composeServiceNames . includes ( s ) ) ;
262- if ( unknown . length > 0 ) {
263- throw new DeployError (
264- `Unknown service(s): ${ unknown . join ( ', ' ) } . Available: ${ composeServiceNames . join ( ', ' ) } ` ,
265- ErrorCode . VALIDATION_FAILED ,
266- 'Use the exact service names defined in your docker-compose file.' ,
267- ) ;
268- }
269- }
270-
271274 Compose . updateImageTags ( compose , ctx . config , ctx . env , ctx . deployVersion , ctx . options . only ) ;
272275
273276 await buildAndDistribute ( ctx , compose ) ;
0 commit comments