Commit Graph
296 Commits
Author SHA1 Message Date
Vincent Latombe dd59e8c11c [JENKINS-60449] Attempt to fix an odd case of OptionalExtension blowing up Jenkins (#4393)
* Add new module optional-depender and a new failing test

* Variant plugin is a dependency of optional-depender

Optional-depender contains the following class

@OptionalExtension(requirePlugins = {"dependee"})
public class OptionalDependerExtension {
      private static void foo(Dependee d) {

      }
}

* [JENKINS-60449] Move plugin initialization at the end, keep only one extension refresh

* Improve logic to detect classloading issues

Inspect all declared constructors/methods/fields recursively to exclude
failing classes from Guice rather than have Guice explode.

This also fix the failing test, but the previous commit is still better
because it avoids an extra Jenkins.get().refreshExtensions() call.

* Only test resolveClass method if the classloader is not the bootstrap one
2020-01-03 23:26:35 +01:00
StefanSpiekerandOleg Nenashev 8b893a1cbe [JENKINS-36720]: Fixed some Spotbugs issues (#4180)
* [JENKINS-36720]: Fixed Spotbugs issues WMI_WRONG_MAP_ITERATOR and OS_OPEN_STREAM in core

* merged try with resources with try finally

* reverted auto format from IDE

* reverted auto format from IDE

* use Util.fileToPath() as suggested to remove catch block

* merged try statements

* merged try statements

* reverted some whitespace fixes

* reverted another whitespace fix

* Apply suggestions from code review

Co-Authored-By: Oleg Nenashev <o.v.nenashev@gmail.com>

* reverted change

* reverted change

* reverted change

Co-authored-by: Oleg Nenashev <o.v.nenashev@gmail.com>
2019-12-29 12:50:10 +01:00
Oleg Nenashev eedf2a4e2a Merge pull request #4262 from StefanSpieker/replace_getActiveInstance
Replaced deprecated getActiveInstance() with get()
2019-11-22 10:25:21 +01:00
Allan BurdajewiczandJesse Glick e99c183566 [JENKINS-59775] Ensure that PluginManager.start runs as SYSTEM (#4320)
* [JENKINS-59775] Ensure that PluginManager.start runs as SYSTEM

* Use User#getById

Co-Authored-By: Jesse Glick <jglick@cloudbees.com>

* [JENKINS-59383] Undo indent

* [JENKINS-59383] Undo indent
2019-11-02 16:45:28 +03:00
Basil Crow 861855953b Replace <code>…</code> with {@code …} 2019-10-19 14:02:59 -07:00
Stefan Spieker 35dedaf917 merged master and use suggested type for tests 2019-10-08 23:35:34 +02:00
Stefan Spieker 76057897be replaced deprecated getActiveInstance() with get() 2019-10-03 21:13:14 +02:00
Raihaan Shouhell e5d578b617 Use type inference instead of specifying it 2019-10-01 13:30:39 +08:00
Daniel Beck 16145cca86 [JENKINS-59514] Use POST instead of RequirePOST for form submissions (#4223)
* [JENKINS-59514] Use POST instead of RequirePOST for form submissions

* More form submission URLs

* More form submission endpoints
2019-09-27 22:58:17 +02:00
StefanSpieker 69a524ab0b Fixed deprecated warnings without changing behaviour (#4177)
* fixed deprecated warnings without changing behaviour

* use Charset.defaultCharset() instead of null
2019-09-13 09:45:34 +02:00
Raihaan Shouhell 89702627a2 Fix annotations and remove unused imports (#4190) 2019-09-07 22:57:04 +02:00
Egor18 729ad5e540 Remove always true conditions 2019-08-21 01:28:28 -04:00
Jesse Glick 5169f14019 Batch up dynamic plugin installations from setup wizard (#4124)
* Batch up dynamic plugin installations from setup wizard.

* Reworked to thread the list of batched-up plugins properly and introduced CompleteBatchJob to force the setup wizard to wait.

* UpdateCenterPluginInstallTest.test_installKnownPlugins failure.

* @amuniz notes that an existing message could now be considered misleading.

* Introduced UpdateCenter.DownloadJob.getDisplayName for better consistency in logging, as suggested by @Vlatombe.

* Reducing log levels of messages from dynamicLoad which are not of great interest, as suggested by @Vlatombe.

* Reducing log level of another message of little interest.

* Adding classic UI for CompleteBatchJob.

* CompleteBatchJob should be used only when dynamicLoad.

* Null defense on UpdateCenterJob.site.
Otherwise can get:
java.lang.NullPointerException
	at hudson.model.UpdateCenter.getConnectionCheckJob(UpdateCenter.java:850)
	at hudson.model.UpdateCenter.addConnectionCheckJob(UpdateCenter.java:817)
	at hudson.model.UpdateCenter.addJob(UpdateCenter.java:804)
	at hudson.model.UpdateSite$Plugin.deploy(UpdateSite.java:1367)
	at hudson.PluginManager.install(PluginManager.java:1537)
	at hudson.PluginManager.install(PluginManager.java:1496)
	at hudson.PluginManager.doInstall(PluginManager.java:1445)
	at …
2019-08-01 19:55:44 +02:00
Jesse Glick b9d507cbcf Also skip detached plugin installation if a *.[jh]pl file exists. (#4100) 2019-07-11 16:55:41 +02:00
Ramon Leon 740f9eb3ed [JENKINS-57223] - Java11 ClassNotFoundExceptions Telemetry (#4003)
* Proof of concept catching exceptions for java 11 removed classes

* Add ClassLoader to a lot of places. Backup

* Commenting out wip stuff, change packages, count hits findClass

* Improvements, sending and tests

* Removing the catcher from chain to make funcional tests work

* Removing ignored places and a bit of cleaning

* Cleaning unused code after removing the catcher from the chain

* Remove imports cleaning to avoid extra changes

* Cleaning and explaining comments

* Explaining comments

* fix javadoc

* [JENKINS-57223] Address feedback from Matt Sicker. Improve in concurrency

* [JENKINS-57223] Search on cause and suppressed exceptions and fix on name reported

* [JENKINS-57223] Add cycles control on exceptions and refactor reporting method

* [JENKINS-57223] Add trim to class name comparison

* [JENKINS-57223] Address Oleg's feedback and some improvements

* Avoid sending CNFE when ignored later in code
* Disable when running on Java 8 and a test
* Avoid sending empty events

* [JENKINS-57223] Polish assertion after printing all missing classes in logs

* [JENKINS-57223] Avoid extra if and add curly braces

* [JENKINS-57223] Better comment about time window check
2019-07-05 15:27:55 +02:00
Gustavo de Souza Bezerra 0e62b68012 [JENKINS-57678] - Change getInstance() (deprecated) to get() (#4042)
* Change getInstance() (deprecated) to get()

* Reverting modifications according review

* Changing for use the variable
2019-06-27 17:24:45 +02:00
Jesse Glick 0f73231f77 [JENKINS-33843] Permit disabling optional dependencies (#4001)
* Implied dependencies on detached plugins were not being marked optional despite being listed in optionalDependencies, confusing the calculation of optionalDependents in resolveDependentPlugins.

* Javadoc improvements based on code exploration.

* [JENKINS-33843] Do not consider optional dependencies for purposes of disabling plugins.

* PluginManagerInstalledGUITest updated to reflect new behavior.
2019-06-15 11:21:20 +02:00
Jesse Glick 3bcdefcae4 [JENKINS-55582] Refinement to at least handle nonstandard $JENKINS_HOME/plugins/$shortName.hpi and warn about $shortName-$version.hpi. 2019-05-23 13:26:15 -04:00
Jesse Glick 855ea2eea2 [JENKINS-57528] - Load detached plugins which are implicit deps of other plugins at startup even w/o UC (#4000)
* Do not warn repeatedly of the same missing update site dependency.
This happens when locally testing split plugins (despite their presence in WEB-INF/detached-plugins/*.hpi).

(cherry picked from commit 918a0fd221)

* Detached plugins must be kept up to date with security advisories.

(cherry picked from commit e08d28a698)

* Load detached plugins which are implicit dependencies of other plugins at startup, even if the update center was not used.

(cherry picked from commit ad7a36001d)

* Adjusted expected version after e08d28a698.

(cherry picked from commit 84f939cebd)

* e08d28a698 exposed tests which had been incorrectly storing plugins as *.hpi rather than *.jpi.

(cherry picked from commit a0abad7ec4)

* Test failure after ad7a36001d.

(cherry picked from commit 0084e8dbdd)

* Another test failure after ad7a36001d30a6174b25e616fc3c215dd24919d1; fewer installDetachedPlugin calls are now required.

(cherry picked from commit b65bb54e99)
2019-05-17 16:22:22 +02:00
Josh Soref e1f7c6f345 IntelliJ/Java: Duplicate code
Refactored as PluginManager.logPluginWarnings
2019-05-14 21:47:37 -04:00
Josh Soref b9ef494715 Drop unnecessary casts 2019-02-21 00:42:18 -05:00
Josh Soref 2705139798 Remove useless assignment 2019-02-20 23:35:46 -05:00
Josh Soref 0fac99838c OpenJDK6: Collection.toArray() is apparently smart in modern java 2019-02-20 22:11:26 -05:00
Josh Soref b79ec4ff48 Java 7: try with resources 2019-02-20 22:01:10 -05:00
Josh Soref 264980c707 Java 7: omit explit type in favor of <> 2019-02-20 21:51:03 -05:00
Josh Soref 8825451f67 spelling: dependent (#3821)
* spelling: dependent

Writers following British writing convention often confuse dependent and dependant. Those following US writing convention have an easier time with these words because Americans do not use dependant.

A dependant is a person who is dependent on someone else. (For example, a child is dependent on its parents. Therefore, a child is a dependant of its parents.)

Jenkins does not deal with people, thus the UK rule which is confusing does not apply.

* Add deprecated shims
2019-02-28 14:12:37 +01:00
Josh Soref bd8091cf57 Drop useless local variables 2019-02-20 19:18:09 -05:00
Baptiste Mathus a78312ea0f [JENKINS-55681] - Make JAXB a detached plugin only on Java 11 (#3865)
* Move detached plugins logic into a dedicated class

ClassicPluginStrategy is already long enough, so trying to make things a
bit more focused before adding Java 11 logic. (and even if not, the change
still splits a class that is almost 1k lines).

* Install jaxb as detached only on Java 11+

* Remove duplicate @Restricted

Given the enclosing class already has it.

* Use 1.5 release

* Add more test coverage

* getMinJavaVersion => getMinimumJavaVersion

* Rename DetachedPluginsManager as DetachedPluginsUtil

as requested by Oleg and Jesse. Mainly because of the misleading
relationship (there's no inheritance) with the existing `PluginManager`
class.

* 🤦 adjust to 1.5 release method renaming

* Clarify minimum Java version column

Co-Authored-By: batmat <bmathus@gmail.com>

* Update to 2.3.0 version of the jaxb plugin

* Bump minimum core version to next expected release version

* Add preventive cycle breaks for jaxb while waiting for JENKINS-28942

As requested by Oleg.

* Add test to fail fast on wrong format for split-plugins.txt
2019-02-03 10:56:26 +01:00
Baptiste Mathus 27c49bf0a1 Merge branch 'master' into JENKINS-20679-filter-out-plugins-compiled-with-more-recent-jdk 2019-01-07 11:11:38 +01:00
M Ramon Leon b1e8c6565c [JENKINS-54731] Fix checkUpdateAttempts system property
Rename hudson.PluginManager.CHECK_UPDATE_ATTEMPTS system property to
hudson.PluginManager.checkUpdateAttempts
2018-11-20 18:12:37 +01:00
Stephen Connolly 389c5a7e60 Merge pull request #3269 from stephenc/jenkins-45235
[FIXED JENKINS-45235] When multiple update sites publish different versions, allow those versions to be seen
2018-11-19 13:35:21 +00:00
Ramon Leon 7aef24d454 [JENKINS-54459] Avoid Angry Jenkins when check now on Plugin Manager (#3718)
* [JENKINS-54459] Avoid angry Jenkins in Plugin Manager. Check Now

* [JENKINS-54459] Avoid angry Jenkins in Plugin Manager. Check Now

* [JENKINS-54459] Fix updateSiteRightJsonTest in Windows

* [JENKINS-54459] Minor fixes

* Avoid deprecated getInstance

Co-Authored-By: MRamonLeon <manuelramonleonjimenez@gmail.com>

* [JENKINS-54459] Some fixes

- Better system properties initialization
- Rename properties
- Localized messages
- Add test for change log level message
- Restore signatureCheck field after test
- Other minor improvements

* [JENKINS-54459] Add Retrier generic class and use it in the checking

* [JENKINS-54459] Improving Spanish messages

* [JENKINS-54459] Fix two javadoc errors

* [JENKINS-54459] Rename constants and its visibility

Rename the constants to do the retries and change their visibilities.

Change the package of the test to be able to access the constants in
order to redefine their values in the tests.

* [JENKINS-54459] Avoid external use of Retrier and test the delay time
2018-11-17 11:56:21 +01:00
Stephen Connolly 4bf99bae6e Merge branch 'master' into jenkins-45235 2018-11-16 21:17:13 +00:00
Baptiste Mathus 131794b84d Merge pull request #3648 from MRamonLeon/JENKINS-27177
[JENKINS-27177] Add disable plugin command and tests
2018-11-08 13:04:13 +01:00
M Ramon Leon 8bc71b7181 [JENKINS-27177] Improve messages 2018-10-18 11:11:10 +02:00
M Ramon Leon 65faa1e6d8 [JENKINS-27177] Minor fixes.
Change the way of an array copy and ensure non null args
2018-10-17 18:31:45 +02:00
M Ramon Leon 8f239f6ee1 [JENKINS-27177] Add new status error_disabling and minor fixes
When there is some problem disabling a plugin (the disabling file cannot
be created) it should be indicated and also reflected in the dependee
plugin.
2018-10-16 11:47:23 +02:00
M Ramon Leon 1aa7dbb818 [JENKINS-27177] Minor fixes 2018-10-15 11:56:27 +02:00
M Ramon Leon fe8d0d5e7c [JENKINS-27177] Add strategies to disable plugins. Move process to core
Move the process to core to be reusable, not only for the cli command.
Add optionalDependants list to PluginWrapper to process them easily.

Replace (depreacate) the disable method without checks by this one with
strategies.

Improve messages and tests
2018-10-15 10:06:21 +02:00
Oleg Nenashev 150de1df6e Merge pull request #3640 from oleg-nenashev/build/jdk11-underscore-vars
JDK-11 support: refactor code to avoid underscore variable names
2018-09-27 18:08:51 +02:00
Oleg Nenashev ba08ebc97a Refactoring: Cleanup <tt> tags from the Jenkins core Javadoc 2018-09-21 17:47:11 -07:00
Oleg Nenashev a3cc7780aa JDK11 support: refactor code to avoid underscore variable names 2018-09-21 16:47:59 -07:00
Daniel Beck f55864fe49 Add Java version check to setup wizard and installNecessaryPlugins
I'm not sure what the log message is supposed to be for, but other
checks also log, so apply the same behavior for Java dependency.
2018-09-20 11:38:40 -07:00
Daniel Beck 725fb3026b Update Javadocs and comments 2018-09-20 11:38:40 -07:00
Daniel Beck 87c61f527d Merge branch 'security-stable-2.121' into security-master 2018-08-02 02:28:34 +02:00
Daniel Beck 7ac1c48ea6 Merge branch 'security-stable-2.107' into security-stable-2.121 2018-08-02 02:27:38 +02:00
Daniel Beck 909781ca14 Merge branch 'security-stable-2.89' into security-stable-2.107 2018-08-02 02:26:18 +02:00
Daniel Beck e56103203c Merge branch 'security-stable-2.73' into security-stable-2.89 2018-08-02 02:24:55 +02:00
Wadeck Follonier 6867e44695 [SECURITY-1071] 2018-08-02 01:34:28 +02:00
Vincent Latombe 8c1b8b8e14 [JENKINS-50336] Fix loading optional extensions after installing a missing dependency (#3370)
* [JENKINS-50336] Only keep extensions that could be loaded in memory

So that delta computations will re-attempt to load any extension that
previously failed or was skipped after a new plugin is installed.

After installing a plugin, need to refresh extensions in order to pick
up extensions that can be loaded thanks to this new plugin.

* [JENKINS-50336] @OptionalExtension annotated classes were not being picked up after dynamic load of variant

Recompute GuiceExtensionAnnotation list when refreshing extensions
2018-06-08 19:30:11 +02:00