Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
Add notice annotation level and support more annotation fields#1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f1b6ca5350ac77a4cb119b7b8dc099bacb752cc77fe33b2384b57dd1db13a2238b0650aa1f00f76bc6b781bb5ad8ba5e0ee2ec486File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -75,6 +75,12 @@ public bool TryProcessCommand(IExecutionContext context, string input, Container | ||
| return false; | ||
| } | ||
| if (!ActionCommandManager.EnhancedAnnotationsEnabled(context) && actionCommand.Command == "notice") | ||
| { | ||
| context.Debug($"Enhanced Annotations not enabled on the server: 'notice' command will not be processed."); | ||
| return false; | ||
| } | ||
| // Serialize order | ||
| lock (_commandSerializeLock) | ||
| { | ||
| @@ -141,6 +147,10 @@ public bool TryProcessCommand(IExecutionContext context, string input, Container | ||
| return true; | ||
| } | ||
| internal static bool EnhancedAnnotationsEnabled(IExecutionContext context) { | ||
luketomlinson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return context.Global.Variables.GetBoolean("DistributedTask.EnhancedAnnotations") ?? false; | ||
| } | ||
| } | ||
| public interface IActionCommandExtension : IExtension | ||
| @@ -498,6 +508,13 @@ public sealed class ErrorCommandExtension : IssueCommandExtension | ||
| public override string Command => "error"; | ||
| } | ||
| public sealed class NoticeCommandExtension : IssueCommandExtension | ||
| { | ||
| public override IssueType Type => IssueType.Notice; | ||
| public override string Command => "notice"; | ||
| } | ||
| public abstract class IssueCommandExtension : RunnerService, IActionCommandExtension | ||
| { | ||
| public abstract IssueType Type { get; } | ||
| @@ -512,6 +529,11 @@ public void ProcessCommand(IExecutionContext context, string inputLine, ActionCo | ||
| command.Properties.TryGetValue(IssueCommandProperties.Line, out string line); | ||
| command.Properties.TryGetValue(IssueCommandProperties.Column, out string column); | ||
| if (!ActionCommandManager.EnhancedAnnotationsEnabled(context)) | ||
| { | ||
| context.Debug("Enhanced Annotations not enabled on the server. The 'title', 'end_line', and 'end_column' fields are unsupported."); | ||
| } | ||
| Issue issue = new Issue() | ||
| { | ||
| Category = "General", | ||
| @@ -563,13 +585,73 @@ public void ProcessCommand(IExecutionContext context, string inputLine, ActionCo | ||
| context.AddIssue(issue); | ||
| } | ||
| public static void ValidateLinesAndColumns(ActionCommand command, IExecutionContext context) | ||
| { | ||
| command.Properties.TryGetValue(IssueCommandProperties.Line, out string line); | ||
| command.Properties.TryGetValue(IssueCommandProperties.EndLine, out string endLine); | ||
| command.Properties.TryGetValue(IssueCommandProperties.Column, out string column); | ||
| command.Properties.TryGetValue(IssueCommandProperties.EndColumn, out string endColumn); | ||
luketomlinson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| var hasStartLine = int.TryParse(line, out int lineNumber); | ||
| var hasEndLine = int.TryParse(endLine, out int endLineNumber); | ||
| var hasStartColumn = int.TryParse(column, out int columnNumber); | ||
| var hasEndColumn = int.TryParse(endColumn, out int endColumnNumber); | ||
| var hasColumn = hasStartColumn || hasEndColumn; | ||
| if (hasEndLine && !hasStartLine) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.EndLine}' can only be set if '{IssueCommandProperties.Line}' is provided"); | ||
| command.Properties[IssueCommandProperties.Line] = endLine; | ||
| hasStartLine = true; | ||
| line = endLine; | ||
| } | ||
luketomlinson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (hasEndColumn && !hasStartColumn) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.EndColumn}' can only be set if '{IssueCommandProperties.Column}' is provided"); | ||
| command.Properties[IssueCommandProperties.Column] = endColumn; | ||
| hasStartColumn = true; | ||
| column = endColumn; | ||
| } | ||
| if (!hasStartLine && hasColumn) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.Column}' and '{IssueCommandProperties.EndColumn}' can only be set if '{IssueCommandProperties.Line}' value is provided."); | ||
| command.Properties.Remove(IssueCommandProperties.Column); | ||
| command.Properties.Remove(IssueCommandProperties.EndColumn); | ||
| } | ||
| if (hasEndLine && line != endLine && hasColumn) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.Column}' and '{IssueCommandProperties.EndColumn}' cannot be set if '{IssueCommandProperties.Line}' and '{IssueCommandProperties.EndLine}' are different values."); | ||
| command.Properties.Remove(IssueCommandProperties.Column); | ||
| command.Properties.Remove(IssueCommandProperties.EndColumn); | ||
| } | ||
| if (hasStartLine && hasEndLine && endLineNumber < lineNumber) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.EndLine}' cannot be less than '{IssueCommandProperties.Line}'."); | ||
| command.Properties.Remove(IssueCommandProperties.Line); | ||
| command.Properties.Remove(IssueCommandProperties.EndLine); | ||
| } | ||
| if (hasStartColumn && hasEndColumn && endColumnNumber < columnNumber) | ||
| { | ||
| context.Debug($"Invalid {command.Command} command value. '{IssueCommandProperties.EndColumn}' cannot be less than '{IssueCommandProperties.Column}'."); | ||
| command.Properties.Remove(IssueCommandProperties.Column); | ||
| command.Properties.Remove(IssueCommandProperties.EndColumn); | ||
| } | ||
| } | ||
| private static class IssueCommandProperties | ||
| { | ||
| public const String File = "file"; | ||
| public const String Line = "line"; | ||
| public const String EndLine = "endLine"; | ||
| public const String Column = "col"; | ||
| public const String EndColumn = "endColumn"; | ||
| public const String Title = "title"; | ||
| } | ||
| } | ||
| public sealed class GroupCommandExtension : GroupingCommandExtension | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -516,6 +516,24 @@ public void AddIssue(Issue issue, string logMessage = null) | ||
| } | ||
| _record.WarningCount++; | ||
| } | ||
| else if (issue.Type == IssueType.Notice) | ||
| { | ||
| // tracking line number for each issue in log file | ||
luketomlinson marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // log UI use this to navigate from issue to log | ||
| if (!string.IsNullOrEmpty(logMessage)) | ||
| { | ||
| long logLineNumber = Write(WellKnownTags.Notice, logMessage); | ||
| issue.Data["logFileLineNumber"] = logLineNumber.ToString(); | ||
| } | ||
| if (_record.NoticeCount < _maxIssueCount) | ||
| { | ||
| _record.Issues.Add(issue); | ||
| } | ||
| _record.NoticeCount++; | ||
| } | ||
| _jobServerQueue.QueueTimelineRecordUpdate(_mainTimelineId, _record); | ||
| @@ -841,6 +859,7 @@ private void InitializeTimelineRecord(Guid timelineId, Guid timelineRecordId, Gu | ||
| _record.State = TimelineRecordState.Pending; | ||
| _record.ErrorCount = 0; | ||
| _record.WarningCount = 0; | ||
| _record.NoticeCount = 0; | ||
| if (parentTimelineRecordId != null && parentTimelineRecordId.Value != Guid.Empty) | ||
| { | ||
| @@ -1012,6 +1031,7 @@ public static class WellKnownTags | ||
| public static readonly string Command = "##[command]"; | ||
| public static readonly string Error = "##[error]"; | ||
| public static readonly string Warning = "##[warning]"; | ||
| public static readonly string Notice = "##[notice]"; | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we might want to make the UI changes first before we start writing this.... actually i guess it doesnt matter because no one will be using this initially. So we have some time to make that change in parallel | ||
| public static readonly string Debug = "##[debug]"; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,6 +9,9 @@ public enum IssueType | ||
| Error = 1, | ||
| [EnumMember] | ||
| Warning = 2 | ||
| Warning = 2, | ||
| [EnumMember] | ||
| Notice = 3 | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.