-
Notifications
You must be signed in to change notification settings - Fork 958
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
Log template errors as debug message #2637
Conversation
76c3ae0
to
2be59d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to not change anything under src/Sdk
within the runner, these files are shared with the service and they should be keep in sync. If you really plan to change this file, you will need to change it on the service first and rollout out to production, then copy the changed version to the runner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo change in this file?
Background
When parsing a workflow template there are two objects at play:
ExecutionContext
andTemplateContext
.ExecutionContext
stores all errors (named issues) that are later sent as job results.TemplateContext
on the other side is an object used, as the name suggests, during the template parsing. It also stores template errors together with field ids and names, to provide a meaningful message, which workflow line was invalid.The duplication comes from the fact that during the template reading:
TemplateContext
for the first timeAll that would be fine if not the small fact, that in step 1
TemplateContext
already added errors to the ExecutionContext: internally it is usingTraceWriter.Error
method that is…writing errors to theExecutionContext
:link
We could deduplicate issues in ExecutionContext based on error position and message, but that would not fix the underlying issue of logging two times the same error or fix the real issue, that is writing the same errors in multiple places.
Since the workflow parser code is used in other classes and there's a risk of regression, I have added a feature flag
DistributedTask.LogTemplateErrorsToTraceWriter
that will be passed from actions service. This way only one method inTemplateReader
will stop duplicating errors. With time we can expand this logic and disable TraceWriter error logging in other places.Long term solution would be code a refactoring, since
TemplateContext
has access to theTraceWriter
, it can manipulate the state ofExecutionContext
. These two should either be separated or merged into one object.Closes https://github.com/github/c2c-actions-runtime/issues/2381
Follow-up: https://github.com/github/actions-dotnet/pull/15290
Before
After
Workflow run with more debug logs
Branch