-
Notifications
You must be signed in to change notification settings - Fork 166
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 reloading configuration from disk #545
Conversation
This makes the `load()` method work properly when called after startup, in case of a reload configuration from disk for example. Functionally, the `reconfigure()` method needs to be called implicitly when calling `load()`, because it updates a snapshot state that is used by running builds. If the persisted state has changed on disk then loaded, the snapshot needs to be updated accordingly. Without this patch, the `ScriptApproval` state is correct, but anything that has changed since last time it was loaded is not reflected on running builds.
r.assertLogNotContains("org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: " | ||
+ "Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance", | ||
r.assertBuildStatus(Result.SUCCESS, p.scheduleBuild2(0).get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps besides the point since you approved the whole script anyway, and if you had not, you would also get an error on method jenkins.model.Jenkins getLabels
, but OK.
I suspect this has caused jenkinsci/acceptance-test-harness#1444 (valid issues not just a test issue) |
LOG.log(Level.FINE, "Reconfiguring ScriptApproval after loading configuration from disk"); | ||
reconfigure(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is what is causing issues with the tests, most specifically with the hot plugin load.
This makes the
load()
method work properly when called after startup, in case of a reload configuration from disk for example.Functionally, the
reconfigure()
method needs to be called implicitly when callingload()
, because it updates a snapshot state that is used by running builds. If the persisted state has changed on disk then loaded, the snapshot needs to be updated accordingly.Without this patch, the
ScriptApproval
state is correct, but anything that has changed since last time it was loaded is not reflected on running builds.Testing done
Submitter checklist