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

Allow plugins to override boot failure view #8442

Merged

Conversation

timja
Copy link
Member

@timja timja commented Aug 28, 2023

See JENKINS-XXXXX.

Currently it does not seem possible to provide your own BootFailure subclass for a startup error, Jenkins just displays a huge stacktrace with an error and you can't provide a nice error.

Before

image

After

image

Testing done

Manually with jenkinsci/configuration-as-code-plugin#2352

Created a file called jenkins.yaml in the work directory with these contents:

invalid:
  systemMessage2: Hello World

I have not been able to figure out how to write a unit test for this, at least with JTH the process is destroyed forcefully if Jenkins does not start and there's no way to get the information.

Proposed changelog entries

  • BootFailure subclasses can now override the Jenkins failed to startup page

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

@mention

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

Maintainer checklist

@timja timja marked this pull request as ready for review November 17, 2023 22:10
@timja timja added the rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Nov 17, 2023
@timja timja requested a review from a team November 17, 2023 22:12
@NotMyFault NotMyFault requested a review from a team December 4, 2023 08:22
@timja timja requested a review from a team December 16, 2023 22:01
@timja
Copy link
Member Author

timja commented Jan 2, 2024

@jenkinsci/core anyone mind taking a look please?

@jglick
Copy link
Member

jglick commented Jan 3, 2024

with JTH the process is destroyed forcefully if Jenkins does not start and there's no way to get the information

Might be a good addition to RealJenkinsRule: a variant of startJenkins that does not wait for the ping endpoint to response, letting the test code use e.g. HtmlUnit to query the Jenkins UI as it is.

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.

Logic could probably be simplified, but looks OK as it is.

} finally {
Jenkins instance = Jenkins.getInstanceOrNull();
if (!success && instance != null)
instance.cleanUp();
}
}

private Throwable unwrapException(Exception e) {
Copy link
Member

Choose a reason for hiding this comment

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

Could be simplified to return @CheckForNull BootFailure.

@timja
Copy link
Member Author

timja commented Jan 3, 2024

with JTH the process is destroyed forcefully if Jenkins does not start and there's no way to get the information

Might be a good addition to RealJenkinsRule: a variant of startJenkins that does not wait for the ping endpoint to response, letting the test code use e.g. HtmlUnit to query the Jenkins UI as it is.

maybe but the use-case seems very limited.


/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Jan 3, 2024
@timja timja merged commit e859e9c into jenkinsci:master Jan 5, 2024
17 checks passed
@timja timja deleted the allow-plugins-to-to-provide-boot-failure branch January 5, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants