Skip to content
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

Format installation errors for GitHub Actions in headless mode #3239

Merged
merged 2 commits into from
Dec 17, 2020

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Dec 17, 2020

Problem

If metadata pull request validation (see KSP-CKAN/xKAN-meta_testing#61) fails at the installation stage, errors are printed but aren't recognized as errors by the GitHub workflow framework, so they're not highlighted or pinned to the affected file:

image

Cause

Error messages are just passed to IUser.RaiseMessage, despite reporting error conditions, which in turn just outputs via System.Console.WriteLine. GitHub actions require special formatting to recognize error messages.

Changes

  • Now one call per error is made to RaiseError, the one that's most likely to be helpful if pinned to a file
  • Now if we're in Headless mode, RaiseError prints via log.ErrorFormat, and also replaces all line break sequences with %0A so multi-line messages can be handled properly
  • Some other minor cleanup like using DependencyNotSatisfiedKraken.Message since it's nicer than the message we had previously

As far as I could tell we do not have a warning-level message in this code currently, which is good because IUser doesn't have a designated way to handle them.

@HebaruSan HebaruSan added Enhancement New features or functionality Easy This is easy to fix Cmdline Issues affecting the command line Pull request Infrastructure Issues affecting everything around CKAN (the GitHub repos, build process, CI, ...) labels Dec 17, 2020
@DasSkelett
Copy link
Member

We should probably do the changes from Cmdline/ConsoleUser.cs to Netkan/ConsoleUser.cs, too.

@HebaruSan
Copy link
Member Author

We can do that, but it looks like all we use that object for is to pass it to KSPManager.

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, let's give it a try!

@HebaruSan HebaruSan merged commit 87dd54e into KSP-CKAN:master Dec 17, 2020
@HebaruSan HebaruSan deleted the feature/headless-cmdline-errors branch December 17, 2020 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmdline Issues affecting the command line Easy This is easy to fix Enhancement New features or functionality Infrastructure Issues affecting everything around CKAN (the GitHub repos, build process, CI, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants