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

[FIXED JENKINS-37041] Ensure that detached plugins are always at least their minimum version #2489

Merged
merged 2 commits into from Jul 28, 2016

Conversation

@stephenc
Copy link
Member

stephenc commented Jul 28, 2016

See JENKINS-37041

Ok, so here was the test scenario:

  1. Upgrade Jenkins (this will upgrade the detached plugin)
  2. Stop Jenkins
  3. Overwrite the detached plugin with the older version
  4. Start Jenkins
  5. Watch as the world burns

With this fix, under my (slightly contrived) test scenario I now get

INFO: Started initialization
Jul 28, 2016 4:07:38 PM hudson.PluginManager loadDetachedPlugins
WARNING: Detached plugin bouncycastle-api found at version 1.648.3, required minimum version is 2.16.0
...
INFO: Initializing Bouncy Castle security provider.
Jul 28, 2016 4:07:39 PM jenkins.bouncycastle.api.SecurityProviderInitializer addSecurityProvider
INFO: Bouncy Castle security provider initialized.
Jul 28, 2016 4:07:42 PM jenkins.InitReactorRunner$1 onAttained

So this fixed the only code path that I could find that remained whereby a plugin that has been detached would not get upgraded (namely if the admin mistakenly overwrites the detached plugin with an older version than the stated minimum version)

CRITICAL IMHO that this lands in 2.16

@reviewbybees @jenkinsci/code-reviewers

…t their minimum version
@reviewbybees
Copy link

reviewbybees commented Jul 28, 2016

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

* @return the minimum required version for the current version of Jenkins.
* @sice 2.16
*/
public VersionNumber getRequireVersion() {

This comment has been minimized.

Copy link
@jglick

jglick Jul 28, 2016

Member

🐜 rename to getRequiredVersion (and rename field & constructor parameter to match)

@daniel-beck
Copy link
Member

daniel-beck commented Jul 28, 2016

Isn't this usually something that usually shows up in the detached plugin admin monitor?

Not opposed, just wondering how they relate.

final Set<ClassicPluginStrategy.DetachedPlugin> forceUpgrade = new HashSet<>();
for (ClassicPluginStrategy.DetachedPlugin p : ClassicPluginStrategy.getDetachedPlugins()) {
VersionNumber installedVersion = getPluginVersion(rootDir, p.getShortName());
VersionNumber requireVersion = p.getRequireVersion();

This comment has been minimized.

Copy link
@jglick

jglick Jul 28, 2016

Member

🐜 ditto here

@jglick
Copy link
Member

jglick commented Jul 28, 2016

Argh

npm ERR! shasum check failed for /tmp/npm-1725-b4cb96c5/registry.npmjs.org/jshint/-/jshint-2.9.2.tgz
@jglick jglick closed this Jul 28, 2016
@jglick jglick reopened this Jul 28, 2016
@jglick
Copy link
Member

jglick commented Jul 28, 2016

🐝

@stephenc
Copy link
Member Author

stephenc commented Jul 28, 2016

@daniel-beck so I believe the scenario that I have fixed addresses the root issue that @oleg-nenashev was trying to fix in #2436 (though that particular PR seems overly heavyweight and complex to fix this problem)

In the specific case of 2.16... you will be in a world of pain if bouncycastle does not load and hence you may not (depending on the other plugins you have installed) be even able to see the admin monitor... given that we have the plugin in the detached list and can therefore fix things for the user before unpacking the plugin archives, seems only prudent to fix things for them

@abayer
Copy link
Member

abayer commented Jul 28, 2016

🐝 assuming tests pass.

@jglick
Copy link
Member

jglick commented Jul 28, 2016

re🐝

@stephenc
Copy link
Member Author

stephenc commented Jul 28, 2016

@stephenc
Copy link
Member Author

stephenc commented Jul 28, 2016

I'm going to wait for the tests... @jenkinsci/code-reviewers as I view this fix as critical, anyone who wants to object has until the tests pass before I hit merge

@stephenc
Copy link
Member Author

stephenc commented Jul 28, 2016

@jenkinsci/code-reviewers if you want extra time to review, just say so and I will wait... but if I see the tests have passed and nobody else has either objected or asked for more time to review, then I will hit merge ;-)

@reviewbybees
Copy link

reviewbybees commented Jul 28, 2016

This pull request has completed our internal processes and we now respectfully request the maintainers of this repository to consider our proposal contained within this pull request for merging.

@stephenc
Copy link
Member Author

stephenc commented Jul 28, 2016

Ok tests passed

@stephenc stephenc merged commit 841cba5 into jenkinsci:master Jul 28, 2016
1 check passed
1 check passed
Jenkins This pull request looks good
Details
@oleg-nenashev
Copy link
Member

oleg-nenashev commented Jul 28, 2016

5 hours timeout is definitely not enough for @jenkinsci/code-reviewers :sadpanda:

@oleg-nenashev
Copy link
Member

oleg-nenashev commented Jul 28, 2016

The code looks good to me, but I'm not so happy about merging such highly-important changes without any tests

@stephenc stephenc deleted the stephenc:jenkins-37041 branch Jul 28, 2016
@daniel-beck
Copy link
Member

daniel-beck commented Aug 18, 2016

This may have caused JENKINS-37332.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.