Commit Graph
279 Commits
Author SHA1 Message Date
Daniel Beck 869f66cc07 Merge branch 'master' of github.com:jenkinsci/jenkins into 2.0
Conflicts:
	changelog.html
	cli/pom.xml
	core/pom.xml
	core/src/main/java/hudson/ProxyConfiguration.java
	core/src/main/java/jenkins/model/Jenkins.java
	core/src/main/java/jenkins/slaves/JnlpSlaveHandshake.java
	core/src/main/resources/hudson/model/Messages_da.properties
	pom.xml
	test/pom.xml
	war/pom.xml
2016-03-16 19:00:40 +01:00
Stephen Connolly 96150d3a46 Jenkins.getInstance() will be @Nonnull in Jenkins 2.0+
- Code that is running from a plugin and on the master's JVM is guaranteed to never get null from this method (any cases where you do get null are bugs in core)
- Code that is running from a plugin and on a remote JVM should never be allowed to load the Jenkins class in their classloader, so should never use Jenkins.getInstance()... we are annotating the method with @Nullable so that such code can have some evolution time
- Code that is running in core and on one of two special paths should use the Jenkins.getInstanceOrNull() method so that the UI can be presented to users before the singleton has been instantiated / after the singleton has been destroyed
- The remaining 95% of uses in core (and 100% of uses in plugins) can safely assume that the instance is never null
2016-03-08 21:15:43 +00:00
Stephen Connolly d1dfbd2baf Revert "Jenkins.getInstance() should be non-null"
This reverts commit bb7c8fcedb.

Closes #2090, I'll redo this as a PR... though if that PR is subject to multiple rounds of review before being merged then I will take that of evidence of the exact problem that committing directly was supposed to resolve... namely exponentially multiplying the effort required to make actual improvements to the code base.
2016-03-08 21:09:28 +00:00
Stephen Connolly bb7c8fcedb Jenkins.getInstance() should be non-null
- It is never too late to do the right thing.
- The vast majority of usages of `Jenkins.getInstance()` in core currently assume that its return value is non-null
- This commit changes those that are written to correctly check for non-null values will call `Jenkins.getInstanceOrNull()`
- We deprecate the `Jenkins.getActiveInstance()` madness
- I checked with @kohsuke who said not to bother with a PR and just commit this strongly opinionated change direct to master as a PR will just degrade into a bikeshedding.
2016-03-07 22:08:36 +00:00
Antonio Muñiz 320e6c0702 Slave to Agent renaming - Javadocs and logs 2016-01-29 17:40:26 +01:00
Christopher Simons 7efb9090dd remove unused import statements
In addition to cluttering the namespace, unused imports generate
compiler warnings, introducing noise and obscuring more important
compiler warnings.  This change removes them.
2015-11-10 10:13:52 -05:00
Oleg Nenashev 4fd10ed723 Merge pull request #1429 from dominiquebrice/jenkins-5253b
[JENKINS-5253] Allow case insensitive patterns in Artifacts Archiving
2015-10-17 22:15:52 +03:00
Kanstantsin Shautsou 03bd5959cb Revert "Revert "[JENKINS-10629] - Migrate the Tar archives handling code to commons-compress""
This reverts commit 8f1280a85c.
2015-08-25 01:09:08 +03:00
Veres Lajos d58903558e typofix - https://github.com/vlajos/misspell_fixer 2015-08-11 16:34:13 +01:00
Oleg Nenashev ca21c65bf2 Merge pull request #1667 from oleg-nenashev/JENKINS-10629-FIX
[JENKINS-28013,JENKINS-28012] - Revert changes for JENKINS-10629
2015-04-23 09:07:34 -07:00
Oleg Nenashev 8f1280a85c Revert "[JENKINS-10629] - Migrate the Tar archives handling code to commons-compress"
This reverts commit b6c7b83e7b.
2015-04-22 17:22:44 -07:00
David Hoover 1709ed3a2e Add @Deprecated annotations to things documented as @deprecated. 2015-04-19 14:50:12 -07:00
Oleg Nenashev b6c7b83e7b [JENKINS-10629] - Migrate the Tar archives handling code to commons-compress 2015-04-14 19:02:32 +03:00
Dominique 40382c5fc4 [JENKINS-5253] Allow case insensitive patterns in Artifacts Archiving 2015-01-31 19:39:10 -05:00
Jesse Glick 36bce39ff4 [FIXED JENKINS-26476] Work around Remoting problem by avoiding reference to Functions. 2015-01-16 14:24:52 -05:00
Jesse Glick 1fcee97d2f [FIXED JENKINS-26196] More robust handling of server errors in FilePath.installIfNecessaryFrom. 2014-12-29 14:49:27 -05:00
Jesse Glick c527628db9 installIfNecessaryFrom Javadoc improvements and nullness annotations. 2014-12-29 12:18:53 -05:00
Jesse Glick 534328b264 [FIXED JENKINS-25759] Avoid consuming too much memory while running validateAntFileMask.
Not fully solved, since the scannedDirs field can still grow to be large, but at least clearing files/dirsNotIncluded.
Also imposing a 5s timeout on the scan regardless of file count, and defining a user-customizable bound.
2014-11-24 10:37:58 -05:00
Jesse Glick 8c10c75d85 Merge branch 'security-rc' into SECURITY-144-rc 2014-10-28 11:20:25 -04:00
Jesse Glick 0434a2ac4a readFromOffset needed to be adjusted too. 2014-10-26 15:47:47 -07:00
Jesse Glick 300b6fa519 Forgotten @since. 2014-10-26 13:58:40 -07:00
Jesse Glick f0658e233d Merge branch 'security-rc' into SECURITY-144-rc
Conflicts:
	core/src/main/java/hudson/FilePath.java
2014-10-26 13:55:39 -07:00
Jesse Glick 97b2f931ae Merge branch 'SECURITY-144' into SECURITY-144-rc 2014-10-20 08:57:11 -04:00
Kohsuke Kawaguchi 8a105ce57c Adding separate check for symlink to prevent jailbreak
Otherwise a symlink can be created to point to a file outside $JENKINS_HOME and be read
2014-10-17 19:03:55 -07:00
Jesse Glick c94c1716f3 Merge branch 'SECURITY-144' into SECURITY-144-rc
Conflicts:
	core/src/main/java/hudson/FilePath.java
	core/src/main/java/hudson/PluginManager.java
	core/src/main/java/hudson/PluginWrapper.java
2014-10-17 10:59:32 -04:00
Kohsuke Kawaguchi c20308c3fa Making FilePathFilter itself more composable 2014-10-16 16:55:17 -07:00
Jesse Glick 32376946b8 Merge branch 'SECURITY-144' into SECURITY-144-rc
Conflicts:
	core/src/main/java/hudson/FilePath.java
2014-10-16 13:18:39 -04:00
Jesse Glick ccbe96227f Merge branch 'security-rc' into SECURITY-144-rc
Conflicts:
	core/src/main/java/hudson/FilePath.java
	pom.xml
2014-10-16 13:18:08 -04:00
Kohsuke Kawaguchi 547cc241c0 untar() has the same problem as unzip() about the directionality of the read.
This code duplication in two sides of the if statement is undesirable.
Post-release, I need to come back here to introduce a variant of FileCallable that runs on the given FilePath but with InputStream to another FilePath.
2014-10-15 22:15:30 -07:00
Kohsuke Kawaguchi e37597a81d Unzipping a local zip into a remote directory results in the file getting read from remote.
This change flips the order so that the read happens locally, and pipe gets forwarded to the other side.
2014-10-15 19:51:49 -07:00
Jesse Glick adc218825d FilePath.read should rethrow any FileNotFoundException, SecurityException, etc. 2014-10-15 16:36:12 -04:00
Jesse Glick 698858fd92 Changes in remoting make wrapping IOException less necessary.
Still do it so we capture FilePath.remote (which many JRE methods suppress),
but fix the wrapper Throwable.message to include cause.toString() according to convention.
2014-10-15 16:12:10 -04:00
Kohsuke Kawaguchi e219d19613 Added a method to read a file from the middle 2014-10-13 17:31:08 -07:00
Jesse Glick 89cbfc4639 Merge branch 'SECURITY-144' into SECURITY-144-rc
Conflicts:
	core/src/main/java/hudson/EnvVars.java
	core/src/main/java/hudson/FilePath.java
	core/src/main/java/hudson/cli/ClientAuthenticationCache.java
	core/src/main/java/hudson/markup/MyspacePolicy.java
	core/src/main/java/hudson/model/Computer.java
	core/src/main/java/hudson/node_monitors/DiskSpaceMonitorDescriptor.java
	core/src/main/java/hudson/node_monitors/ResponseTimeMonitor.java
	core/src/main/java/hudson/node_monitors/TemporarySpaceMonitor.java
	core/src/main/java/hudson/security/AbstractPasswordBasedSecurityRealm.java
	core/src/main/java/hudson/slaves/Channels.java
	core/src/main/java/hudson/slaves/SlaveComputer.java
	core/src/main/java/hudson/tasks/Fingerprinter.java
	core/src/main/java/hudson/tasks/Shell.java
	core/src/main/java/hudson/tasks/junit/JUnitParser.java
	core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java
	core/src/main/java/hudson/util/ProcessTree.java
	core/src/main/java/hudson/util/RemotingDiagnostics.java
	core/src/main/java/jenkins/model/Jenkins.java
	core/src/test/java/hudson/LauncherTest.java
	pom.xml
	test/src/test/java/hudson/tasks/junit/CaseResultTest.java
2014-09-26 15:56:48 -04:00
Kohsuke Kawaguchi 4f733244e6 Moving MasterToSlaveFileCallable/SlaveToMasterFileCallable to the top level classes.
If we ever decide to develop a compatibility thunk library for these changes to help promote deployment in plugins,
then these classes being a nested type is problematic as they'll fail to load under onld Jenkins
2014-09-24 19:04:24 -07:00
Kohsuke Kawaguchi 201b035cfc Updated to reflect the signature change around role checking in remoting 2014-09-24 09:43:31 -07:00
Jesse Glick 253943e13e [JENKINS-5756] Removing workarounds for HotSpot bug.
https://bugs.openjdk.java.net/browse/JDK-6933067 claims to be fixed as of Java 6, our baseline.
2014-09-24 09:32:50 -04:00
Kohsuke Kawaguchi ffb5b65093 Switched from annotation based scheme to a function based scheme. 2014-09-23 19:12:43 -07:00
Kohsuke Kawaguchi 140d929516 Fixed the computation of effective FilePathFilter.
If a @SlaveToMaster Callable gets sent to the master, and if inside its call() method the code directly/indirectly performs file system access (for example on files and directories that it didn't receive as parameters), that is not meant to be the subject of the filter check.

Rather, the check is meant for FilePath that the other side sends to us, when it points to a local file.

So it makes more sense to compute the effective FilePathFilter during the deserialization, as opposed to doing so when the actual operation is attempted.

Various FileCallable impls in FilePath fits this pattern, as it drags outer FilePath instance with itself. In addition, this change addresses other situations correctly, where FilePath is used as arguments and return values of other Callables, such as the following:

FilePath f = channel.call(new SlaveWillDoSomeComputationAndGiveMeTheResultAsFile());
f.copyTo(build.getRootDir().child("data.xml"))

"f.copyTo" happens in the context of Channel.current()==null, but we need to check that 'f' is legit and not something like
new FilePath(new File("/etc/shadow"))
2014-09-23 14:53:31 -07:00
Kohsuke Kawaguchi c0260056e5 in pre-cursor for the next change, make all remoting call go through FileCallable 2014-09-23 14:53:31 -07:00
Jesse Glick 735ba83148 Installing a default FilePathFilter that rejects everything. 2014-09-22 12:54:05 -04:00
Jesse Glick 4fabe92368 One-letter typo caused massive test failures, obscuring any real problems. 2014-09-20 15:44:12 -04:00
Kohsuke Kawaguchi 7bd7e4f0b2 Fix up.
- If a write results in a file creation, do the create check, to align with the POSIX semantics.
- Don't make pointless mkdirs check if the directory already exists
- read vs readSymlink difference is dangerous because read() can be called for symlinks in other context as well.
2014-09-18 18:52:05 -07:00
Kohsuke Kawaguchi e4a1ac2ba1 Added a hook to intercept remote file access and reject them if necessary 2014-09-18 18:40:56 -07:00
Kohsuke Kawaguchi 101b4e7fd5 [SECURITY-144] Classify all the core callables one way or the other 2014-09-18 15:07:31 -07:00
Jesse Glick 52c28ae38d NPE diagnosis from ProjectTest.testCheckout.
java.lang.NullPointerException: null
	at hudson.model.AbstractBuild.setWorkspace(AbstractBuild.java:296)
	at hudson.model.ProjectTest.testCheckout(ProjectTest.java:423)
2014-08-29 20:01:13 -04:00
Jesse Glick 06b6cc9cdd Missing @since. 2014-08-15 15:30:43 -04:00
Jesse Glick 4a98beaf64 Using ExtensionList.lookup consistently. 2014-08-04 15:55:22 -04:00
Jesse Glick 7076f0de7e @CheckForNull 2014-07-21 13:08:22 -04:00
Kohsuke Kawaguchi 65bc0fb146 Added a convenience method.
Reference: https://trello.com/c/doFFMdUm/46-filepath-getcomputer
2014-06-28 05:21:24 -07:00