@@ -25,6 +25,15 @@ internal abstract class PublishCommandBase : BaseCommand
2525 protected readonly IProjectLocator _projectLocator ;
2626 protected readonly AspireCliTelemetry _telemetry ;
2727
28+ private static bool IsCompletionStateComplete ( string completionState ) =>
29+ completionState is CompletionStates . Completed or CompletionStates . CompletedWithWarning or CompletionStates . CompletedWithError ;
30+
31+ private static bool IsCompletionStateError ( string completionState ) =>
32+ completionState == CompletionStates . CompletedWithError ;
33+
34+ private static bool IsCompletionStateWarning ( string completionState ) =>
35+ completionState == CompletionStates . CompletedWithWarning ;
36+
2837 protected PublishCommandBase ( string name , string description , IDotNetCliRunner runner , IInteractionService interactionService , IProjectLocator projectLocator , AspireCliTelemetry telemetry )
2938 : base ( name , description )
3039 {
@@ -225,7 +234,7 @@ public static async Task<bool> ProcessPublishingActivitiesAsync(IAsyncEnumerable
225234 {
226235 if ( publishingActivity . Type == PublishingActivityTypes . PublishComplete )
227236 {
228- return ! publishingActivity . Data . IsError ;
237+ return ! IsCompletionStateError ( publishingActivity . Data . CompletionState ) ;
229238 }
230239 }
231240
@@ -267,7 +276,8 @@ public static async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsync
267276 Id = activity . Data . Id ,
268277 Title = activity . Data . StatusText ,
269278 Number = stepCounter ++ ,
270- StartTime = DateTime . UtcNow
279+ StartTime = DateTime . UtcNow ,
280+ CompletionState = activity . Data . CompletionState
271281 } ;
272282
273283 steps [ activity . Data . Id ] = stepInfo ;
@@ -279,15 +289,14 @@ public static async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsync
279289 }
280290 // If the step is complete, update the step info, clear out any pending progress tasks, and
281291 // display the completion status associated with the the step.
282- else if ( activity . Data . IsComplete )
292+ else if ( IsCompletionStateComplete ( activity . Data . CompletionState ) )
283293 {
284- stepInfo . IsComplete = true ;
285- stepInfo . IsError = activity . Data . IsError ;
294+ stepInfo . CompletionState = activity . Data . CompletionState ;
286295 stepInfo . CompletionText = activity . Data . StatusText ;
287296
288297 await currentStepProgress . DisposeAsync ( ) ;
289298
290- if ( stepInfo . IsError )
299+ if ( IsCompletionStateError ( stepInfo . CompletionState ) )
291300 {
292301 AnsiConsole . MarkupLine ( $ "[red bold]❌ FAILED:[/] { stepInfo . CompletionText . EscapeMarkup ( ) } ") ;
293302 }
@@ -329,7 +338,8 @@ public static async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsync
329338 {
330339 Id = activity . Data . Id ,
331340 StatusText = activity . Data . StatusText ,
332- StartTime = DateTime . UtcNow
341+ StartTime = DateTime . UtcNow ,
342+ CompletionState = activity . Data . CompletionState
333343 } ;
334344
335345 tasks [ activity . Data . Id ] = task ;
@@ -345,14 +355,12 @@ public static async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsync
345355 }
346356
347357 task . StatusText = activity . Data . StatusText ;
348- task . IsComplete = activity . Data . IsComplete ;
349- task . IsError = activity . Data . IsError ;
350- task . IsWarning = activity . Data . IsWarning ;
358+ task . CompletionState = activity . Data . CompletionState ;
351359
352- if ( task . IsError || task . IsWarning || task . IsComplete )
360+ if ( IsCompletionStateComplete ( activity . Data . CompletionState ) )
353361 {
354- var prefix = task . IsError ? "[red]✗ FAILED:[/]" :
355- task . IsWarning ? "[yellow]⚠ WARNING:[/]" : "[green]✓ DONE:[/]" ;
362+ var prefix = IsCompletionStateError ( task . CompletionState ) ? "[red]✗ FAILED:[/]" :
363+ IsCompletionStateWarning ( task . CompletionState ) ? "[yellow]⚠ WARNING:[/]" : "[green]✓ DONE:[/]" ;
356364 task . ProgressTask . Description = $ " { prefix } { task . StatusText . EscapeMarkup ( ) } ";
357365 task . CompletionMessage = activity . Data . CompletionMessage ;
358366
@@ -373,7 +381,7 @@ public static async Task<bool> ProcessAndDisplayPublishingActivitiesAsync(IAsync
373381 }
374382 }
375383
376- var hasErrors = publishingActivity ? . Data . IsError ?? false ;
384+ var hasErrors = publishingActivity is not null && IsCompletionStateError ( publishingActivity . Data . CompletionState ) ;
377385
378386 if ( publishingActivity is not null )
379387 {
@@ -434,8 +442,7 @@ private class StepInfo
434442 public string Title { get ; set ; } = string . Empty ;
435443 public int Number { get ; set ; }
436444 public DateTime StartTime { get ; set ; }
437- public bool IsComplete { get ; set ; }
438- public bool IsError { get ; set ; }
445+ public string CompletionState { get ; set ; } = CompletionStates . InProgress ;
439446 public string CompletionText { get ; set ; } = string . Empty ;
440447 public Dictionary < string , TaskInfo > Tasks { get ; } = [ ] ;
441448 }
@@ -445,9 +452,7 @@ private class TaskInfo
445452 public string Id { get ; set ; } = string . Empty ;
446453 public string StatusText { get ; set ; } = string . Empty ;
447454 public DateTime StartTime { get ; set ; }
448- public bool IsComplete { get ; set ; }
449- public bool IsError { get ; set ; }
450- public bool IsWarning { get ; set ; }
455+ public string CompletionState { get ; set ; } = CompletionStates . InProgress ;
451456 public string ? CompletionMessage { get ; set ; }
452457 public ProgressTask ? ProgressTask { get ; set ; }
453458 }
0 commit comments