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

fix(exceptions): add exception handler for exceptional situations #3845

Merged
merged 5 commits into from
Aug 9, 2020

Conversation

marchello2000
Copy link
Contributor

When a user submits a bad pipeline e.g.

  • with jenkins trigger that has an invalid properties file or job that doesn't exist)
  • with a broken pipeline template

we don't want to 500 because:
a) the calling service (echo in most cases here) will keep retrying which makes no sense
b) it's an erroneous HTTP 500 metric that is noise

@marchello2000 marchello2000 requested a review from cfieber August 6, 2020 20:26
@@ -478,4 +480,11 @@ class OperationsController {
pipeline.origin = AuthenticatedRequest.spinnakerUserOrigin.orElse('unknown')
}
}

@ExceptionHandler(UserException.class)
static void handleUserExceptions(UserException e, HttpServletResponse response) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do our generic error handlers in kork not handle UserException as a 400 already?

I think if they do, they will serve a json payload with some details instead of a text response - might play slightly nicer with handling API responses if they come back that way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh... i didn't see it let me look/try, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doesn't look like it, but i can add one to kork, that will obviate the need for them here

@marchello2000
Copy link
Contributor Author

When a user submits a bad pipeline e.g.
* with jenkins trigger that has an invalid properties file or job that doesn't exist)
* with a broken pipeline template

we don't want to 500 because:
a) the calling service (echo in most cases here) will keep retrying which makes no sense
b) it's an erroneous HTTP 500 metric that is noise
@marchello2000 marchello2000 force-pushed the mark/exceptionhandlers branch from c37251e to 87dab93 Compare August 6, 2020 22:40
1. Don't log task failures on `UserException`
2. Don't fail retrieving properties file if the build wasn't started
Copy link
Contributor

@cfieber cfieber left a comment

Choose a reason for hiding this comment

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

lgtm with kork fix

@marchello2000 marchello2000 added the ready to merge Approved and ready for merge label Aug 9, 2020
@mergify mergify bot added the auto merged Merged automatically by a bot label Aug 9, 2020
@mergify mergify bot merged commit 5f4b2ed into spinnaker:master Aug 9, 2020
KathrynLewis pushed a commit to KathrynLewis/orca that referenced this pull request Jan 31, 2021
…innaker#3845)

* fix(exceptions): add exceptionhandler for non-excpetional situations

When a user submits a bad pipeline e.g.
* with jenkins trigger that has an invalid properties file or job that doesn't exist)
* with a broken pipeline template

we don't want to 500 because:
a) the calling service (echo in most cases here) will keep retrying which makes no sense
b) it's an erroneous HTTP 500 metric that is noise

* fix(exceptions): fix various exception issues
1. Don't log task failures on `UserException`
2. Don't fail retrieving properties file if the build wasn't started

* fixup! Merge branch 'master' into mark/exceptionhandlers

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.22
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants