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

[JENKINS-51913] Prevent archiveArtifacts from displaying a stack trace when no artifacts are found #6475

Merged
merged 9 commits into from
Apr 15, 2022

Conversation

gregswift
Copy link
Contributor

@gregswift gregswift commented Apr 13, 2022

Re-implementation of #4913
See JENKINS-51913.

Testing

Added a test to validate that there isn't a stack trace, and that the error is present.

Proposed changelog entries

Do not print a stack trace when archiveArtifact does not find a file.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • (n/a) For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@basil @jackgene

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are correct
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

Misc

Shout out to @adrianjgeorge for helping me out :D

@gregswift
Copy link
Contributor Author

thanks @basil for the assist on the errors in the test.

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@basil basil requested a review from a team April 13, 2022 22:28
@basil basil changed the title [JENKINS-51913] Prevent archiveArtifacts from displaying stacktrace when no artifact found. [JENKINS-51913] Prevent archiveArtifacts from displaying a stack trace when no artifacts are found Apr 13, 2022
@basil
Copy link
Member

basil commented Apr 14, 2022

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks!

@basil basil added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback bug For changelog: Minor bug. Will be listed after features labels Apr 14, 2022
@basil basil merged commit 4a38d65 into jenkinsci:master Apr 15, 2022
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Thanks! I saw the ping a couple weeks ago but just did not have time to dig in.

FreeStyleBuild build = j.buildAndAssertSuccess(project);
assertFalse(project.getBuildByNumber(1).getHasArtifacts());
j.assertLogContains("No artifacts found that match the file pattern \"" + pattern + "\"", build);
assertThat("No stacktrace shown", build.getLog(31), Matchers.iterableWithSize(lessThan(30)));
Copy link
Member

Choose a reason for hiding this comment

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

Or more directly could do something along the lines of

assertThat("No stacktrace shown", build.getLog(), not(containsString("\tat ")));

Copy link
Member

Choose a reason for hiding this comment

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

But then that would be inconsistent with other code in this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants