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

[FIXES JENKINS-47439] Setup wizard does not resume after restart #3166

Merged
merged 9 commits into from Dec 10, 2017

Conversation

Vlatombe
Copy link
Member

See JENKINS-47439.

More details about the fix available in commit logs.

Proposed changelog entries

  • Setup wizard is now resumed upon restart if it hasn't been completed (regression from 2.80)

Submitter checklist

  • JIRA issue is well described
  • Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    * Use the Internal: prefix if the change has no user-visible impact (API, test frameworks, etc.)
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@jenkinsci/code-reviewers
@reviewbybees

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.
Copy link
Member

@oleg-nenashev oleg-nenashev left a 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
Copy link
Member

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
Copy link
Member

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.
*/
Copy link
Member

Choose a reason for hiding this comment

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

@since TODO

}
saveQuietly();
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@oleg-nenashev oleg-nenashev left a 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

@oleg-nenashev oleg-nenashev added the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Dec 1, 2017
@oleg-nenashev oleg-nenashev added needs-more-reviews Complex change, which would benefit from more eyes and removed needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging labels Dec 1, 2017
Copy link
Member

@oleg-nenashev oleg-nenashev left a 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);
Copy link
Member

@jtnord jtnord Dec 1, 2017

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.
@daniel-beck daniel-beck self-requested a review December 1, 2017 14:03
@Vlatombe
Copy link
Member Author

Vlatombe commented Dec 1, 2017

looks like the run on linux is stuck..

Copy link
Member

@oleg-nenashev oleg-nenashev left a 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

@oleg-nenashev oleg-nenashev added the on-hold This pull request depends on another event/release, and it cannot be merged right now label Dec 3, 2017
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

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

LGTM

@oleg-nenashev oleg-nenashev added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback and removed on-hold This pull request depends on another event/release, and it cannot be merged right now needs-more-reviews Complex change, which would benefit from more eyes labels Dec 10, 2017
@oleg-nenashev
Copy link
Member

It was waiting long enough. I want to give it a chance to be backported to .3, because it is a serious issue. 🚢 🇮🇹

@oleg-nenashev oleg-nenashev merged commit 30ab448 into jenkinsci:master Dec 10, 2017
@Vlatombe Vlatombe deleted the JENKINS-47439 branch December 10, 2017 10:06
olivergondza pushed a commit that referenced this pull request Jan 31, 2018
* [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)
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
Projects
None yet
3 participants