Skip to content

[JENKINS-69347] Prevent enabling a plugin whose dependency is disabled - #27739

Open
ityashag wants to merge 2 commits into
jenkinsci:masterfrom
ityashag:fix-enable-plugin-with-disabled-dependency
Open

ityashag wants to merge 2 commits into
jenkinsci:masterfrom
ityashag:fix-enable-plugin-with-disabled-dependency

Conversation

@ityashag

Copy link
Copy Markdown
Contributor

Fixes #18237

The Installed plugins page lets you switch on a plugin while one of its dependencies is switched off, even as the page says "This plugin cannot be enabled". Jenkins then records the plugin as enabled, and it fails to load on the next restart. This has been the case since 2.344.

The toggle is meant to be locked by the has-disabled-dependency rule, but two rules that unlock it come later in the stylesheet and win:

Both now skip rows with has-disabled-dependency, so a disabled dependency always keeps the toggle locked. JENKINS-68277 stays fixed: a plugin whose dependents are all off can still be switched off.

Testing done

  • PluginManagerInstalledGUITest decided whether a toggle could be changed from the row's classes alone, so it passed while the toggle could still be clicked. Each "changeable" and "not changeable" assertion now also checks the toggle's computed pointer-events. With master's stylesheet the test fails at the step where mandatory-depender has a disabled dependency ("The enable toggle of plugin 'mandatory-depender' can be clicked. expected: but was: "); with this change it passes. The steps for JENKINS-33843 and JENKINS-68277 still pass.
  • Manually on 2.590 and on a war built from this branch, with Pipeline: Model API and its dependencies installed, following the issue's steps:
    • On 2.590, after disabling Pipeline: Model API and then Jackson 2 API, the Pipeline: Model API toggle is still clickable, and clicking it enables the plugin on the server while Jackson 2 API stays disabled.
    • With this change the toggle is dimmed and ignores clicks, and the plugin stays disabled.
    • A plugin in the middle of a chain (Jackson 2 API, with JSON API disabled) is locked too. Re-enabling JSON API unlocks Jackson 2 API without a reload, and re-enabling Jackson 2 API unlocks Pipeline: Model API.
    • Unchanged: a plugin with an enabled dependent stays locked (structs), and one whose dependents are all disabled can still be switched off (Pipeline: Step API).
  • prettier --check and stylelint pass on the changed stylesheet; spotless:check passes on the test.

Screenshots (UI changes only)

Before

On 2.590 the toggle is clickable under "This plugin cannot be enabled":

Pipeline: Model API toggle is clickable under the notice that it cannot be enabled

After

The toggle is dimmed and ignores clicks:

Pipeline: Model API toggle is dimmed and locked

Proposed changelog entries

  • Prevent enabling a plugin while one of its dependencies is disabled (regression in 2.344).

Proposed changelog category

/label regression-fix

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@janfaracik, who wrote #6486

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

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

The has-disabled-dependency rule locks the enable toggle, but the
all-dependents-disabled override (made !important for JENKINS-68277) and
the has-dependents-but-disabled override come later and unlocked it again,
so the toggle took clicks under "This plugin cannot be enabled". Both
overrides now skip rows with a disabled dependency.

PluginManagerInstalledGUITest judged a toggle changeable from the row's
classes alone; it now also checks the toggle's computed pointer-events,
which fails on the old stylesheet.
@welcome

welcome Bot commented Nov 12, 2026

Copy link
Copy Markdown

Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!

A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.

@comment-ops-bot comment-ops-bot Bot added the regression-fix Pull request that fixes a regression in one of the previous Jenkins releases label Nov 12, 2026
@MarkEWaite
MarkEWaite requested a balanced review from Copilot November 12, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The regression test never exercises has-dependents-but-disabled, leaving the selector change unprotected without a disabled dependency-chain scenario that verifies pointer-events: none.

1 open issue
What changed in this PR

Fixes the Installed plugins page regression reported in #18237 by keeping toggles locked when a plugin has a disabled dependency, while preserving the ability to disable plugins whose dependents are all disabled.

Changes:

  • Prevent both toggle-unlocking CSS rules from overriding the disabled-dependency restriction.
  • Extend GUI assertions to check computed pointer-events, rather than relying solely on row classes.
File Description
test/​src/​test/​java/​hudson/​PluginManagerInstalledGUITest.java Adds computed-style assertions and links the regression issue.
src/​main/​scss/​pages/​_plugin-manager.scss Excludes plugins with disabled dependencies from both toggle-unlocking rules.

Review effort: Balanced

Comment on lines +42 to +44
tr.has-dependents-but-disabled:not(.has-disabled-dependency) .enable input,
tr.has-dependents-but-disabled:not(.has-disabled-dependency) .enable button,
tr.has-dependents-but-disabled:not(.has-disabled-dependency)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added test_disabled_dependency_locks_plugins_further_up_a_chain. Three synthetic plugins form a chain (chain-top → chain-middle → chain-bottom), all disabled before the page renders, so chain-middle carries has-dependents-but-disabled while its own dependency is disabled. The test checks that its toggle has pointer-events: none, that chain-top's does too, and that chain-bottom can still be enabled.

With only the has-dependents-but-disabled selector change reverted, it fails with "The enable toggle of plugin 'chain-middle' can be clicked. expected: but was: "; with this PR it passes.

Three synthetic plugins form a chain (chain-top depends on chain-middle,
which depends on chain-bottom), all disabled before the page renders. So
chain-middle carries has-dependents-but-disabled while its own dependency
is disabled, and its toggle must take no clicks. Without the
has-dependents-but-disabled selector change, the test fails on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regression-fix Pull request that fixes a regression in one of the previous Jenkins releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-69347] Can enable a plugin with disabled dependencies (regression in 2.344)

2 participants