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

Simplify status checks output for "error" and "unstable" steps #125

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KalleOlaviNiemitalo
Copy link

@KalleOlaviNiemitalo KalleOlaviNiemitalo commented Sep 5, 2021

Intended to fix #124 but not yet ready.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

In status checks, if the run failed because of an "error" pipeline step,
then use the first line of the error message in the title of ChecksOutput,
instead of "error in 'error' step".

However, keep the original behaviour if the error message does not
match the "message" argument of the step, if the step has other
arguments, or if the first line of the message is empty.

Update the test so that it keeps passing,
In status checks, omit the name and arguments of the "error" or
"unstable" step from the output if the error or warning message
matches the "message" argument of the step and there are no other
arguments.

Update the tests so that they keep passing.
@KalleOlaviNiemitalo
Copy link
Author

This needs a new test for the case where the arguments of the step are still displayed. Although one test already runs archiveArtifacts with two arguments and causes it to report an error, those arguments are not in the output and so cannot be used for testing this feature; perhaps because StepDescriptor.argumentsToString gives up if there are multiple arguments.

@KalleOlaviNiemitalo KalleOlaviNiemitalo changed the title Use message from "error" step in title Simplify status checks output for "error" and "unstable" steps Sep 5, 2021
@KalleOlaviNiemitalo
Copy link
Author

I probably won't continue this before 2021-09-18.

if (message != null) {
final String firstLine = message.split("\r?\n", 2)[0];
if (!firstLine.isEmpty()) {
return firstLine;
Copy link

@justinmchase justinmchase Sep 8, 2021

Choose a reason for hiding this comment

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

Perhaps add a maximum length on here too in case the first line is something crazy long?

return firstLine.length > 256 ? firstLine.substr(0, 255) + "" : firstLine;

Copy link

@justinmchase justinmchase left a comment

Choose a reason for hiding this comment

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

Look good!

@justinmchase
Copy link

Hows it going here?

@KalleOlaviNiemitalo

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Primary error message is not shown in error header, instead says error in 'error' step
2 participants