107 references to CompletionState
Aspire.Hosting (67)
DistributedApplicationRunner.cs (1)
64
await activityReporter.CompletePublishAsync(completionMessage: ex.Message, completionState:
CompletionState
.CompletedWithError, isDeploy: publishingOptions.Value.Deploy, cancellationToken: stoppingToken).ConfigureAwait(false);
Publishing\IPublishingActivityReporter.cs (1)
29
Task CompletePublishAsync(string? completionMessage = null,
CompletionState
? completionState = null, bool isDeploy = false, CancellationToken cancellationToken = default);
Publishing\IPublishingStep.cs (2)
28
Task CompleteAsync(string completionText,
CompletionState
completionState =
CompletionState
.Completed, CancellationToken cancellationToken = default);
Publishing\IPublishingTask.cs (2)
27
Task CompleteAsync(string? completionMessage = null,
CompletionState
completionState =
CompletionState
.Completed, CancellationToken cancellationToken = default);
Publishing\Publisher.cs (6)
59
(string Message,
CompletionState
State) taskInfo;
65
0 => ("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)
73
0 => ("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)
84
if (taskInfo.State ==
CompletionState
.CompletedWithError)
Publishing\PublishingActivityReporter.cs (28)
27
private static string ToBackchannelCompletionState(
CompletionState
state) => state switch
29
CompletionState
.InProgress => CompletionStates.InProgress,
30
CompletionState
.Completed => CompletionStates.Completed,
31
CompletionState
.CompletedWithWarning => CompletionStates.CompletedWithWarning,
32
CompletionState
.CompletedWithError => CompletionStates.CompletedWithError,
48
CompletionState = ToBackchannelCompletionState(
CompletionState
.InProgress),
66
if (parentStep.CompletionState !=
CompletionState
.InProgress)
84
CompletionState = ToBackchannelCompletionState(
CompletionState
.InProgress),
93
public async Task CompleteStepAsync(PublishingStep step, string completionText,
CompletionState
completionState, CancellationToken cancellationToken)
98
if (step.CompletionState !=
CompletionState
.InProgress)
131
if (parentStep.CompletionState !=
CompletionState
.InProgress)
146
CompletionState = ToBackchannelCompletionState(
CompletionState
.InProgress),
154
public async Task CompleteTaskAsync(PublishingTask task,
CompletionState
completionState, string? completionMessage, CancellationToken cancellationToken)
161
if (task.CompletionState !=
CompletionState
.InProgress)
168
if (parentStep.CompletionState !=
CompletionState
.InProgress)
193
public async Task CompletePublishAsync(string? completionMessage = null,
CompletionState
? completionState = null, bool isDeploy = false, CancellationToken cancellationToken = default)
196
var
finalState = completionState ?? CalculateOverallAggregatedState();
207
CompletionState
.Completed => $"{operationName} completed successfully",
208
CompletionState
.CompletedWithWarning => $"{operationName} completed with warnings",
209
CompletionState
.CompletedWithError => $"{operationName} completed with errors",
222
private
CompletionState
CalculateOverallAggregatedState()
226
return
CompletionState
.Completed;
229
var
maxState =
CompletionState
.InProgress;
232
var
stepState = step.CompletionState;
261
return _steps.Any(step => step.Value.CompletionState ==
CompletionState
.InProgress);
303
CompletionState = ToBackchannelCompletionState(
CompletionState
.InProgress),
333
CompletionState = ToBackchannelCompletionState(
CompletionState
.InProgress),
Publishing\PublishingExtensions.cs (6)
29
await step.CompleteAsync(completionText,
CompletionState
.Completed, cancellationToken).ConfigureAwait(false);
46
await step.CompleteAsync(completionText,
CompletionState
.CompletedWithWarning, cancellationToken).ConfigureAwait(false);
63
await step.CompleteAsync(completionText,
CompletionState
.CompletedWithError, cancellationToken).ConfigureAwait(false);
95
await task.CompleteAsync(message,
CompletionState
.Completed, cancellationToken).ConfigureAwait(false);
111
await task.CompleteAsync(message,
CompletionState
.CompletedWithWarning, cancellationToken).ConfigureAwait(false);
127
await task.CompleteAsync(errorMessage,
CompletionState
.CompletedWithError, cancellationToken).ConfigureAwait(false);
Publishing\PublishingStep.cs (14)
40
public
CompletionState
CompletionState
46
private
CompletionState
_completionState =
CompletionState
.InProgress;
74
internal
CompletionState
CalculateAggregatedState()
78
return
CompletionState
.Completed;
81
var
maxState =
CompletionState
.InProgress;
114
public async Task CompleteAsync(string completionText,
CompletionState
completionState =
CompletionState
.Completed, CancellationToken cancellationToken = default)
135
if (CompletionState !=
CompletionState
.InProgress)
141
var
finalState = CalculateAggregatedState();
147
CompletionState
.Completed => $"{Title} completed successfully",
148
CompletionState
.CompletedWithWarning => $"{Title} completed with warnings",
149
CompletionState
.CompletedWithError => $"{Title} completed with errors",
Publishing\PublishingTask.cs (5)
47
public
CompletionState
CompletionState { get; internal set; } =
CompletionState
.InProgress;
70
public async Task CompleteAsync(string? completionMessage = null,
CompletionState
completionState =
CompletionState
.Completed, CancellationToken cancellationToken = default)
80
if (CompletionState !=
CompletionState
.InProgress)
Publishing\ResourceContainerImageBuilder.cs (2)
156
await step.CompleteAsync("Building container images failed",
CompletionState
.CompletedWithError, cancellationToken).ConfigureAwait(false);
172
await step.CompleteAsync("Building container images completed",
CompletionState
.Completed, cancellationToken).ConfigureAwait(false);
Aspire.Hosting.Azure (2)
AzurePublishingContext.cs (2)
268
0 => ("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)
35
Assert.Equal(
CompletionState
.InProgress, stepInternal.CompletionState);
74
Assert.Equal(
CompletionState
.InProgress, taskInternal.CompletionState);
111
await step.CompleteAsync("Completed",
CompletionState
.Completed, CancellationToken.None);
135
await step.CompleteAsync(completionText, isError ?
CompletionState
.CompletedWithError :
CompletionState
.Completed, CancellationToken.None);
139
Assert.NotEqual(
CompletionState
.InProgress, stepInternal.CompletionState);
215
await step.CompleteAsync("Completed",
CompletionState
.Completed, CancellationToken.None);
245
Assert.Equal(
CompletionState
.Completed, taskInternal.CompletionState);
269
await 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)]
283
public async Task CompletePublishAsync_EmitsCorrectActivity(
CompletionState
completionState, string expectedStatusText, bool expectedIsError)
299
Assert.Equal(completionState ==
CompletionState
.CompletedWithWarning, activity.Data.IsWarning);
310
await reporter.CompletePublishAsync(expectedStatusText,
CompletionState
.CompletedWithError, isDeploy: false, CancellationToken.None);
335
await step1.CompleteAsync("Step 1 completed",
CompletionState
.Completed, CancellationToken.None);
339
await step2.CompleteAsync("Step 2 completed with warning",
CompletionState
.CompletedWithWarning, CancellationToken.None);
343
await step3.CompleteAsync("Step 3 failed",
CompletionState
.CompletedWithError, CancellationToken.None);
429
await step.CompleteAsync("Step completed",
CompletionState
.Completed, CancellationToken.None);
544
var
aggregatedState = stepInternal.CalculateAggregatedState();
547
Assert.Equal(
CompletionState
.Completed, aggregatedState);
565
Assert.Equal(
CompletionState
.Completed, stepInternal.CompletionState);
599
Assert.Equal(
CompletionState
.Completed, stepInternal.CompletionState);
620
await step.CompleteAsync("Step completed manually",
CompletionState
.Completed, CancellationToken.None);
631
Assert.Equal(
CompletionState
.Completed, stepInternal.CompletionState);
655
Assert.Equal(
CompletionState
.CompletedWithWarning, taskInternal.CompletionState);
690
Assert.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)]
709
public async Task CompletePublishAsync_WithDeployFlag_EmitsCorrectActivity(
CompletionState
completionState, string expectedStatusText, bool expectedIsError)
725
Assert.Equal(completionState ==
CompletionState
.CompletedWithWarning, activity.Data.IsWarning);
736
await reporter.CompletePublishAsync(expectedStatusText,
CompletionState
.CompletedWithError, isDeploy: true, CancellationToken.None);
Publishing\PublishingExtensionsTests.cs (5)
30
Assert.Equal(
CompletionState
.InProgress, taskInternal.CompletionState);
47
Assert.NotEqual(
CompletionState
.InProgress, stepInternal.CompletionState);
84
Assert.Equal(
CompletionState
.Completed, taskInternal.CompletionState);
102
Assert.Equal(
CompletionState
.CompletedWithWarning, taskInternal.CompletionState);
119
Assert.Equal(
CompletionState
.CompletedWithError, taskInternal.CompletionState);