From e7a2717b529407e1b469726dd981c203fed54e27 Mon Sep 17 00:00:00 2001 From: Cameron Booth Date: Tue, 23 May 2023 13:43:33 -0700 Subject: [PATCH] Only add StepResult for Tasks, not the Job itself --- src/Runner.Worker/ExecutionContext.cs | 42 +++++++++++++----------- src/Test/L0/Worker/ExecutionContextL0.cs | 3 +- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/Runner.Worker/ExecutionContext.cs b/src/Runner.Worker/ExecutionContext.cs index 70b78cc6353..ceaa8b78b1f 100644 --- a/src/Runner.Worker/ExecutionContext.cs +++ b/src/Runner.Worker/ExecutionContext.cs @@ -477,28 +477,32 @@ public TaskResult Complete(TaskResult? result = null, string currentOperation = PublishStepTelemetry(); - var stepResult = new StepResult - { - ExternalID = _record.Id, - Conclusion = _record.Result ?? TaskResult.Succeeded, - Status = _record.State, - Number = _record.Order, - Name = _record.Name, - StartedAt = _record.StartTime, - CompletedAt = _record.FinishTime, - Annotations = new List() - }; - - _record.Issues?.ForEach(issue => + if (_record.RecordType == "Task") { - var annotation = issue.ToAnnotation(); - if (annotation != null) + var stepResult = new StepResult { - stepResult.Annotations.Add(annotation.Value); - } - }); + ExternalID = _record.Id, + Conclusion = _record.Result ?? TaskResult.Succeeded, + Status = _record.State, + Number = _record.Order, + Name = _record.Name, + StartedAt = _record.StartTime, + CompletedAt = _record.FinishTime, + Annotations = new List() + }; + + _record.Issues?.ForEach(issue => + { + var annotation = issue.ToAnnotation(); + if (annotation != null) + { + stepResult.Annotations.Add(annotation.Value); + } + }); + + Global.StepsResult.Add(stepResult); + } - Global.StepsResult.Add(stepResult); if (Root != this) { diff --git a/src/Test/L0/Worker/ExecutionContextL0.cs b/src/Test/L0/Worker/ExecutionContextL0.cs index 2bdbd9f44cc..04a10f30598 100644 --- a/src/Test/L0/Worker/ExecutionContextL0.cs +++ b/src/Test/L0/Worker/ExecutionContextL0.cs @@ -821,8 +821,7 @@ public void PublishStepResult_EmbeddedStep() ec.Complete(); // Assert. - Assert.Equal(1, ec.Global.StepsResult.Count); - Assert.Equal(TaskResult.Succeeded, ec.Global.StepsResult.Single().Conclusion); + Assert.Equal(0, ec.Global.StepsResult.Count); } }