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
[FIXES JENKINS-47439] Setup wizard does not resume after restart #3166
Conversation
On first startup, the setup wizard goes into state NEW and the filter to force display the setup wizard is installed. On second startup, the setup wizard goes into state RESTART (which assumes the setup wizard is done), and the setup wizard is skipped completely. This test expects that state NEW is retained upon restart when nothing is done.
In some cases, the heuristics to determine the current setup wizard state are fragile. It is safer to persist the install state so that upon restart, the setup wizard can resume where it was left off.
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.
🐝 I do not see anything wrong in the code. But generally it requires lots of manual and upgradeability testing to which we definitely didn't dedicate enough time in previous changes
* Checks whether the given filter is already registered in the chain. | ||
* @param filter the filter to check. | ||
* @return true if the filter is already registered in the chain. | ||
* @since XXX |
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.
TODO or FIXME please.
|
||
/** | ||
* Returns whether the setup wizard filter is currently registered. | ||
* @since XXX |
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.
@since TODO
/** | ||
* Called upon install state update. | ||
* @param state the new install state. | ||
*/ |
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.
@since TODO
} | ||
saveQuietly(); |
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.
Is it safe to save the entire Jenkins instance at the current state. IIUC it may be not fully initialized though the state should likely indicate it
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.
SetupWizard
is initialized after InitMilestone.COMPLETED
so AFAIU this is safe.
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.
Test failures are related to the change as I see. "com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 403 Forbidden for http://localhost:62736/jenkins/" && Co likely happen due to the Install state lifecycle change. It needs a fix
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.
🐝 , I'd guess
@@ -92,7 +92,7 @@ public T get() { | |||
*/ | |||
public static void proceedToNextStateFrom(InstallState prior) { | |||
InstallState next = getNextInstallState(prior); | |||
if (Main.isDevelopmentMode) LOGGER.info("Install state transitioning from: " + prior + " to: " + next); | |||
LOGGER.log(Main.isDevelopmentMode ? Level.INFO : Level.FINE, "Install state transitioning from: " + prior + " to: " + next); |
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.
NIT: use parameterized logging
LOGGER.log(Main.isDevelopmentMode ? Level.INFO : Level.FINE, "Install state transitioning from: {0} to: {1}", new Object[] {from, to});
* Removed static isUsingSecurityToken. Now only determined from install state. * Call onInstallStateUpdate before InstallState#initializeState as the latter can update state.
looks like the run on linux is stuck.. |
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.
🐝 and @reviewbybees done. Putting on hold so others can review it
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.
LGTM
It was waiting long enough. I want to give it a chance to be backported to .3, because it is a serious issue. 🚢 🇮🇹 |
* [JENKINS-47439] Add a failing test On first startup, the setup wizard goes into state NEW and the filter to force display the setup wizard is installed. On second startup, the setup wizard goes into state RESTART (which assumes the setup wizard is done), and the setup wizard is skipped completely. This test expects that state NEW is retained upon restart when nothing is done. * [JENKINS-47439] Persist InstallState In some cases, the heuristics to determine the current setup wizard state are fragile. It is safer to persist the install state so that upon restart, the setup wizard can resume where it was left off. * Missing javadoc and since for new public methods * s/XXX/FIXME/ * Missed that one * Setup wizard filter should be removed when entering a state where setup is complete * Use parameterized logging * Improvements over previous impl * Removed static isUsingSecurityToken. Now only determined from install state. * Call onInstallStateUpdate before InstallState#initializeState as the latter can update state. * Triggering a new build (cherry picked from commit 30ab448)
See JENKINS-47439.
More details about the fix available in commit logs.
Proposed changelog entries
Submitter checklist
* Use the
Internal:
prefix if the change has no user-visible impact (API, test frameworks, etc.)Desired reviewers
@jenkinsci/code-reviewers
@reviewbybees