107 references to CompletionState
Aspire.Hosting (67)
DistributedApplicationRunner.cs (1)
64await activityReporter.CompletePublishAsync(completionMessage: ex.Message, completionState: CompletionState.CompletedWithError, isDeploy: publishingOptions.Value.Deploy, cancellationToken: stoppingToken).ConfigureAwait(false);
Publishing\IPublishingActivityReporter.cs (1)
29Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, bool isDeploy = false, CancellationToken cancellationToken = default);
Publishing\IPublishingStep.cs (2)
28Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default);
Publishing\IPublishingTask.cs (2)
27Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default);
Publishing\Publisher.cs (6)
59(string Message, CompletionState State) taskInfo; 650 => ("No resources in the distributed application model support deployment.", CompletionState.CompletedWithError), 66_ => ($"Found {deployingResources.Count} resources that support deployment. ({string.Join(", ", deployingResources.Select(r => r.GetType().Name))})", CompletionState.Completed) 730 => ("No resources in the distributed application model support publishing.", CompletionState.CompletedWithError), 74_ => ($"Found {publishingResources.Count} resources that support publishing. ({string.Join(", ", publishingResources.Select(r => r.GetType().Name))})", CompletionState.Completed) 84if (taskInfo.State == CompletionState.CompletedWithError)
Publishing\PublishingActivityReporter.cs (28)
27private static string ToBackchannelCompletionState(CompletionState state) => state switch 29CompletionState.InProgress => CompletionStates.InProgress, 30CompletionState.Completed => CompletionStates.Completed, 31CompletionState.CompletedWithWarning => CompletionStates.CompletedWithWarning, 32CompletionState.CompletedWithError => CompletionStates.CompletedWithError, 48CompletionState = ToBackchannelCompletionState(CompletionState.InProgress), 66if (parentStep.CompletionState != CompletionState.InProgress) 84CompletionState = ToBackchannelCompletionState(CompletionState.InProgress), 93public async Task CompleteStepAsync(PublishingStep step, string completionText, CompletionState completionState, CancellationToken cancellationToken) 98if (step.CompletionState != CompletionState.InProgress) 131if (parentStep.CompletionState != CompletionState.InProgress) 146CompletionState = ToBackchannelCompletionState(CompletionState.InProgress), 154public async Task CompleteTaskAsync(PublishingTask task, CompletionState completionState, string? completionMessage, CancellationToken cancellationToken) 161if (task.CompletionState != CompletionState.InProgress) 168if (parentStep.CompletionState != CompletionState.InProgress) 193public async Task CompletePublishAsync(string? completionMessage = null, CompletionState? completionState = null, bool isDeploy = false, CancellationToken cancellationToken = default) 196var finalState = completionState ?? CalculateOverallAggregatedState(); 207CompletionState.Completed => $"{operationName} completed successfully", 208CompletionState.CompletedWithWarning => $"{operationName} completed with warnings", 209CompletionState.CompletedWithError => $"{operationName} completed with errors", 222private CompletionState CalculateOverallAggregatedState() 226return CompletionState.Completed; 229var maxState = CompletionState.InProgress; 232var stepState = step.CompletionState; 261return _steps.Any(step => step.Value.CompletionState == CompletionState.InProgress); 303CompletionState = ToBackchannelCompletionState(CompletionState.InProgress), 333CompletionState = ToBackchannelCompletionState(CompletionState.InProgress),
Publishing\PublishingExtensions.cs (6)
29await step.CompleteAsync(completionText, CompletionState.Completed, cancellationToken).ConfigureAwait(false); 46await step.CompleteAsync(completionText, CompletionState.CompletedWithWarning, cancellationToken).ConfigureAwait(false); 63await step.CompleteAsync(completionText, CompletionState.CompletedWithError, cancellationToken).ConfigureAwait(false); 95await task.CompleteAsync(message, CompletionState.Completed, cancellationToken).ConfigureAwait(false); 111await task.CompleteAsync(message, CompletionState.CompletedWithWarning, cancellationToken).ConfigureAwait(false); 127await task.CompleteAsync(errorMessage, CompletionState.CompletedWithError, cancellationToken).ConfigureAwait(false);
Publishing\PublishingStep.cs (14)
40public CompletionState CompletionState 46private CompletionState _completionState = CompletionState.InProgress; 74internal CompletionState CalculateAggregatedState() 78return CompletionState.Completed; 81var maxState = CompletionState.InProgress; 114public async Task CompleteAsync(string completionText, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default) 135if (CompletionState != CompletionState.InProgress) 141var finalState = CalculateAggregatedState(); 147CompletionState.Completed => $"{Title} completed successfully", 148CompletionState.CompletedWithWarning => $"{Title} completed with warnings", 149CompletionState.CompletedWithError => $"{Title} completed with errors",
Publishing\PublishingTask.cs (5)
47public CompletionState CompletionState { get; internal set; } = CompletionState.InProgress; 70public async Task CompleteAsync(string? completionMessage = null, CompletionState completionState = CompletionState.Completed, CancellationToken cancellationToken = default) 80if (CompletionState != CompletionState.InProgress)
Publishing\ResourceContainerImageBuilder.cs (2)
156await step.CompleteAsync("Building container images failed", CompletionState.CompletedWithError, cancellationToken).ConfigureAwait(false); 172await step.CompleteAsync("Building container images completed", CompletionState.Completed, cancellationToken).ConfigureAwait(false);
Aspire.Hosting.Azure (2)
AzurePublishingContext.cs (2)
2680 => ("No azure compute environments found in the model.", CompletionState.CompletedWithWarning), 269_ => ($"Found {computeEnvironments.Count} compute environment(s) in the model.", CompletionState.Completed)
Aspire.Hosting.Tests (38)
Publishing\PublishingActivityReporterTests.cs (33)
35Assert.Equal(CompletionState.InProgress, stepInternal.CompletionState); 74Assert.Equal(CompletionState.InProgress, taskInternal.CompletionState); 111await step.CompleteAsync("Completed", CompletionState.Completed, CancellationToken.None); 135await step.CompleteAsync(completionText, isError ? CompletionState.CompletedWithError : CompletionState.Completed, CancellationToken.None); 139Assert.NotEqual(CompletionState.InProgress, stepInternal.CompletionState); 215await step.CompleteAsync("Completed", CompletionState.Completed, CancellationToken.None); 245Assert.Equal(CompletionState.Completed, taskInternal.CompletionState); 269await step.CompleteAsync("Completed", CompletionState.Completed, CancellationToken.None); 280[InlineData(CompletionState.Completed, "Publishing completed successfully", false)] 281[InlineData(CompletionState.CompletedWithError, "Publishing completed with errors", true)] 282[InlineData(CompletionState.CompletedWithWarning, "Publishing completed with warnings", false)] 283public async Task CompletePublishAsync_EmitsCorrectActivity(CompletionState completionState, string expectedStatusText, bool expectedIsError) 299Assert.Equal(completionState == CompletionState.CompletedWithWarning, activity.Data.IsWarning); 310await reporter.CompletePublishAsync(expectedStatusText, CompletionState.CompletedWithError, isDeploy: false, CancellationToken.None); 335await step1.CompleteAsync("Step 1 completed", CompletionState.Completed, CancellationToken.None); 339await step2.CompleteAsync("Step 2 completed with warning", CompletionState.CompletedWithWarning, CancellationToken.None); 343await step3.CompleteAsync("Step 3 failed", CompletionState.CompletedWithError, CancellationToken.None); 429await step.CompleteAsync("Step completed", CompletionState.Completed, CancellationToken.None); 544var aggregatedState = stepInternal.CalculateAggregatedState(); 547Assert.Equal(CompletionState.Completed, aggregatedState); 565Assert.Equal(CompletionState.Completed, stepInternal.CompletionState); 599Assert.Equal(CompletionState.Completed, stepInternal.CompletionState); 620await step.CompleteAsync("Step completed manually", CompletionState.Completed, CancellationToken.None); 631Assert.Equal(CompletionState.Completed, stepInternal.CompletionState); 655Assert.Equal(CompletionState.CompletedWithWarning, taskInternal.CompletionState); 690Assert.Equal(CompletionState.CompletedWithError, taskInternal.CompletionState); 706[InlineData(CompletionState.Completed, "Deployment completed successfully", false)] 707[InlineData(CompletionState.CompletedWithError, "Deployment completed with errors", true)] 708[InlineData(CompletionState.CompletedWithWarning, "Deployment completed with warnings", false)] 709public async Task CompletePublishAsync_WithDeployFlag_EmitsCorrectActivity(CompletionState completionState, string expectedStatusText, bool expectedIsError) 725Assert.Equal(completionState == CompletionState.CompletedWithWarning, activity.Data.IsWarning); 736await reporter.CompletePublishAsync(expectedStatusText, CompletionState.CompletedWithError, isDeploy: true, CancellationToken.None);
Publishing\PublishingExtensionsTests.cs (5)
30Assert.Equal(CompletionState.InProgress, taskInternal.CompletionState); 47Assert.NotEqual(CompletionState.InProgress, stepInternal.CompletionState); 84Assert.Equal(CompletionState.Completed, taskInternal.CompletionState); 102Assert.Equal(CompletionState.CompletedWithWarning, taskInternal.CompletionState); 119Assert.Equal(CompletionState.CompletedWithError, taskInternal.CompletionState);