jenkins icon indicating copy to clipboard operation
jenkins copied to clipboard

[JENKINS-69487] prevent uninstalled detached plugins get reinstalled

Open mawinter69 opened this issue 1 year ago • 7 comments

when a detached plugin gets uninstalled a marker file is created so that on next startup it will not be installed again. e.g. the javax-mail-api plugin is loaded frequently but usually not needed by most older plugins.

See JENKINS-69487 also JENKINS-72195

Testing done

added unit tests validating the behaviour

Proposed changelog entries

  • JENKINS-XXXXX, human-readable text

Proposed upgrade guidelines

N/A

### Submitter checklist
- [x] The Jira 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](https://github.com/jenkins-infra/jenkins.io/blob/master/content/_data/changelogs/weekly.yml)). 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.
- [ ] 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](https://www.jenkins.io/doc/developer/security/csp/)).
- [ ] 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

@mention

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](https://github.com/jenkinsci/jenkins/pull/4387)).
- [ ] If it would make sense to backport the change to LTS, a Jira issue must exist, be a _Bug_ or _Improvement_, and be labeled as `lts-candidate` to be considered (see [query](https://issues.jenkins.io/issues/?filter=12146)).

mawinter69 avatar Oct 22 '23 21:10 mawinter69

Some questions:

  • Should the behaviour always be active or should this depend on a systemproperty maybe
  • Would it make sense to have also an approach where one can specify the detached plugins not to install via another systemproperty (thinking of helm charts or dockerized, so that you can avoid the plugins from the beginning)

mawinter69 avatar Oct 22 '23 21:10 mawinter69

  • Should the behaviour always be active or should this depend on a systemproperty maybe

Looks fine to be always active

  • Would it make sense to have also an approach where one can specify the detached plugins not to install via another systemproperty (thinking of helm charts or dockerized, so that you can avoid the plugins from the beginning)

it would be nice yeah in these systems plugins are generally not touched manually and are fully defined in code.

timja avatar Oct 23 '23 20:10 timja

Thanks for looking into this!

How does it behave when you're installing new plugins, or just updating existing plugins, with implicit dependencies? At least in the new plugin case, I'd expect the implicit dependency to get installed (otherwise too unsafe, admin's decision can be assumed to be scoped to the set of plugins installed when they decided to uninstall), but if it behaves the same when updating an existing plugin, it'll get annoying quickly if plugins with slightly older core dependencies are actively maintained.

daniel-beck avatar Oct 23 '23 21:10 daniel-beck

Thanks for looking into this!

How does it behave when you're installing new plugins, or just updating existing plugins, with implicit dependencies? At least in the new plugin case, I'd expect the implicit dependency to get installed (otherwise too unsafe, admin's decision can be assumed to be scoped to the set of plugins installed when they decided to uninstall), but if it behaves the same when updating an existing plugin, it'll get annoying quickly if plugins with slightly older core dependencies are actively maintained.

At the moment the plugin would always be ignored. Maybe we can show a message after installing new plugins, that there are plugins that have been uninstalled and which where not installed. Though such a message might be missed when one directly leaves the page with the installation status. At least we could show a warning when uninstalling such a plugin, that it will be ignored and that this can lead to issues when plugins get installed that implicitly depend on it. Distinguishing between updates and new installs might be tricky. e.g. when I have installed plugin A in version 1 that has an implied dep to javax-mail-api. Assume there is already a version 2 of plugin A that still has the implied dep. Further assume I now install plugin B (not having implied dep to anything) that requires plugin A version 2. I'm not sure if it's worth the effort, the candidates for this feature are most likely the javax-mail-api (where having it can lead to problems) and the oracle JDK plugins.

mawinter69 avatar Oct 24 '23 10:10 mawinter69

I'm not sure if it's worth the effort, the candidates for this feature are most likely the javax-mail-api (where having it can lead to problems) and the oracle JDK plugins.

We don't know what we'll remove in the future. There are Jira issue suggesting we rip out FreeStyleProject, for example.

Maybe we can show a message after installing new plugins, that there are plugins that have been uninstalled and which where not installed. Though such a message might be missed when one directly leaves the page with the installation status.

AdministrativeError could be used for this (even if not nice), or another new (possibly ad-hoc instantiated, depending on the behavior we want) subclass of AdministrativeMonitor.

daniel-beck avatar Oct 24 '23 10:10 daniel-beck

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Dec 04 '23 01:12 github-actions[bot]

Please take a moment and address the merge conflicts of your pull request. Thanks!

github-actions[bot] avatar Jul 19 '24 21:07 github-actions[bot]