Skip to content

Commit 6822f4a

Browse files
authored
Report job level annotations (#4216)
1 parent ad43c63 commit 6822f4a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/Runner.Common/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public static class Features
173173
public static readonly string SnapshotPreflightImageGenPoolCheck = "actions_snapshot_preflight_image_gen_pool_check";
174174
public static readonly string CompareWorkflowParser = "actions_runner_compare_workflow_parser";
175175
public static readonly string SetOrchestrationIdEnvForActions = "actions_set_orchestration_id_env_for_actions";
176+
public static readonly string SendJobLevelAnnotations = "actions_send_job_level_annotations";
176177
}
177178

178179
// Node version migration related constants

src/Runner.Worker/ExecutionContext.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ public TaskResult Complete(TaskResult? result = null, string currentOperation =
499499

500500
PublishStepTelemetry();
501501

502-
if (_record.RecordType == "Task")
502+
if (_record.RecordType == ExecutionContextType.Task)
503503
{
504504
var stepResult = new StepResult
505505
{
@@ -532,6 +532,25 @@ public TaskResult Complete(TaskResult? result = null, string currentOperation =
532532
Global.StepsResult.Add(stepResult);
533533
}
534534

535+
if (Global.Variables.GetBoolean(Constants.Runner.Features.SendJobLevelAnnotations) ?? false)
536+
{
537+
if (_record.RecordType == ExecutionContextType.Job)
538+
{
539+
_record.Issues?.ForEach(issue =>
540+
{
541+
var annotation = issue.ToAnnotation();
542+
if (annotation != null)
543+
{
544+
Global.JobAnnotations.Add(annotation.Value);
545+
if (annotation.Value.IsInfrastructureIssue && string.IsNullOrEmpty(Global.InfrastructureFailureCategory))
546+
{
547+
Global.InfrastructureFailureCategory = issue.Category;
548+
}
549+
}
550+
});
551+
}
552+
}
553+
535554
if (Root != this)
536555
{
537556
// only dispose TokenSource for step level ExecutionContext

0 commit comments

Comments
 (0)