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

Catch canceled step and mark build has failure #219

Merged
merged 2 commits into from
Oct 12, 2024

Conversation

hashar
Copy link
Contributor

@hashar hashar commented Sep 26, 2024

When using the Parameterized plugin, the triggered job can be canceled. That causes an AbortException to be thrown. Since it is not handled, PostBuildScript let it through and the build is marked in failure even when one explicitly asks to ignore any error.

Catch AbortException and mark the build has being in failure in such a case instead of bubbling up the exception.

Fixes: https://phabricator.wikimedia.org/T352319

Before submitting a pull request, please make sure the following is done:

  1. Fork the repository and create your branch from master.
  2. If you've fixed a bug or added code that should be tested, please add JUnit tests.
  3. Ensure the test suite passes (mvn clean verify).
  4. Run mvn hpi:run and go to http://localhost:8080/jenkins/ to test your changes. Add a job that produces your bug / feature scenario.

@hashar
Copy link
Contributor Author

hashar commented Sep 30, 2024

I am in the process of writing a test to cover this and will update the PR once I have finished.

When using the Parameterized plugin, the triggered job can be canceled.
That causes an `AbortException` to be thrown. Since it is not handled,
PostBuildScript let it through and the build is marked in failure even
when one explicitly asks to ignore any error.

Catch `AbortException` and mark the build has being in failure in such a
case instead of bubbling up the exception.

Fixes: https://phabricator.wikimedia.org/T352319
@hashar hashar force-pushed the handle-cancelled-steps branch from 5e56471 to 0efc8d5 Compare September 30, 2024 15:42
@dheid
Copy link
Contributor

dheid commented Oct 12, 2024

Thanks for the contribution, @hashar ! Sorry, that I didn't react earlier. I somehow must have overseen it.

@dheid dheid added the java Pull requests that update Java code label Oct 12, 2024
@dheid dheid self-assigned this Oct 12, 2024
@dheid dheid self-requested a review October 12, 2024 13:47
Copy link
Contributor

@dheid dheid left a comment

Choose a reason for hiding this comment

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

LGTM

@dheid dheid merged commit 5772c31 into jenkinsci:main Oct 12, 2024
17 checks passed
@hashar
Copy link
Contributor Author

hashar commented Oct 18, 2024

@dheid no worries and thank you for the review, merge and release!

I found another issue which this times lie in the parameterized plugin :-]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants