2009-02-07 04:05:24 +08:00
|
|
|
/*
|
|
|
|
* The MIT License
|
|
|
|
*
|
2010-04-29 15:35:22 +08:00
|
|
|
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
|
2010-12-14 05:21:55 +08:00
|
|
|
* Eric Lefevre-Ardant, Erik Ramfelt, Michael B. Donohue, Alan Harder,
|
|
|
|
* Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
|
2009-02-07 04:05:24 +08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2006-11-06 05:16:01 +08:00
|
|
|
package hudson;
|
|
|
|
|
2007-03-27 13:17:23 +08:00
|
|
|
import hudson.Launcher.LocalLauncher;
|
|
|
|
import hudson.Launcher.RemoteLauncher;
|
2012-09-06 21:04:27 +08:00
|
|
|
import hudson.model.AbstractDescribableImpl;
|
2011-05-29 17:53:24 +08:00
|
|
|
import jenkins.model.Jenkins;
|
2007-03-27 13:17:23 +08:00
|
|
|
import hudson.model.TaskListener;
|
2009-03-23 11:26:55 +08:00
|
|
|
import hudson.model.AbstractProject;
|
|
|
|
import hudson.model.Item;
|
2006-12-30 03:15:53 +08:00
|
|
|
import hudson.remoting.Callable;
|
|
|
|
import hudson.remoting.Channel;
|
2007-03-27 13:17:23 +08:00
|
|
|
import hudson.remoting.DelegatingCallable;
|
2007-04-06 22:19:15 +08:00
|
|
|
import hudson.remoting.Future;
|
2006-12-30 03:15:53 +08:00
|
|
|
import hudson.remoting.Pipe;
|
|
|
|
import hudson.remoting.RemoteOutputStream;
|
|
|
|
import hudson.remoting.VirtualChannel;
|
2009-02-10 07:41:29 +08:00
|
|
|
import hudson.remoting.RemoteInputStream;
|
2011-05-11 07:21:10 +08:00
|
|
|
import hudson.remoting.Which;
|
2011-02-16 08:38:50 +08:00
|
|
|
import hudson.security.AccessControlled;
|
2010-01-22 07:25:14 +08:00
|
|
|
import hudson.util.DirScanner;
|
2007-03-27 13:17:23 +08:00
|
|
|
import hudson.util.IOException2;
|
2008-11-06 03:16:45 +08:00
|
|
|
import hudson.util.HeadBufferingStream;
|
2009-03-23 11:26:55 +08:00
|
|
|
import hudson.util.FormValidation;
|
2009-12-01 22:37:57 +08:00
|
|
|
import hudson.util.IOUtils;
|
2012-03-10 10:25:40 +08:00
|
|
|
|
|
|
|
import static hudson.Util.*;
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
import static hudson.util.jna.GNUCLibrary.LIBC;
|
2009-04-11 23:40:38 +08:00
|
|
|
import static hudson.FilePath.TarCompression.GZIP;
|
2009-06-20 07:19:33 +08:00
|
|
|
import hudson.org.apache.tools.tar.TarInputStream;
|
2010-05-15 21:40:29 +08:00
|
|
|
import hudson.util.io.Archiver;
|
|
|
|
import hudson.util.io.ArchiverFactory;
|
2006-12-30 03:15:53 +08:00
|
|
|
import org.apache.tools.ant.BuildException;
|
|
|
|
import org.apache.tools.ant.DirectoryScanner;
|
2007-04-06 22:19:15 +08:00
|
|
|
import org.apache.tools.ant.Project;
|
2006-12-30 03:15:53 +08:00
|
|
|
import org.apache.tools.ant.taskdefs.Copy;
|
|
|
|
import org.apache.tools.ant.types.FileSet;
|
2007-04-06 22:19:15 +08:00
|
|
|
import org.apache.tools.tar.TarEntry;
|
2009-07-15 08:41:37 +08:00
|
|
|
import org.apache.commons.io.input.CountingInputStream;
|
2008-09-21 02:11:44 +08:00
|
|
|
import org.apache.commons.fileupload.FileItem;
|
2009-03-23 11:26:55 +08:00
|
|
|
import org.kohsuke.stapler.Stapler;
|
2007-04-06 22:19:15 +08:00
|
|
|
import java.io.BufferedOutputStream;
|
2006-11-06 05:16:01 +08:00
|
|
|
import java.io.File;
|
2006-12-30 03:15:53 +08:00
|
|
|
import java.io.FileFilter;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.FileWriter;
|
2006-11-06 05:16:01 +08:00
|
|
|
import java.io.IOException;
|
2006-12-30 03:15:53 +08:00
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
import java.io.ObjectOutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.io.Writer;
|
2007-04-29 21:48:37 +08:00
|
|
|
import java.io.OutputStreamWriter;
|
2012-03-10 10:25:40 +08:00
|
|
|
import java.lang.reflect.Field;
|
2007-03-27 13:17:23 +08:00
|
|
|
import java.net.URI;
|
2009-03-15 00:03:15 +08:00
|
|
|
import java.net.URL;
|
2009-04-11 23:40:38 +08:00
|
|
|
import java.net.URLConnection;
|
2006-12-30 03:15:53 +08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2007-04-08 03:54:56 +08:00
|
|
|
import java.util.StringTokenizer;
|
2008-02-05 14:38:12 +08:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Comparator;
|
2011-05-11 07:21:10 +08:00
|
|
|
import java.util.logging.Level;
|
2010-04-29 15:35:22 +08:00
|
|
|
import java.util.regex.Matcher;
|
2008-03-11 13:08:36 +08:00
|
|
|
import java.util.regex.Pattern;
|
2007-04-06 22:19:15 +08:00
|
|
|
import java.util.concurrent.ExecutionException;
|
2007-04-13 04:51:37 +08:00
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeoutException;
|
2007-04-06 22:19:15 +08:00
|
|
|
import java.util.zip.GZIPOutputStream;
|
|
|
|
import java.util.zip.GZIPInputStream;
|
2006-11-06 05:16:01 +08:00
|
|
|
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
import com.sun.jna.Native;
|
2011-09-09 19:56:06 +08:00
|
|
|
import java.util.Enumeration;
|
2010-12-14 05:21:55 +08:00
|
|
|
import java.util.logging.Logger;
|
|
|
|
import org.apache.tools.ant.taskdefs.Chmod;
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
|
2011-09-09 19:56:06 +08:00
|
|
|
import org.apache.tools.zip.ZipFile;
|
|
|
|
import org.apache.tools.zip.ZipEntry;
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
2006-12-30 03:15:53 +08:00
|
|
|
* {@link File} like object with remoting support.
|
2006-11-06 05:16:01 +08:00
|
|
|
*
|
|
|
|
* <p>
|
2006-12-30 03:15:53 +08:00
|
|
|
* Unlike {@link File}, which always implies a file path on the current computer,
|
|
|
|
* {@link FilePath} represents a file path on a specific slave or the master.
|
|
|
|
*
|
|
|
|
* Despite that, {@link FilePath} can be used much like {@link File}. It exposes
|
|
|
|
* a bunch of operations (and we should add more operations as long as they are
|
|
|
|
* generally useful), and when invoked against a file on a remote node, {@link FilePath}
|
|
|
|
* executes the necessary code remotely, thereby providing semi-transparent file
|
|
|
|
* operations.
|
|
|
|
*
|
|
|
|
* <h2>Using {@link FilePath} smartly</h2>
|
|
|
|
* <p>
|
|
|
|
* The transparency makes it easy to write plugins without worrying too much about
|
|
|
|
* remoting, by making it works like NFS, where remoting happens at the file-system
|
2010-01-14 02:13:20 +08:00
|
|
|
* layer.
|
2006-12-30 03:15:53 +08:00
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* But one should note that such use of remoting may not be optional. Sometimes,
|
|
|
|
* it makes more sense to move some computation closer to the data, as opposed to
|
|
|
|
* move the data to the computation. For example, if you are just computing a MD5
|
|
|
|
* digest of a file, then it would make sense to do the digest on the host where
|
|
|
|
* the file is located, as opposed to send the whole data to the master and do MD5
|
|
|
|
* digesting there.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* {@link FilePath} supports this "code migration" by in the
|
|
|
|
* {@link #act(FileCallable)} method. One can pass in a custom implementation
|
|
|
|
* of {@link FileCallable}, to be executed on the node where the data is located.
|
|
|
|
* The following code shows the example:
|
|
|
|
*
|
|
|
|
* <pre>
|
|
|
|
* FilePath file = ...;
|
|
|
|
*
|
|
|
|
* // make 'file' a fresh empty directory.
|
|
|
|
* file.act(new FileCallable<Void>() {
|
|
|
|
* // if 'file' is on a different node, this FileCallable will
|
|
|
|
* // be transfered to that node and executed there.
|
|
|
|
* public Void invoke(File f,VirtualChannel channel) {
|
|
|
|
* // f and file represents the same thing
|
|
|
|
* f.deleteContents();
|
|
|
|
* f.mkdirs();
|
|
|
|
* }
|
|
|
|
* });
|
|
|
|
* </pre>
|
2006-11-06 05:16:01 +08:00
|
|
|
*
|
|
|
|
* <p>
|
2006-12-30 03:15:53 +08:00
|
|
|
* When {@link FileCallable} is transfered to a remote node, it will be done so
|
2008-03-30 21:58:38 +08:00
|
|
|
* by using the same Java serialization scheme that the remoting module uses.
|
2006-12-30 03:15:53 +08:00
|
|
|
* See {@link Channel} for more about this.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* {@link FilePath} itself can be sent over to a remote node as a part of {@link Callable}
|
|
|
|
* serialization. For example, sending a {@link FilePath} of a remote node to that
|
|
|
|
* node causes {@link FilePath} to become "local". Similarly, sending a
|
|
|
|
* {@link FilePath} that represents the local computer causes it to become "remote."
|
2006-11-06 05:16:01 +08:00
|
|
|
*
|
|
|
|
* @author Kohsuke Kawaguchi
|
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public final class FilePath implements Serializable {
|
|
|
|
/**
|
|
|
|
* When this {@link FilePath} represents the remote path,
|
|
|
|
* this field is always non-null on master (the field represents
|
|
|
|
* the channel to the remote slave.) When transferred to a slave via remoting,
|
|
|
|
* this field reverts back to null, since it's transient.
|
|
|
|
*
|
|
|
|
* When this {@link FilePath} represents a path on the master,
|
|
|
|
* this field is null on master. When transferred to a slave via remoting,
|
|
|
|
* this field becomes non-null, representing the {@link Channel}
|
|
|
|
* back to the master.
|
|
|
|
*
|
|
|
|
* This is used to determine whether we are running on the master or the slave.
|
|
|
|
*/
|
|
|
|
private transient VirtualChannel channel;
|
|
|
|
|
|
|
|
// since the platform of the slave might be different, can't use java.io.File
|
2006-11-06 05:16:01 +08:00
|
|
|
private final String remote;
|
|
|
|
|
2007-11-14 09:22:24 +08:00
|
|
|
/**
|
|
|
|
* Creates a {@link FilePath} that represents a path on the given node.
|
|
|
|
*
|
|
|
|
* @param channel
|
|
|
|
* To create a path that represents a remote path, pass in a {@link Channel}
|
|
|
|
* that's connected to that machine. If null, that means the local file path.
|
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public FilePath(VirtualChannel channel, String remote) {
|
|
|
|
this.channel = channel;
|
2010-02-26 08:30:15 +08:00
|
|
|
this.remote = normalize(remote);
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-14 09:22:24 +08:00
|
|
|
* To create {@link FilePath} that represents a "local" path.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* A "local" path means a file path on the computer where the
|
|
|
|
* constructor invocation happened.
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public FilePath(File localPath) {
|
|
|
|
this.channel = null;
|
2010-02-26 08:30:15 +08:00
|
|
|
this.remote = normalize(localPath.getPath());
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
/**
|
|
|
|
* Construct a path starting with a base location.
|
|
|
|
* @param base starting point for resolution, and defines channel
|
|
|
|
* @param rel a path which if relative will be resolved against base
|
|
|
|
*/
|
2006-11-06 05:16:01 +08:00
|
|
|
public FilePath(FilePath base, String rel) {
|
2006-12-30 03:15:53 +08:00
|
|
|
this.channel = base.channel;
|
2012-05-01 17:42:24 +08:00
|
|
|
this.remote = normalize(resolvePathIfRelative(base, rel));
|
|
|
|
}
|
|
|
|
|
|
|
|
private String resolvePathIfRelative(FilePath base, String rel) {
|
|
|
|
if(isAbsolute(rel)) return rel;
|
2006-11-06 05:16:01 +08:00
|
|
|
if(base.isUnix()) {
|
2012-05-01 16:21:39 +08:00
|
|
|
// shouldn't need this replace, but better safe than sorry
|
2012-05-01 17:42:24 +08:00
|
|
|
return base.remote+'/'+rel.replace('\\','/');
|
2006-11-06 05:16:01 +08:00
|
|
|
} else {
|
2012-05-01 16:21:39 +08:00
|
|
|
// need this replace, see Slave.getWorkspaceFor and AbstractItem.getFullName, nested jobs on Windows
|
|
|
|
// slaves will always have a rel containing at least one '/' character. JENKINS-13649
|
2012-05-01 17:42:24 +08:00
|
|
|
return base.remote+'\\'+rel.replace('/','\\');
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-23 02:40:03 +08:00
|
|
|
/**
|
|
|
|
* Is the given path name an absolute path?
|
|
|
|
*/
|
2008-07-24 10:00:38 +08:00
|
|
|
private static boolean isAbsolute(String rel) {
|
|
|
|
return rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches();
|
|
|
|
}
|
|
|
|
|
2010-04-29 15:35:22 +08:00
|
|
|
private static final Pattern DRIVE_PATTERN = Pattern.compile("[A-Za-z]:[\\\\/].*"),
|
|
|
|
ABSOLUTE_PREFIX_PATTERN = Pattern.compile("^(\\\\\\\\|(?:[A-Za-z]:)?[\\\\/])[\\\\/]*");
|
2008-03-11 13:08:36 +08:00
|
|
|
|
2010-02-26 08:30:15 +08:00
|
|
|
/**
|
|
|
|
* {@link File#getParent()} etc cannot handle ".." and "." in the path component very well,
|
|
|
|
* so remove them.
|
|
|
|
*/
|
|
|
|
private static String normalize(String path) {
|
2010-04-29 15:35:22 +08:00
|
|
|
StringBuilder buf = new StringBuilder();
|
|
|
|
// Check for prefix designating absolute path
|
|
|
|
Matcher m = ABSOLUTE_PREFIX_PATTERN.matcher(path);
|
|
|
|
if (m.find()) {
|
|
|
|
buf.append(m.group(1));
|
|
|
|
path = path.substring(m.end());
|
|
|
|
}
|
|
|
|
boolean isAbsolute = buf.length() > 0;
|
|
|
|
// Split remaining path into tokens, trimming any duplicate or trailing separators
|
2010-02-26 08:30:15 +08:00
|
|
|
List<String> tokens = new ArrayList<String>();
|
2010-04-29 15:35:22 +08:00
|
|
|
int s = 0, end = path.length();
|
|
|
|
for (int i = 0; i < end; i++) {
|
|
|
|
char c = path.charAt(i);
|
|
|
|
if (c == '/' || c == '\\') {
|
|
|
|
tokens.add(path.substring(s, i));
|
|
|
|
s = i;
|
|
|
|
// Skip any extra separator chars
|
|
|
|
while (++i < end && ((c = path.charAt(i)) == '/' || c == '\\')) { }
|
|
|
|
// Add token for separator unless we reached the end
|
|
|
|
if (i < end) tokens.add(path.substring(s, s+1));
|
|
|
|
s = i;
|
2010-02-26 08:30:15 +08:00
|
|
|
}
|
|
|
|
}
|
2010-04-29 15:35:22 +08:00
|
|
|
if (s < end) tokens.add(path.substring(s));
|
|
|
|
// Look through tokens for "." or ".."
|
|
|
|
for (int i = 0; i < tokens.size();) {
|
2010-02-26 08:30:15 +08:00
|
|
|
String token = tokens.get(i);
|
|
|
|
if (token.equals(".")) {
|
|
|
|
tokens.remove(i);
|
2010-04-29 15:35:22 +08:00
|
|
|
if (tokens.size() > 0)
|
|
|
|
tokens.remove(i > 0 ? i - 1 : i);
|
|
|
|
} else if (token.equals("..")) {
|
|
|
|
if (i == 0) {
|
|
|
|
// If absolute path, just remove: /../something
|
|
|
|
// If relative path, not collapsible so leave as-is
|
|
|
|
tokens.remove(0);
|
|
|
|
if (tokens.size() > 0) token += tokens.remove(0);
|
|
|
|
if (!isAbsolute) buf.append(token);
|
|
|
|
} else {
|
|
|
|
// Normalize: remove something/.. plus separator before/after
|
|
|
|
i -= 2;
|
2010-05-01 05:57:24 +08:00
|
|
|
for (int j = 0; j < 3; j++) tokens.remove(i);
|
2010-04-29 15:35:22 +08:00
|
|
|
if (i > 0) tokens.remove(i-1);
|
|
|
|
else if (tokens.size() > 0) tokens.remove(0);
|
|
|
|
}
|
2010-02-26 08:30:15 +08:00
|
|
|
} else
|
2010-04-29 15:35:22 +08:00
|
|
|
i += 2;
|
2010-02-26 08:30:15 +08:00
|
|
|
}
|
2010-04-29 15:35:22 +08:00
|
|
|
// Recombine tokens
|
|
|
|
for (String token : tokens) buf.append(token);
|
|
|
|
if (buf.length() == 0) buf.append('.');
|
|
|
|
return buf.toString();
|
2010-02-26 08:30:15 +08:00
|
|
|
}
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
|
|
|
* Checks if the remote path is Unix.
|
|
|
|
*/
|
2011-11-24 03:28:51 +08:00
|
|
|
boolean isUnix() {
|
2008-02-04 09:36:52 +08:00
|
|
|
// if the path represents a local path, there' no need to guess.
|
|
|
|
if(!isRemote())
|
|
|
|
return File.pathSeparatorChar!=';';
|
|
|
|
|
2008-02-04 09:34:46 +08:00
|
|
|
// note that we can't use the usual File.pathSeparator and etc., as the OS of
|
|
|
|
// the machine where this code runs and the OS that this FilePath refers to may be different.
|
|
|
|
|
|
|
|
// Windows absolute path is 'X:\...', so this is usually a good indication of Windows path
|
|
|
|
if(remote.length()>3 && remote.charAt(1)==':' && remote.charAt(2)=='\\')
|
|
|
|
return false;
|
2006-11-06 05:16:01 +08:00
|
|
|
// Windows can handle '/' as a path separator but Unix can't,
|
|
|
|
// so err on Unix side
|
|
|
|
return remote.indexOf("\\")==-1;
|
|
|
|
}
|
|
|
|
|
2012-01-19 09:31:01 +08:00
|
|
|
/**
|
|
|
|
* Gets the full path of the file on the remote machine.
|
|
|
|
*
|
|
|
|
*/
|
2006-11-06 05:16:01 +08:00
|
|
|
public String getRemote() {
|
|
|
|
return remote;
|
|
|
|
}
|
|
|
|
|
2007-03-09 14:57:24 +08:00
|
|
|
/**
|
|
|
|
* Creates a zip file from this directory or a file and sends that to the given output stream.
|
2009-07-03 02:20:13 +08:00
|
|
|
*
|
|
|
|
* @deprecated as of 1.315. Use {@link #zip(OutputStream)} that has more consistent name.
|
2007-03-09 14:57:24 +08:00
|
|
|
*/
|
|
|
|
public void createZipArchive(OutputStream os) throws IOException, InterruptedException {
|
2009-07-03 02:20:13 +08:00
|
|
|
zip(os);
|
|
|
|
}
|
2009-07-01 07:44:08 +08:00
|
|
|
|
2009-07-03 02:20:13 +08:00
|
|
|
/**
|
|
|
|
* Creates a zip file from this directory or a file and sends that to the given output stream.
|
|
|
|
*/
|
|
|
|
public void zip(OutputStream os) throws IOException, InterruptedException {
|
|
|
|
zip(os,(FileFilter)null);
|
|
|
|
}
|
2007-03-09 14:57:24 +08:00
|
|
|
|
2012-03-10 10:25:40 +08:00
|
|
|
public void zip(FilePath dst) throws IOException, InterruptedException {
|
|
|
|
OutputStream os = dst.write();
|
|
|
|
try {
|
|
|
|
zip(os);
|
|
|
|
} finally {
|
|
|
|
os.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-03 02:20:13 +08:00
|
|
|
/**
|
|
|
|
* Creates a zip file from this directory by using the specified filter,
|
|
|
|
* and sends the result to the given output stream.
|
|
|
|
*
|
|
|
|
* @param filter
|
|
|
|
* Must be serializable since it may be executed remotely. Can be null to add all files.
|
|
|
|
*
|
|
|
|
* @since 1.315
|
|
|
|
*/
|
|
|
|
public void zip(OutputStream os, FileFilter filter) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
archive(ArchiverFactory.ZIP,os,filter);
|
2007-03-09 14:57:24 +08:00
|
|
|
}
|
|
|
|
|
2007-08-13 13:12:50 +08:00
|
|
|
/**
|
|
|
|
* Creates a zip file from this directory by only including the files that match the given glob.
|
|
|
|
*
|
|
|
|
* @param glob
|
|
|
|
* Ant style glob, like "**/*.xml". If empty or null, this method
|
|
|
|
* works like {@link #createZipArchive(OutputStream)}
|
|
|
|
*
|
|
|
|
* @since 1.129
|
2009-07-03 02:20:13 +08:00
|
|
|
* @deprecated as of 1.315
|
|
|
|
* Use {@link #zip(OutputStream,String)} that has more consistent name.
|
2007-08-13 13:12:50 +08:00
|
|
|
*/
|
|
|
|
public void createZipArchive(OutputStream os, final String glob) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
archive(ArchiverFactory.ZIP,os,glob);
|
2009-07-03 02:20:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a zip file from this directory by only including the files that match the given glob.
|
|
|
|
*
|
|
|
|
* @param glob
|
|
|
|
* Ant style glob, like "**/*.xml". If empty or null, this method
|
|
|
|
* works like {@link #createZipArchive(OutputStream)}
|
|
|
|
*
|
|
|
|
* @since 1.315
|
|
|
|
*/
|
|
|
|
public void zip(OutputStream os, final String glob) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
archive(ArchiverFactory.ZIP,os,glob);
|
2009-07-03 02:20:13 +08:00
|
|
|
}
|
|
|
|
|
2010-01-22 07:25:14 +08:00
|
|
|
/**
|
|
|
|
* Uses the given scanner on 'this' directory to list up files and then archive it to a zip stream.
|
|
|
|
*/
|
|
|
|
public int zip(OutputStream out, DirScanner scanner) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
return archive(ArchiverFactory.ZIP, out, scanner);
|
2010-01-22 07:25:14 +08:00
|
|
|
}
|
|
|
|
|
2009-07-03 02:20:13 +08:00
|
|
|
/**
|
|
|
|
* Archives this directory into the specified archive format, to the given {@link OutputStream}, by using
|
|
|
|
* {@link DirScanner} to choose what files to include.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* number of files/directories archived. This is only really useful to check for a situation where nothing
|
|
|
|
* is archived.
|
|
|
|
*/
|
2010-01-22 07:25:14 +08:00
|
|
|
public int archive(final ArchiverFactory factory, OutputStream os, final DirScanner scanner) throws IOException, InterruptedException {
|
2007-08-13 13:12:50 +08:00
|
|
|
final OutputStream out = (channel!=null)?new RemoteOutputStream(os):os;
|
2009-07-03 02:20:13 +08:00
|
|
|
return act(new FileCallable<Integer>() {
|
|
|
|
public Integer invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
Archiver a = factory.create(out);
|
|
|
|
try {
|
|
|
|
scanner.scan(f,a);
|
|
|
|
} finally {
|
|
|
|
a.close();
|
2007-08-13 13:12:50 +08:00
|
|
|
}
|
2009-07-03 02:20:13 +08:00
|
|
|
return a.countEntries();
|
2007-08-13 13:12:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-03-10 10:30:24 +08:00
|
|
|
public int archive(final ArchiverFactory factory, OutputStream os, final FileFilter filter) throws IOException, InterruptedException {
|
2009-07-03 02:20:13 +08:00
|
|
|
return archive(factory,os,new DirScanner.Filter(filter));
|
|
|
|
}
|
|
|
|
|
2012-03-10 10:30:24 +08:00
|
|
|
public int archive(final ArchiverFactory factory, OutputStream os, final String glob) throws IOException, InterruptedException {
|
2009-07-03 02:20:13 +08:00
|
|
|
return archive(factory,os,new DirScanner.Glob(glob,null));
|
|
|
|
}
|
|
|
|
|
2008-08-14 05:48:40 +08:00
|
|
|
/**
|
|
|
|
* When this {@link FilePath} represents a zip file, extracts that zip file.
|
|
|
|
*
|
|
|
|
* @param target
|
|
|
|
* Target directory to expand files to. All the necessary directories will be created.
|
|
|
|
* @since 1.248
|
2009-03-11 15:02:11 +08:00
|
|
|
* @see #unzipFrom(InputStream)
|
2008-08-14 05:48:40 +08:00
|
|
|
*/
|
2009-02-10 07:41:29 +08:00
|
|
|
public void unzip(final FilePath target) throws IOException, InterruptedException {
|
2008-08-14 05:48:40 +08:00
|
|
|
target.act(new FileCallable<Void>() {
|
2011-09-09 19:56:06 +08:00
|
|
|
|
2008-08-14 05:48:40 +08:00
|
|
|
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
2011-09-09 19:56:06 +08:00
|
|
|
if (FilePath.this.isRemote())
|
|
|
|
unzip(dir, FilePath.this.read()); // use streams
|
|
|
|
else
|
|
|
|
unzip(dir, new File(FilePath.this.getRemote())); // shortcut to local file
|
2008-08-14 05:48:40 +08:00
|
|
|
return null;
|
|
|
|
}
|
2009-02-10 07:41:29 +08:00
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
});
|
|
|
|
}
|
2008-08-14 05:48:40 +08:00
|
|
|
|
2009-03-11 15:02:11 +08:00
|
|
|
/**
|
|
|
|
* When this {@link FilePath} represents a tar file, extracts that tar file.
|
|
|
|
*
|
|
|
|
* @param target
|
|
|
|
* Target directory to expand files to. All the necessary directories will be created.
|
|
|
|
* @param compression
|
|
|
|
* Compression mode of this tar file.
|
|
|
|
* @since 1.292
|
|
|
|
* @see #untarFrom(InputStream, TarCompression)
|
|
|
|
*/
|
|
|
|
public void untar(final FilePath target, final TarCompression compression) throws IOException, InterruptedException {
|
|
|
|
target.act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
|
|
|
readFromTar(FilePath.this.getName(),dir,compression.extract(FilePath.this.read()));
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-02-10 07:41:29 +08:00
|
|
|
/**
|
|
|
|
* Reads the given InputStream as a zip file and extracts it into this directory.
|
|
|
|
*
|
|
|
|
* @param _in
|
|
|
|
* The stream will be closed by this method after it's fully read.
|
|
|
|
* @since 1.283
|
2009-03-11 15:02:11 +08:00
|
|
|
* @see #unzip(FilePath)
|
2009-02-10 07:41:29 +08:00
|
|
|
*/
|
|
|
|
public void unzipFrom(InputStream _in) throws IOException, InterruptedException {
|
|
|
|
final InputStream in = new RemoteInputStream(_in);
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
|
|
|
unzip(dir, in);
|
|
|
|
return null;
|
|
|
|
}
|
2008-08-14 05:48:40 +08:00
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-02-10 07:41:29 +08:00
|
|
|
private void unzip(File dir, InputStream in) throws IOException {
|
2011-09-09 19:56:06 +08:00
|
|
|
File tmpFile = File.createTempFile("tmpzip", null); // uses java.io.tmpdir
|
|
|
|
try {
|
|
|
|
IOUtils.copy(in, tmpFile);
|
|
|
|
unzip(dir,tmpFile);
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
tmpFile.delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void unzip(File dir, File zipFile) throws IOException {
|
2009-02-10 07:41:29 +08:00
|
|
|
dir = dir.getAbsoluteFile(); // without absolutization, getParentFile below seems to fail
|
2011-09-09 19:56:06 +08:00
|
|
|
ZipFile zip = new ZipFile(zipFile);
|
2011-12-30 23:50:45 +08:00
|
|
|
@SuppressWarnings("unchecked")
|
2011-09-09 19:56:06 +08:00
|
|
|
Enumeration<ZipEntry> entries = zip.getEntries();
|
2009-02-10 07:41:29 +08:00
|
|
|
|
|
|
|
try {
|
2011-09-09 19:56:06 +08:00
|
|
|
while (entries.hasMoreElements()) {
|
|
|
|
ZipEntry e = entries.nextElement();
|
|
|
|
File f = new File(dir, e.getName());
|
|
|
|
if (e.isDirectory()) {
|
2009-02-10 07:41:29 +08:00
|
|
|
f.mkdirs();
|
|
|
|
} else {
|
|
|
|
File p = f.getParentFile();
|
2011-09-09 19:56:06 +08:00
|
|
|
if (p != null) {
|
|
|
|
p.mkdirs();
|
|
|
|
}
|
|
|
|
IOUtils.copy(zip.getInputStream(e), f);
|
|
|
|
try {
|
|
|
|
FilePath target = new FilePath(f);
|
2011-09-23 12:02:11 +08:00
|
|
|
int mode = e.getUnixMode();
|
|
|
|
if (mode!=0) // Ant returns 0 if the archive doesn't record the access mode
|
|
|
|
target.chmod(mode);
|
2011-09-09 19:56:06 +08:00
|
|
|
} catch (InterruptedException ex) {
|
|
|
|
LOGGER.log(Level.WARNING, "unable to set permissions", ex);
|
|
|
|
}
|
2011-09-28 08:09:14 +08:00
|
|
|
f.setLastModified(e.getTime());
|
2009-02-10 07:41:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
zip.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
/**
|
|
|
|
* Absolutizes this {@link FilePath} and returns the new one.
|
|
|
|
*/
|
|
|
|
public FilePath absolutize() throws IOException, InterruptedException {
|
|
|
|
return new FilePath(channel,act(new FileCallable<String>() {
|
|
|
|
public String invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return f.getAbsolutePath();
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2012-03-10 10:25:40 +08:00
|
|
|
/**
|
|
|
|
* Creates a symlink to the specified target.
|
|
|
|
*
|
|
|
|
* @param target
|
|
|
|
* The file that the symlink should point to.
|
|
|
|
* @param listener
|
|
|
|
* If symlink creation requires a help of an external process, the error will be reported here.
|
|
|
|
* @since 1.456
|
|
|
|
*/
|
|
|
|
public void symlinkTo(final String target, final TaskListener listener) throws IOException, InterruptedException {
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
|
|
|
Util.createSymlink(f.getParentFile(),target,f.getName(),listener);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolves symlink, if the given file is a symlink. Otherwise return null.
|
|
|
|
* <p>
|
|
|
|
* If the resolution fails, report an error.
|
|
|
|
*
|
|
|
|
* @since 1.456
|
|
|
|
*/
|
|
|
|
public String readLink() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<String>() {
|
|
|
|
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
|
|
|
return Util.resolveSymlink(f);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-07-15 05:33:15 +08:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
if (this == o) return true;
|
|
|
|
if (o == null || getClass() != o.getClass()) return false;
|
|
|
|
|
|
|
|
FilePath that = (FilePath) o;
|
|
|
|
|
|
|
|
if (channel != null ? !channel.equals(that.channel) : that.channel != null) return false;
|
|
|
|
return remote.equals(that.remote);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
return 31 * (channel != null ? channel.hashCode() : 0) + remote.hashCode();
|
|
|
|
}
|
|
|
|
|
2009-03-11 15:02:11 +08:00
|
|
|
/**
|
|
|
|
* Supported tar file compression methods.
|
|
|
|
*/
|
|
|
|
public enum TarCompression {
|
|
|
|
NONE {
|
|
|
|
public InputStream extract(InputStream in) {
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
public OutputStream compress(OutputStream out) {
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
GZIP {
|
|
|
|
public InputStream extract(InputStream _in) throws IOException {
|
|
|
|
HeadBufferingStream in = new HeadBufferingStream(_in,SIDE_BUFFER_SIZE);
|
|
|
|
try {
|
2009-04-25 01:58:02 +08:00
|
|
|
return new GZIPInputStream(in,8192);
|
2009-03-11 15:02:11 +08:00
|
|
|
} catch (IOException e) {
|
|
|
|
// various people reported "java.io.IOException: Not in GZIP format" here, so diagnose this problem better
|
|
|
|
in.fillSide();
|
|
|
|
throw new IOException2(e.getMessage()+"\nstream="+Util.toHexString(in.getSideBuffer()),e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public OutputStream compress(OutputStream out) throws IOException {
|
2009-04-25 01:58:02 +08:00
|
|
|
return new GZIPOutputStream(new BufferedOutputStream(out));
|
2009-03-11 15:02:11 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
public abstract InputStream extract(InputStream in) throws IOException;
|
|
|
|
public abstract OutputStream compress(OutputStream in) throws IOException;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the given InputStream as a tar file and extracts it into this directory.
|
|
|
|
*
|
|
|
|
* @param _in
|
|
|
|
* The stream will be closed by this method after it's fully read.
|
|
|
|
* @param compression
|
|
|
|
* The compression method in use.
|
|
|
|
* @since 1.292
|
|
|
|
*/
|
|
|
|
public void untarFrom(InputStream _in, final TarCompression compression) throws IOException, InterruptedException {
|
|
|
|
try {
|
|
|
|
final InputStream in = new RemoteInputStream(_in);
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File dir, VirtualChannel channel) throws IOException {
|
2009-04-25 01:58:02 +08:00
|
|
|
readFromTar("input stream",dir, compression.extract(in));
|
2009-03-11 15:02:11 +08:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
});
|
|
|
|
} finally {
|
|
|
|
IOUtils.closeQuietly(_in);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-11 23:40:38 +08:00
|
|
|
/**
|
2009-04-12 05:17:15 +08:00
|
|
|
* Given a tgz/zip file, extracts it to the given target directory, if necessary.
|
2009-04-11 23:40:38 +08:00
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* This method is a convenience method designed for installing a binary package to a location
|
|
|
|
* that supports upgrade and downgrade. Specifically,
|
|
|
|
*
|
|
|
|
* <ul>
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
* <li>If the target directory doesn't exist {@linkplain #mkdirs() it'll be created}.
|
2009-04-11 23:40:38 +08:00
|
|
|
* <li>The timestamp of the .tgz file is left in the installation directory upon extraction.
|
2009-04-12 05:17:15 +08:00
|
|
|
* <li>If the timestamp left in the directory doesn't match with the timestamp of the current archive file,
|
|
|
|
* the directory contents will be discarded and the archive file will be re-extracted.
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
* <li>If the connection is refused but the target directory already exists, it is left alone.
|
2009-04-11 23:40:38 +08:00
|
|
|
* </ul>
|
|
|
|
*
|
2009-04-12 05:17:15 +08:00
|
|
|
* @param archive
|
|
|
|
* The resource that represents the tgz/zip file. This URL must support the "Last-Modified" header.
|
2009-04-11 23:40:38 +08:00
|
|
|
* (Most common usage is to get this from {@link ClassLoader#getResource(String)})
|
|
|
|
* @param listener
|
|
|
|
* If non-null, a message will be printed to this listener once this method decides to
|
|
|
|
* extract an archive.
|
|
|
|
* @return
|
|
|
|
* true if the archive was extracted. false if the extraction was skipped because the target directory
|
|
|
|
* was considered up to date.
|
|
|
|
* @since 1.299
|
|
|
|
*/
|
2009-04-12 05:17:15 +08:00
|
|
|
public boolean installIfNecessaryFrom(URL archive, TaskListener listener, String message) throws IOException, InterruptedException {
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
try {
|
2010-01-14 23:23:49 +08:00
|
|
|
URLConnection con;
|
|
|
|
try {
|
2010-01-14 23:36:13 +08:00
|
|
|
con = ProxyConfiguration.open(archive);
|
2010-01-14 23:23:49 +08:00
|
|
|
con.connect();
|
|
|
|
} catch (IOException x) {
|
|
|
|
if (this.exists()) {
|
|
|
|
// Cannot connect now, so assume whatever was last unpacked is still OK.
|
|
|
|
if (listener != null) {
|
|
|
|
listener.getLogger().println("Skipping installation of " + archive + " to " + remote + ": " + x);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
throw x;
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
}
|
|
|
|
}
|
2010-01-14 23:23:49 +08:00
|
|
|
long sourceTimestamp = con.getLastModified();
|
|
|
|
FilePath timestamp = this.child(".timestamp");
|
2009-04-11 23:40:38 +08:00
|
|
|
|
2010-01-14 23:23:49 +08:00
|
|
|
if(this.exists()) {
|
|
|
|
if(timestamp.exists() && sourceTimestamp ==timestamp.lastModified())
|
|
|
|
return false; // already up to date
|
|
|
|
this.deleteContents();
|
|
|
|
} else {
|
|
|
|
this.mkdirs();
|
|
|
|
}
|
2009-07-15 08:41:37 +08:00
|
|
|
|
2010-01-14 23:23:49 +08:00
|
|
|
if(listener!=null)
|
|
|
|
listener.getLogger().println(message);
|
|
|
|
|
|
|
|
// for HTTP downloads, enable automatic retry for added resilience
|
2011-09-19 07:16:08 +08:00
|
|
|
InputStream in = archive.getProtocol().startsWith("http") ? ProxyConfiguration.getInputStream(archive) : con.getInputStream();
|
2010-01-14 23:23:49 +08:00
|
|
|
CountingInputStream cis = new CountingInputStream(in);
|
|
|
|
try {
|
|
|
|
if(archive.toExternalForm().endsWith(".zip"))
|
|
|
|
unzipFrom(cis);
|
|
|
|
else
|
|
|
|
untarFrom(cis,GZIP);
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw new IOException2(String.format("Failed to unpack %s (%d bytes read of total %d)",
|
|
|
|
archive,cis.getByteCount(),con.getContentLength()),e);
|
|
|
|
}
|
|
|
|
timestamp.touch(sourceTimestamp);
|
|
|
|
return true;
|
2009-07-15 08:41:37 +08:00
|
|
|
} catch (IOException e) {
|
2010-01-14 23:23:49 +08:00
|
|
|
throw new IOException2("Failed to install "+archive+" to "+remote,e);
|
2009-07-15 08:41:37 +08:00
|
|
|
}
|
2009-04-11 23:40:38 +08:00
|
|
|
}
|
|
|
|
|
2009-03-15 00:03:15 +08:00
|
|
|
/**
|
|
|
|
* Reads the URL on the current VM, and writes all the data to this {@link FilePath}
|
|
|
|
* (this is different from resolving URL remotely.)
|
|
|
|
*
|
|
|
|
* @since 1.293
|
|
|
|
*/
|
|
|
|
public void copyFrom(URL url) throws IOException, InterruptedException {
|
|
|
|
InputStream in = url.openStream();
|
|
|
|
try {
|
|
|
|
copyFrom(in);
|
|
|
|
} finally {
|
|
|
|
in.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Replaces the content of this file by the data from the given {@link InputStream}.
|
|
|
|
*
|
|
|
|
* @since 1.293
|
|
|
|
*/
|
|
|
|
public void copyFrom(InputStream in) throws IOException, InterruptedException {
|
|
|
|
OutputStream os = write();
|
|
|
|
try {
|
|
|
|
IOUtils.copy(in, os);
|
|
|
|
} finally {
|
|
|
|
os.close();
|
|
|
|
}
|
|
|
|
}
|
2009-06-14 23:21:24 +08:00
|
|
|
|
|
|
|
/**
|
2011-12-30 23:50:45 +08:00
|
|
|
* Convenience method to call {@link FilePath#copyTo(FilePath)}.
|
2009-06-14 23:21:24 +08:00
|
|
|
*
|
|
|
|
* @since 1.311
|
|
|
|
*/
|
|
|
|
public void copyFrom(FilePath src) throws IOException, InterruptedException {
|
|
|
|
src.copyTo(this);
|
|
|
|
}
|
2009-03-15 00:03:15 +08:00
|
|
|
|
2008-09-21 02:11:44 +08:00
|
|
|
/**
|
|
|
|
* Place the data from {@link FileItem} into the file location specified by this {@link FilePath} object.
|
|
|
|
*/
|
|
|
|
public void copyFrom(FileItem file) throws IOException, InterruptedException {
|
|
|
|
if(channel==null) {
|
|
|
|
try {
|
|
|
|
file.write(new File(remote));
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw e;
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new IOException2(e);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
InputStream i = file.getInputStream();
|
|
|
|
OutputStream o = write();
|
|
|
|
try {
|
|
|
|
IOUtils.copy(i,o);
|
|
|
|
} finally {
|
2012-05-01 17:42:24 +08:00
|
|
|
try {
|
|
|
|
o.close();
|
|
|
|
} finally {
|
|
|
|
i.close();
|
|
|
|
}
|
2008-09-21 02:11:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Code that gets executed on the machine where the {@link FilePath} is local.
|
|
|
|
* Used to act on {@link FilePath}.
|
|
|
|
*
|
|
|
|
* @see FilePath#act(FileCallable)
|
|
|
|
*/
|
2011-11-07 01:01:18 +08:00
|
|
|
public interface FileCallable<T> extends Serializable {
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Performs the computational task on the node where the data is located.
|
|
|
|
*
|
2010-01-27 10:31:39 +08:00
|
|
|
* <p>
|
|
|
|
* All the exceptions are forwarded to the caller.
|
|
|
|
*
|
2006-12-30 03:15:53 +08:00
|
|
|
* @param f
|
|
|
|
* {@link File} that represents the local file that {@link FilePath} has represented.
|
|
|
|
* @param channel
|
|
|
|
* The "back pointer" of the {@link Channel} that represents the communication
|
|
|
|
* with the node from where the code was sent.
|
|
|
|
*/
|
2010-01-27 10:31:39 +08:00
|
|
|
T invoke(File f, VirtualChannel channel) throws IOException, InterruptedException;
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Executes some program on the machine that this {@link FilePath} exists,
|
|
|
|
* so that one can perform local file operations.
|
|
|
|
*/
|
|
|
|
public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
|
2009-06-09 09:19:04 +08:00
|
|
|
return act(callable,callable.getClass().getClassLoader());
|
|
|
|
}
|
|
|
|
|
|
|
|
private <T> T act(final FileCallable<T> callable, ClassLoader cl) throws IOException, InterruptedException {
|
2006-12-30 03:15:53 +08:00
|
|
|
if(channel!=null) {
|
|
|
|
// run this on a remote system
|
|
|
|
try {
|
2012-09-06 21:04:27 +08:00
|
|
|
DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<T>(callable, cl);
|
2012-09-06 21:46:43 +08:00
|
|
|
ExtensionList<FileCallableWrapperFactory> factories = Jenkins.getInstance().getExtensionList(FileCallableWrapperFactory.class);
|
|
|
|
for (FileCallableWrapperFactory factory : factories) {
|
2012-09-06 21:04:27 +08:00
|
|
|
wrapper = factory.wrap(wrapper);
|
|
|
|
}
|
|
|
|
|
|
|
|
return channel.call(wrapper);
|
2010-01-27 10:31:39 +08:00
|
|
|
} catch (TunneledInterruptedException e) {
|
|
|
|
throw (InterruptedException)new InterruptedException().initCause(e);
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
} catch (AbortException e) {
|
|
|
|
throw e; // pass through so that the caller can catch it as AbortException
|
2006-12-30 03:15:53 +08:00
|
|
|
} catch (IOException e) {
|
|
|
|
// wrap it into a new IOException so that we get the caller's stack trace as well.
|
2009-12-24 10:43:02 +08:00
|
|
|
throw new IOException2("remote file operation failed: "+remote+" at "+channel,e);
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// the file is on the local machine.
|
2011-05-29 01:11:48 +08:00
|
|
|
return callable.invoke(new File(remote), Jenkins.MasterComputer.localChannel);
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-06 21:46:43 +08:00
|
|
|
/**
|
|
|
|
* This extension point allows to contribute a wrapper around a fileCallable so that a plugin can "intercept" a
|
2012-09-06 22:21:14 +08:00
|
|
|
* call.
|
|
|
|
* <p>The {@link #wrap(hudson.remoting.DelegatingCallable)} method itself will be executed on master
|
|
|
|
* (and may collect contextual data if needed) and the returned wrapper will be executed on remote.
|
2012-09-06 21:46:43 +08:00
|
|
|
*/
|
|
|
|
public static abstract class FileCallableWrapperFactory extends AbstractDescribableImpl<FileCallableWrapperFactory> implements ExtensionPoint {
|
2012-09-06 21:04:27 +08:00
|
|
|
|
|
|
|
public abstract <T> DelegatingCallable<T,IOException> wrap(DelegatingCallable<T,IOException> callable);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-09-06 21:46:43 +08:00
|
|
|
/**
|
|
|
|
* Abstract {@link DelegatingCallable} that exposes an Before/After pattern for
|
|
|
|
* {@link hudson.FilePath.FileCallableWrapperFactory} that want to implement AOP-style interceptors
|
|
|
|
*/
|
|
|
|
public abstract class AbstractInterceptorCallableWrapper<T> implements DelegatingCallable<T, IOException> {
|
|
|
|
|
2012-09-06 22:27:11 +08:00
|
|
|
private final DelegatingCallable<T, IOException> callable;
|
2012-09-06 21:46:43 +08:00
|
|
|
|
|
|
|
public AbstractInterceptorCallableWrapper(DelegatingCallable<T, IOException> callable) {
|
|
|
|
this.callable = callable;
|
|
|
|
}
|
|
|
|
|
2012-09-06 22:27:11 +08:00
|
|
|
@Override
|
|
|
|
public final ClassLoader getClassLoader() {
|
2012-09-06 21:46:43 +08:00
|
|
|
return callable.getClassLoader();
|
|
|
|
}
|
|
|
|
|
2012-09-06 22:21:14 +08:00
|
|
|
public final T call() throws IOException {
|
2012-09-06 21:46:43 +08:00
|
|
|
before();
|
|
|
|
try {
|
|
|
|
return callable.call();
|
|
|
|
} finally {
|
|
|
|
after();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-06 22:21:14 +08:00
|
|
|
/**
|
|
|
|
* Executed before the actual FileCallable is invoked. This code will run on remote
|
|
|
|
*/
|
2012-09-06 21:46:43 +08:00
|
|
|
protected void before() {}
|
2012-09-06 22:21:14 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Executed after the actual FileCallable is invoked (whenever this one failed). This code will run on remote
|
|
|
|
*/
|
2012-09-06 21:46:43 +08:00
|
|
|
protected void after() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-06 22:19:15 +08:00
|
|
|
/**
|
|
|
|
* Executes some program on the machine that this {@link FilePath} exists,
|
|
|
|
* so that one can perform local file operations.
|
|
|
|
*/
|
|
|
|
public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException {
|
|
|
|
try {
|
2011-05-29 01:11:48 +08:00
|
|
|
return (channel!=null ? channel : Jenkins.MasterComputer.localChannel)
|
2007-04-06 22:19:15 +08:00
|
|
|
.callAsync(new FileCallableWrapper<T>(callable));
|
|
|
|
} catch (IOException e) {
|
|
|
|
// wrap it into a new IOException so that we get the caller's stack trace as well.
|
|
|
|
throw new IOException2("remote file operation failed",e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Executes some program on the machine that this {@link FilePath} exists,
|
|
|
|
* so that one can perform local file operations.
|
|
|
|
*/
|
|
|
|
public <V,E extends Throwable> V act(Callable<V,E> callable) throws IOException, InterruptedException, E {
|
|
|
|
if(channel!=null) {
|
|
|
|
// run this on a remote system
|
|
|
|
return channel.call(callable);
|
|
|
|
} else {
|
|
|
|
// the file is on the local machine
|
|
|
|
return callable.call();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts this file to the URI, relative to the machine
|
|
|
|
* on which this file is available.
|
|
|
|
*/
|
|
|
|
public URI toURI() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<URI>() {
|
|
|
|
public URI invoke(File f, VirtualChannel channel) {
|
|
|
|
return f.toURI();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
|
|
|
* Creates this directory.
|
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public void mkdirs() throws IOException, InterruptedException {
|
2008-05-03 08:31:13 +08:00
|
|
|
if(!act(new FileCallable<Boolean>() {
|
2010-01-27 10:31:39 +08:00
|
|
|
public Boolean invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
2008-05-03 08:31:13 +08:00
|
|
|
if(f.mkdirs() || f.exists())
|
|
|
|
return true; // OK
|
|
|
|
|
|
|
|
// following Ant <mkdir> task to avoid possible race condition.
|
2010-01-27 10:31:39 +08:00
|
|
|
Thread.sleep(10);
|
2008-05-03 08:31:13 +08:00
|
|
|
|
|
|
|
return f.mkdirs() || f.exists();
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
}))
|
|
|
|
throw new IOException("Failed to mkdirs: "+remote);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes this directory, including all its contents recursively.
|
|
|
|
*/
|
|
|
|
public void deleteRecursive() throws IOException, InterruptedException {
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
Util.deleteRecursive(f);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes all the contents of this directory, but not the directory itself
|
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public void deleteContents() throws IOException, InterruptedException {
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
Util.deleteContentsRecursive(f);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
2009-10-29 05:03:36 +08:00
|
|
|
/**
|
|
|
|
* Gets the file name portion except the extension.
|
|
|
|
*
|
|
|
|
* For example, "foo" for "foo.txt" and "foo.tar" for "foo.tar.gz".
|
|
|
|
*/
|
|
|
|
public String getBaseName() {
|
|
|
|
String n = getName();
|
|
|
|
int idx = n.lastIndexOf('.');
|
|
|
|
if (idx<0) return n;
|
|
|
|
return n.substring(0,idx);
|
|
|
|
}
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
2011-12-26 02:54:44 +08:00
|
|
|
* Gets just the file name portion without directories.
|
2006-11-06 05:16:01 +08:00
|
|
|
*
|
2011-12-26 02:54:44 +08:00
|
|
|
* For example, "foo.txt" for "../abc/foo.txt"
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
|
|
|
public String getName() {
|
2007-03-09 14:57:24 +08:00
|
|
|
String r = remote;
|
|
|
|
if(r.endsWith("\\") || r.endsWith("/"))
|
|
|
|
r = r.substring(0,r.length()-1);
|
|
|
|
|
|
|
|
int len = r.length()-1;
|
2006-12-30 03:15:53 +08:00
|
|
|
while(len>=0) {
|
2007-03-09 14:57:24 +08:00
|
|
|
char ch = r.charAt(len);
|
2006-12-30 03:15:53 +08:00
|
|
|
if(ch=='\\' || ch=='/')
|
|
|
|
break;
|
|
|
|
len--;
|
|
|
|
}
|
|
|
|
|
2007-03-09 14:57:24 +08:00
|
|
|
return r.substring(len+1);
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
Merged revisions 19592-19593,19651,19669,19671-19672,19709,19712-19715,19728-19729,19825-19828,19859-19861,19863-19865,19869,19874-19875,19889,19896,19908-19909,19979,19982,20106,20115,20141-20144,20184,20196,20207-20208,20215-20216,20222,20286,20293 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/concurrent-build
........
r19592 | kohsuke | 2009-07-10 14:02:22 -0700 (Fri, 10 Jul 2009) | 1 line
introduced getWorkspace() and getModuleRoot() on AbstractBuild.
........
r19593 | kohsuke | 2009-07-10 15:06:08 -0700 (Fri, 10 Jul 2009) | 1 line
introduced a flag to control the behavior, so that we can expose the feature much later after we merge the branch into the trunk.
........
r19651 | kohsuke | 2009-07-13 08:48:31 -0700 (Mon, 13 Jul 2009) | 1 line
modified to work with multiple concurrent builds
........
r19669 | kohsuke | 2009-07-13 14:25:58 -0700 (Mon, 13 Jul 2009) | 1 line
updating TODOs
........
r19671 | kohsuke | 2009-07-13 16:50:42 -0700 (Mon, 13 Jul 2009) | 1 line
committing my changes before I push this up to the Run class.
........
r19672 | kohsuke | 2009-07-13 17:14:41 -0700 (Mon, 13 Jul 2009) | 1 line
pushed the change up to the Run class, which simplifies things a bit, and avoids a race condition in the final "notifyAll" when the build is completed.
........
r19709 | kohsuke | 2009-07-14 17:56:24 -0700 (Tue, 14 Jul 2009) | 1 line
added checkpoint methods to the base type of where it's commonly used, to simplify invocations.
........
r19712 | kohsuke | 2009-07-14 18:16:50 -0700 (Tue, 14 Jul 2009) | 1 line
revisited the CheckPoint abstraction. I think this is more OO now
........
r19713 | kohsuke | 2009-07-14 18:17:18 -0700 (Tue, 14 Jul 2009) | 1 line
doc fix
........
r19714 | kohsuke | 2009-07-14 18:23:32 -0700 (Tue, 14 Jul 2009) | 1 line
replaced AbstractProject.getWorkspace() by AbstractBuild.getWorkspace(). The easy ones are done, but the harder ones remain.
........
r19715 | kohsuke | 2009-07-14 18:32:56 -0700 (Tue, 14 Jul 2009) | 1 line
more getWorkspace() changes
........
r19728 | kohsuke | 2009-07-15 11:17:25 -0700 (Wed, 15 Jul 2009) | 1 line
removed more getWorkspace() usage by getSomeWorkspace()
........
r19729 | kohsuke | 2009-07-15 11:17:43 -0700 (Wed, 15 Jul 2009) | 1 line
this is done
........
r19825 | kohsuke | 2009-07-17 15:35:21 -0700 (Fri, 17 Jul 2009) | 4 lines
- refactored SCM triggering code to avoid queueing up too many threads.
- workspace locking only happens if the SCM declares that the polling requires a workspace.
TODO: given the face of concurrent builds, a single workspace lock won't work.
........
r19826 | kohsuke | 2009-07-17 16:21:15 -0700 (Fri, 17 Jul 2009) | 5 lines
implemented the handling of polling/build mutual exclusion when polling requires a workspace.
The SCMs that require a workspace for polling, such as CVS, do so by comparing the state of the workspace
vs that of the remote. So it needs to use the workspace of the last build. Polling needs to wait for this workspace
if it's currently in use by a build, so a wait/notify scheme was needed, and hence WorkspaceList.
........
r19827 | kohsuke | 2009-07-17 16:32:54 -0700 (Fri, 17 Jul 2009) | 1 line
removed the workspace resource lock.
........
r19828 | kohsuke | 2009-07-17 16:40:09 -0700 (Fri, 17 Jul 2009) | 1 line
got rid of the lock. A build will always allocate an available workspace, so this is no longer necessary.
........
r19859 | kohsuke | 2009-07-18 12:45:03 -0700 (Sat, 18 Jul 2009) | 2 lines
Fixing a test failure. This might be signaling a depper abstraction problem, but let's see...
........
r19860 | kohsuke | 2009-07-18 13:10:32 -0700 (Sat, 18 Jul 2009) | 1 line
bug fix
........
r19861 | kohsuke | 2009-07-18 13:12:18 -0700 (Sat, 18 Jul 2009) | 1 line
typo
........
r19863 | kohsuke | 2009-07-18 13:25:20 -0700 (Sat, 18 Jul 2009) | 1 line
pass in common parameters for convenience.
........
r19864 | kohsuke | 2009-07-18 13:36:34 -0700 (Sat, 18 Jul 2009) | 1 line
doc fix
........
r19865 | kohsuke | 2009-07-18 13:57:55 -0700 (Sat, 18 Jul 2009) | 1 line
bug fix.
........
r19869 | kohsuke | 2009-07-18 14:07:18 -0700 (Sat, 18 Jul 2009) | 2 lines
This fixes the elusive NPE in com.gargoylesoftware.htmlunit.javascript.host.Event.<init>(Event.java:164)
........
r19874 | kohsuke | 2009-07-18 14:44:39 -0700 (Sat, 18 Jul 2009) | 1 line
forgot to update this.
........
r19875 | kohsuke | 2009-07-18 14:44:48 -0700 (Sat, 18 Jul 2009) | 1 line
forgot to update this.
........
r19889 | kohsuke | 2009-07-18 16:12:04 -0700 (Sat, 18 Jul 2009) | 1 line
fixed the license header.
........
r19896 | kohsuke | 2009-07-18 16:16:44 -0700 (Sat, 18 Jul 2009) | 1 line
adding a note.
........
r19908 | kohsuke | 2009-07-18 17:13:03 -0700 (Sat, 18 Jul 2009) | 1 line
fixed a bug. The parent build will likely run on a different node, so we can't just inherit its workspace.
........
r19909 | kohsuke | 2009-07-18 17:16:54 -0700 (Sat, 18 Jul 2009) | 1 line
reorgznied imports.
........
r19979 | kohsuke | 2009-07-20 14:22:50 -0700 (Mon, 20 Jul 2009) | 1 line
[HUDSON-4060] fixed a reported ClassCastException, but I don't think that's related to the hang problem.
........
r19982 | kohsuke | 2009-07-20 14:51:11 -0700 (Mon, 20 Jul 2009) | 31 lines
increasing the error margin in response to the flaky test that causes this error:
unexpected build status; build log was: ------ Legacy code started this job. No cause information is available Recording test results Test reports were found but none of them are new. Did tests run? For example, /tmp/hudson3604989730528561398test/jobs/test0/workspace/junit.xml is 1 sec old Finished: FAILURE ------ expected:<UNSTABLE> but was:<FAILURE>
Stacktrace
junit.framework.AssertionFailedError: unexpected build status; build log was:
------
Legacy code started this job. No cause information is available
Recording test results
Test reports were found but none of them are new. Did tests run?
For example, /tmp/hudson3604989730528561398test/jobs/test0/workspace/junit.xml is 1 sec old
Finished: FAILURE
------
expected:<UNSTABLE> but was:<FAILURE>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)
at org.jvnet.hudson.test.HudsonTestCase.assertBuildStatus(HudsonTestCase.java:520)
at hudson.tasks.junit.CaseResultTest.testIssue20090516(CaseResultTest.java:74)
Standard Output
=== Starting testIssue20090516
Standard Error
2009-07-20 07:20:23.430::INFO: jetty-6.1.11
2009-07-20 07:20:23.434::INFO: NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
2009-07-20 07:20:23.436::INFO: Started SocketConnector@0.0.0.0:45218
........
r20106 | kohsuke | 2009-07-24 10:27:30 -0700 (Fri, 24 Jul 2009) | 1 line
adding a few well-known check points to expose them to plugins.
........
r20115 | kohsuke | 2009-07-24 14:42:58 -0700 (Fri, 24 Jul 2009) | 3 lines
Added a mechanism to handle the compatibility with earlier plugins. Have plugins declare the synchronization service it expects Hudson to provide.
This being binary compatible change allows Hudson to use existing plugins correctly, but it's source incompatibility allows us to advertize the new semantics to plugin developers, new or old.
........
r20141 | kohsuke | 2009-07-24 19:03:07 -0700 (Fri, 24 Jul 2009) | 1 line
better type safety
........
r20142 | kohsuke | 2009-07-24 19:13:43 -0700 (Fri, 24 Jul 2009) | 1 line
update the thread name to make the thread dump more understandable.
........
r20143 | kohsuke | 2009-07-24 19:22:12 -0700 (Fri, 24 Jul 2009) | 1 line
fixed a compilation problem.
........
r20144 | kohsuke | 2009-07-24 19:30:22 -0700 (Fri, 24 Jul 2009) | 1 line
fixed a test failure. Runner needs to be a stack.
........
r20184 | kohsuke | 2009-07-27 10:51:20 -0700 (Mon, 27 Jul 2009) | 3 lines
When remote JVM (in this case Maven) calls back to the proxy object, the executing thread needs to be able to behave as if it's the executor thread. So added the necessary abstractions for doing that.
It might have been better to do this in the remoting, by using the blocking caller thread to serve requests. That would be harder, but it gets rid of this ugly ThreadLocal book keeping.
........
r20196 | kohsuke | 2009-07-27 13:22:33 -0700 (Mon, 27 Jul 2009) | 1 line
Fixed a test failure. The proxy interface needs to be public for the interceptor to be able to invoke it.
........
r20207 | kohsuke | 2009-07-27 17:27:35 -0700 (Mon, 27 Jul 2009) | 1 line
[HUDSON-4060] this class-level synchronization has a devastating effect as it effectively creates a single giant lock for the entire Hudson and can cause a dead lock.
........
r20208 | kohsuke | 2009-07-27 17:28:58 -0700 (Mon, 27 Jul 2009) | 1 line
improved the thread name.
........
r20215 | kohsuke | 2009-07-28 10:58:15 -0700 (Tue, 28 Jul 2009) | 1 line
added form databinding support for <f:optionalBlock>
........
r20216 | kohsuke | 2009-07-28 11:00:35 -0700 (Tue, 28 Jul 2009) | 1 line
concurrent build is now a switch activated for each project separately.
........
r20222 | kohsuke | 2009-07-28 15:30:18 -0700 (Tue, 28 Jul 2009) | 3 lines
bug fix in the rendering of the build history when you have some builds finished earlier than their earlier builds that are still in progress.
This also fixes a race condition in a non concurrent build case, which can result in some build #s showing up more than once after AJAX update if the status of the build changes between the computation of 'nn' and that of the rendering.
........
r20286 | kohsuke | 2009-07-29 11:05:00 -0700 (Wed, 29 Jul 2009) | 1 line
still fixing more build list update issues. The original fix only kicked in for the list produced by AJAX, and didn't work for the initial list.
........
r20293 | kohsuke | 2009-07-29 17:03:20 -0700 (Wed, 29 Jul 2009) | 1 line
simplified a bit
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20296 71c3de6d-444a-0410-be80-ed276b4c234a
2009-07-30 08:47:34 +08:00
|
|
|
/**
|
|
|
|
* Short for {@code getParent().child(rel)}. Useful for getting other files in the same directory.
|
|
|
|
*/
|
|
|
|
public FilePath sibling(String rel) {
|
|
|
|
return getParent().child(rel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a {@link FilePath} by adding the given suffix to this path name.
|
|
|
|
*/
|
|
|
|
public FilePath withSuffix(String suffix) {
|
|
|
|
return new FilePath(channel,remote+suffix);
|
|
|
|
}
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
* The same as {@link FilePath#FilePath(FilePath,String)} but more OO.
|
2012-07-04 15:34:44 +08:00
|
|
|
* @param relOrAbsolute a relative or absolute path
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
* @return a file on the same channel
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
2012-07-04 15:34:44 +08:00
|
|
|
public FilePath child(String relOrAbsolute) {
|
|
|
|
return new FilePath(this,relOrAbsolute);
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the parent file.
|
2010-05-12 01:04:38 +08:00
|
|
|
* @return parent FilePath or null if there is no parent
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
|
|
|
public FilePath getParent() {
|
2010-05-12 01:04:38 +08:00
|
|
|
int i = remote.length() - 2;
|
|
|
|
for (; i >= 0; i--) {
|
|
|
|
char ch = remote.charAt(i);
|
2006-11-06 05:16:01 +08:00
|
|
|
if(ch=='\\' || ch=='/')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-05-12 01:04:38 +08:00
|
|
|
return i >= 0 ? new FilePath( channel, remote.substring(0,i+1) ) : null;
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-09-30 03:29:39 +08:00
|
|
|
* Creates a temporary file in the directory that this {@link FilePath} object designates.
|
2012-01-19 09:31:01 +08:00
|
|
|
*
|
|
|
|
* @param prefix
|
|
|
|
* The prefix string to be used in generating the file's name; must be
|
|
|
|
* at least three characters long
|
|
|
|
* @param suffix
|
|
|
|
* The suffix string to be used in generating the file's name; may be
|
|
|
|
* null, in which case the suffix ".tmp" will be used
|
|
|
|
* @return
|
|
|
|
* The new FilePath pointing to the temporary file
|
|
|
|
* @see File#createTempFile(String, String)
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public FilePath createTempFile(final String prefix, final String suffix) throws IOException, InterruptedException {
|
|
|
|
try {
|
|
|
|
return new FilePath(this,act(new FileCallable<String>() {
|
|
|
|
public String invoke(File dir, VirtualChannel channel) throws IOException {
|
|
|
|
File f = File.createTempFile(prefix, suffix, dir);
|
|
|
|
return f.getName();
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw new IOException2("Failed to create a temp file on "+remote,e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-01-19 09:31:01 +08:00
|
|
|
* Creates a temporary file in this directory and set the contents to the
|
2006-12-30 03:15:53 +08:00
|
|
|
* given text (encoded in the platform default encoding)
|
2012-01-19 09:31:01 +08:00
|
|
|
*
|
|
|
|
* @param prefix
|
|
|
|
* The prefix string to be used in generating the file's name; must be
|
|
|
|
* at least three characters long
|
|
|
|
* @param suffix
|
|
|
|
* The suffix string to be used in generating the file's name; may be
|
|
|
|
* null, in which case the suffix ".tmp" will be used
|
|
|
|
* @param contents
|
|
|
|
* The initial contents of the temporary file.
|
|
|
|
* @return
|
|
|
|
* The new FilePath pointing to the temporary file
|
|
|
|
* @see File#createTempFile(String, String)
|
2006-12-30 03:15:53 +08:00
|
|
|
*/
|
|
|
|
public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException {
|
2007-01-07 13:39:25 +08:00
|
|
|
return createTextTempFile(prefix,suffix,contents,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-01-19 09:31:01 +08:00
|
|
|
* Creates a temporary file in this directory (or the system temporary
|
|
|
|
* directory) and set the contents to the given text (encoded in the
|
|
|
|
* platform default encoding)
|
|
|
|
*
|
|
|
|
* @param prefix
|
|
|
|
* The prefix string to be used in generating the file's name; must be
|
|
|
|
* at least three characters long
|
|
|
|
* @param suffix
|
|
|
|
* The suffix string to be used in generating the file's name; may be
|
|
|
|
* null, in which case the suffix ".tmp" will be used
|
|
|
|
* @param contents
|
|
|
|
* The initial contents of the temporary file.
|
|
|
|
* @param inThisDirectory
|
|
|
|
* If true, then create this temporary in the directory pointed to by
|
|
|
|
* this.
|
|
|
|
* If false, then the temporary file is created in the system temporary
|
|
|
|
* directory (java.io.tmpdir)
|
|
|
|
* @return
|
|
|
|
* The new FilePath pointing to the temporary file
|
|
|
|
* @see File#createTempFile(String, String)
|
2007-01-07 13:39:25 +08:00
|
|
|
*/
|
|
|
|
public FilePath createTextTempFile(final String prefix, final String suffix, final String contents, final boolean inThisDirectory) throws IOException, InterruptedException {
|
2006-11-18 09:31:49 +08:00
|
|
|
try {
|
2007-01-08 07:29:50 +08:00
|
|
|
return new FilePath(channel,act(new FileCallable<String>() {
|
2006-12-30 03:15:53 +08:00
|
|
|
public String invoke(File dir, VirtualChannel channel) throws IOException {
|
2007-01-07 13:39:25 +08:00
|
|
|
if(!inThisDirectory)
|
2008-11-06 07:47:06 +08:00
|
|
|
dir = new File(System.getProperty("java.io.tmpdir"));
|
2007-12-06 10:37:50 +08:00
|
|
|
else
|
|
|
|
dir.mkdirs();
|
2007-12-06 10:38:57 +08:00
|
|
|
|
|
|
|
File f;
|
|
|
|
try {
|
|
|
|
f = File.createTempFile(prefix, suffix, dir);
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw new IOException2("Failed to create a temporary directory in "+dir,e);
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
|
|
|
|
Writer w = new FileWriter(f);
|
|
|
|
w.write(contents);
|
|
|
|
w.close();
|
|
|
|
|
2007-01-08 07:29:50 +08:00
|
|
|
return f.getAbsolutePath();
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
}));
|
2006-11-18 09:31:49 +08:00
|
|
|
} catch (IOException e) {
|
2006-12-30 03:15:53 +08:00
|
|
|
throw new IOException2("Failed to create a temp file on "+remote,e);
|
2006-11-18 09:31:49 +08:00
|
|
|
}
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
2009-06-13 07:00:59 +08:00
|
|
|
/**
|
|
|
|
* Creates a temporary directory inside the directory represented by 'this'
|
2012-01-19 09:31:01 +08:00
|
|
|
*
|
|
|
|
* @param prefix
|
|
|
|
* The prefix string to be used in generating the directory's name;
|
|
|
|
* must be at least three characters long
|
|
|
|
* @param suffix
|
|
|
|
* The suffix string to be used in generating the directory's name; may
|
|
|
|
* be null, in which case the suffix ".tmp" will be used
|
|
|
|
* @return
|
|
|
|
* The new FilePath pointing to the temporary directory
|
2009-06-13 07:00:59 +08:00
|
|
|
* @since 1.311
|
2012-01-19 09:31:01 +08:00
|
|
|
* @see File#createTempFile(String, String)
|
2009-06-13 07:00:59 +08:00
|
|
|
*/
|
|
|
|
public FilePath createTempDir(final String prefix, final String suffix) throws IOException, InterruptedException {
|
|
|
|
try {
|
|
|
|
return new FilePath(this,act(new FileCallable<String>() {
|
|
|
|
public String invoke(File dir, VirtualChannel channel) throws IOException {
|
|
|
|
File f = File.createTempFile(prefix, suffix, dir);
|
|
|
|
f.delete();
|
|
|
|
f.mkdir();
|
|
|
|
return f.getName();
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw new IOException2("Failed to create a temp directory on "+remote,e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
|
|
|
* Deletes this file.
|
2009-08-18 07:17:53 +08:00
|
|
|
* @throws IOException if it exists but could not be successfully deleted
|
|
|
|
* @return true, for a modicum of compatibility
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public boolean delete() throws IOException, InterruptedException {
|
2009-08-18 07:17:53 +08:00
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
Util.deleteFile(f);
|
|
|
|
return null;
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
});
|
2009-08-18 07:17:53 +08:00
|
|
|
return true;
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the file exists.
|
|
|
|
*/
|
|
|
|
public boolean exists() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<Boolean>() {
|
|
|
|
public Boolean invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return f.exists();
|
|
|
|
}
|
|
|
|
});
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Gets the last modified time stamp of this file, by using the clock
|
|
|
|
* of the machine where this file actually resides.
|
|
|
|
*
|
|
|
|
* @see File#lastModified()
|
2009-04-11 23:40:38 +08:00
|
|
|
* @see #touch(long)
|
2006-12-30 03:15:53 +08:00
|
|
|
*/
|
|
|
|
public long lastModified() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<Long>() {
|
|
|
|
public Long invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return f.lastModified();
|
|
|
|
}
|
|
|
|
});
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
2009-04-11 23:40:38 +08:00
|
|
|
/**
|
|
|
|
* Creates a file (if not already exist) and sets the timestamp.
|
|
|
|
*
|
|
|
|
* @since 1.299
|
|
|
|
*/
|
|
|
|
public void touch(final long timestamp) throws IOException, InterruptedException {
|
|
|
|
act(new FileCallable<Void>() {
|
2011-12-30 23:50:45 +08:00
|
|
|
private static final long serialVersionUID = -5094638816500738429L;
|
2009-04-11 23:40:38 +08:00
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
if(!f.exists())
|
|
|
|
new FileOutputStream(f).close();
|
|
|
|
if(!f.setLastModified(timestamp))
|
|
|
|
throw new IOException("Failed to set the timestamp of "+f+" to "+timestamp);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2011-12-30 23:47:13 +08:00
|
|
|
|
|
|
|
private void setLastModifiedIfPossible(final long timestamp) throws IOException, InterruptedException {
|
|
|
|
String message = act(new FileCallable<String>() {
|
|
|
|
private static final long serialVersionUID = -828220335793641630L;
|
|
|
|
public String invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
if(!f.setLastModified(timestamp)) {
|
|
|
|
if (Functions.isWindows()) {
|
|
|
|
// On Windows this seems to fail often. See JENKINS-11073
|
|
|
|
// Therefore don't fail, but just log a warning
|
|
|
|
return "Failed to set the timestamp of "+f+" to "+timestamp;
|
|
|
|
} else {
|
|
|
|
throw new IOException("Failed to set the timestamp of "+f+" to "+timestamp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (message!=null) {
|
|
|
|
LOGGER.warning(message);
|
|
|
|
}
|
|
|
|
}
|
2009-04-11 23:40:38 +08:00
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Checks if the file is a directory.
|
|
|
|
*/
|
|
|
|
public boolean isDirectory() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<Boolean>() {
|
|
|
|
public Boolean invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return f.isDirectory();
|
|
|
|
}
|
|
|
|
});
|
2006-12-17 13:58:52 +08:00
|
|
|
}
|
2007-08-13 07:49:37 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the file size in bytes.
|
2007-08-13 13:12:50 +08:00
|
|
|
*
|
|
|
|
* @since 1.129
|
2007-08-13 07:49:37 +08:00
|
|
|
*/
|
|
|
|
public long length() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<Long>() {
|
|
|
|
public Long invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return f.length();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2006-12-17 13:58:52 +08:00
|
|
|
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
/**
|
|
|
|
* Sets the file permission.
|
|
|
|
*
|
|
|
|
* On Windows, no-op.
|
|
|
|
*
|
2009-06-15 00:04:36 +08:00
|
|
|
* @param mask
|
|
|
|
* File permission mask. To simplify the permission copying,
|
|
|
|
* if the parameter is -1, this method becomes no-op.
|
2012-08-20 17:30:34 +08:00
|
|
|
* <p>
|
|
|
|
* please note mask is expected to be an octal if you use <a href="http://en.wikipedia.org/wiki/Chmod">chmod command line values</a>,
|
|
|
|
* so preceded by a '0' in java notation, ie <code>chmod(0644)</code>
|
|
|
|
*
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
* @since 1.303
|
2009-06-15 00:04:36 +08:00
|
|
|
* @see #mode()
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
*/
|
|
|
|
public void chmod(final int mask) throws IOException, InterruptedException {
|
2009-06-15 00:04:36 +08:00
|
|
|
if(!isUnix() || mask==-1) return;
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
2010-12-14 06:19:26 +08:00
|
|
|
_chmod(f, mask);
|
2010-12-14 05:21:55 +08:00
|
|
|
|
Merged revisions 17324-17325,17428,17430,17473-17475,17481-17482,17555-17563,17571,17593-17595,17619-17620,17637-17644,17656-17657,17663-17665,17667-17670,17730,17753,17755-17758,17763-17768,17770-17771,17901,17906,17911-17912,17958,17961-17962,17970-17977 via svnmerge from
https://www.dev.java.net/svn/hudson/branches/tool-autoinstallation
........
r17324 | jglick | 2009-04-20 18:24:32 -0700 (Mon, 20 Apr 2009) | 2 lines
Defensive cloning and Javadoc corrections.
(Though it seems no one is using the default impls of these methods yet anyway.)
........
r17325 | jglick | 2009-04-20 18:29:06 -0700 (Mon, 20 Apr 2009) | 1 line
Deprecation of delegate method is intentional.
........
r17428 | jglick | 2009-04-23 08:07:14 -0700 (Thu, 23 Apr 2009) | 1 line
Noting ToolLocationTranslator more prominently.
........
r17430 | jglick | 2009-04-23 09:16:40 -0700 (Thu, 23 Apr 2009) | 1 line
Unused imports.
........
r17473 | jglick | 2009-04-23 19:21:11 -0700 (Thu, 23 Apr 2009) | 1 line
Allow Plugin.configure to see the StaplerRequest, needed for some kinds of calls.
........
r17474 | jglick | 2009-04-23 19:25:54 -0700 (Thu, 23 Apr 2009) | 3 lines
Initial sketch of plugin to manage tool installations across slaves.
(Should really be under ../plugins/ but that was not branched, so putting here for the moment.)
........
r17475 | jglick | 2009-04-23 20:29:36 -0700 (Thu, 23 Apr 2009) | 1 line
Typo in Javadoc.
........
r17481 | jglick | 2009-04-23 22:46:26 -0700 (Thu, 23 Apr 2009) | 1 line
Unzip of an unbuffered stream is painfully slow.
........
r17482 | jglick | 2009-04-23 22:48:01 -0700 (Thu, 23 Apr 2009) | 1 line
ZIP-based tool installer now functional.
........
r17555 | jglick | 2009-04-27 17:50:38 -0700 (Mon, 27 Apr 2009) | 1 line
Build against newest trunk.
........
r17556 | jglick | 2009-04-27 18:38:28 -0700 (Mon, 27 Apr 2009) | 1 line
Adding help.
........
r17557 | jglick | 2009-04-27 18:57:46 -0700 (Mon, 27 Apr 2009) | 1 line
Moving toolName & label config GUI into generic files.
........
r17558 | jglick | 2009-04-27 19:37:30 -0700 (Mon, 27 Apr 2009) | 1 line
Typo.
........
r17559 | jglick | 2009-04-27 20:07:47 -0700 (Mon, 27 Apr 2009) | 1 line
Second tool installer type based on a freeform command.
........
r17560 | jglick | 2009-04-27 20:24:36 -0700 (Mon, 27 Apr 2009) | 1 line
installIfNecessaryFrom will now just return false in case the target dir exists but the URL cannot be opened.
........
r17561 | jglick | 2009-04-27 20:25:22 -0700 (Mon, 27 Apr 2009) | 2 lines
chmod only if something was actually installed.
Use a+x, not o+x.
........
r17562 | jglick | 2009-04-27 20:26:46 -0700 (Mon, 27 Apr 2009) | 1 line
Comment only.
........
r17563 | jglick | 2009-04-27 20:41:12 -0700 (Mon, 27 Apr 2009) | 1 line
I18N.
........
r17571 | jglick | 2009-04-28 08:15:31 -0700 (Tue, 28 Apr 2009) | 2 lines
Wiki link.
........
r17593 | jglick | 2009-04-28 15:38:33 -0700 (Tue, 28 Apr 2009) | 1 line
Turn off echo mode, it's just noise.
........
r17594 | jglick | 2009-04-28 15:39:29 -0700 (Tue, 28 Apr 2009) | 2 lines
Synchronizing access to installers for a given node/tool combo.
Sending log messages to Hudson log in real time.
........
r17595 | jglick | 2009-04-28 15:46:29 -0700 (Tue, 28 Apr 2009) | 1 line
Copyrights.
........
r17619 | jglick | 2009-04-29 06:25:23 -0700 (Wed, 29 Apr 2009) | 1 line
Improved Javadoc.
........
r17620 | jglick | 2009-04-29 06:51:11 -0700 (Wed, 29 Apr 2009) | 1 line
Demonstraing how to use DLJ to mechanically install official JDK releases on supported operating systems.
........
r17637 | kohsuke | 2009-04-30 16:15:24 -0700 (Thu, 30 Apr 2009) | 1 line
fixed what appears to be a C&P mistake
........
r17638 | kohsuke | 2009-04-30 16:16:21 -0700 (Thu, 30 Apr 2009) | 1 line
show YUI logger if YUI debugging mode is set.
........
r17639 | kohsuke | 2009-04-30 16:52:28 -0700 (Thu, 30 Apr 2009) | 7 lines
Fixed a UI script problem when <hetero-list> nests inside <repeatable>.
The cause of the problem was that the behavior for inner <hetero-list> kicks in first, altering HTML (by removing "prototypes"), before behavior for outer <repetable> kicks in and removes the master copy from DOM tree.
So <repeatable> ends up computing a master copy after some elements are removed, and hence when we try to reinsert them later by clicking "Add", it'll get incorrect copy, and re-execution of the <hetero-list> behavior bombs out.
I fixed this by skipping those HTML-altering behaviors if they show up in the part of DOM tree that's supposed to be snapshotted and removed.
........
r17640 | kohsuke | 2009-04-30 16:57:58 -0700 (Thu, 30 Apr 2009) | 7 lines
Added ToolProperty to ToolInstallation (which acts like NodeProperty to Node --- basically decorates the base object with additional properties.)
The original motivation is to implement ToolInstaller this way, if Jesse is OK. But decorating tools seem to have some other interesting use, such as a plugin for configuring $M2_HOME/conf/settings.xml, or a plugin to insert unlimited cryptography extension to JDK, or a plugin to add a few more jars into $ANT_HOME/lib.
For this to work, ToolInstallations that want properties needs to be modified to use a new constructor. For a starter, I modified the JDK class to do this.
I also took the opportunity to modernize JDK/config.jelly.
........
r17641 | kohsuke | 2009-04-30 17:02:04 -0700 (Thu, 30 Apr 2009) | 1 line
this appears to be a left-over from early days when we didn't have a means to do form validation
........
r17642 | kohsuke | 2009-04-30 17:02:35 -0700 (Thu, 30 Apr 2009) | 1 line
we don't need no.such.JDK but we need name. rebranching
........
r17643 | kohsuke | 2009-04-30 17:03:22 -0700 (Thu, 30 Apr 2009) | 1 line
rebranched from Hudson's configure.properties
........
r17644 | kohsuke | 2009-04-30 17:05:31 -0700 (Thu, 30 Apr 2009) | 1 line
removed unnecessary translations
........
r17656 | kohsuke | 2009-05-01 11:27:36 -0700 (Fri, 01 May 2009) | 1 line
Less hack for improved type safety. Asking people to write more code is not necessarily bad as long as what they need to do is obvious to them.
........
r17657 | kohsuke | 2009-05-01 12:07:20 -0700 (Fri, 01 May 2009) | 5 lines
The toolautoinst part of the change that corresponds to rev.17640.
ToolInstallers are now hooked under ToolInstallation through InstallSourceProperty as a ToolProperty.
This allows the relevant UIs to be shown in one place. Still pending Jesse's feedback. Making it a single commit to simplify a revert if necessary
........
r17663 | kohsuke | 2009-05-01 13:23:51 -0700 (Fri, 01 May 2009) | 1 line
doc improvement
........
r17664 | kohsuke | 2009-05-01 13:24:10 -0700 (Fri, 01 May 2009) | 1 line
needs this to allow Stapler to databind hetero-list automatically
........
r17665 | jglick | 2009-05-01 13:31:27 -0700 (Fri, 01 May 2009) | 1 line
Warnings.
........
r17667 | kohsuke | 2009-05-01 14:20:53 -0700 (Fri, 01 May 2009) | 1 line
added a method to do chmod
........
r17668 | kohsuke | 2009-05-01 14:30:35 -0700 (Fri, 01 May 2009) | 1 line
prefer JDK6 version to avoid unnecessary JNA loading
........
r17669 | kohsuke | 2009-05-01 14:33:09 -0700 (Fri, 01 May 2009) | 1 line
no, I must have confused this.
........
r17670 | kohsuke | 2009-05-01 15:57:11 -0700 (Fri, 01 May 2009) | 2 lines
- Automated JDK installer and its test.
- Minor update to the signature of ToolInstaller for supplying the expected default location.
........
r17730 | kohsuke | 2009-05-04 11:27:34 -0700 (Mon, 04 May 2009) | 1 line
avoid NPE as reported in HUDSON-3608
........
r17753 | jglick | 2009-05-04 19:34:08 -0700 (Mon, 04 May 2009) | 2 lines
Moved toolautoinst functionality into core.
........
r17755 | jglick | 2009-05-04 20:28:34 -0700 (Mon, 04 May 2009) | 8 lines
Added TaskListener parameter and IOException and InterruptedException to several methods:
Run.getEnvironment
NodeSpecific.forNode
ToolLocationTranslator.getToolHome
ToolLocationNodeProperty.getToolHome
ToolInstallation.translateFor
ProcessCache.Factory.getMavenInstallation
ProcessCache.Factory.getJava
........
r17756 | jglick | 2009-05-04 20:36:56 -0700 (Mon, 04 May 2009) | 1 line
expectedLocation was never strictly necessary, and will soon no longer be used even by JDKInstaller.
........
r17757 | jglick | 2009-05-04 20:40:41 -0700 (Mon, 04 May 2009) | 1 line
Not sure yet what @since should be.
........
r17758 | jglick | 2009-05-04 20:41:51 -0700 (Mon, 04 May 2009) | 1 line
getDefaultInstallers method added. Not yet in use.
........
r17763 | kohsuke | 2009-05-05 10:50:36 -0700 (Tue, 05 May 2009) | 1 line
deprecated redundant getJavaHome method
........
r17764 | kohsuke | 2009-05-05 12:10:45 -0700 (Tue, 05 May 2009) | 1 line
added general-purpose property defaulting mechanism, and added default tool installer for JDK
........
r17765 | jglick | 2009-05-05 12:35:56 -0700 (Tue, 05 May 2009) | 1 line
capitalize("") -> ""
........
r17766 | jglick | 2009-05-05 12:49:52 -0700 (Tue, 05 May 2009) | 1 line
Missing @since.
........
r17767 | jglick | 2009-05-05 13:01:41 -0700 (Tue, 05 May 2009) | 1 line
Unchecked warning.
........
r17768 | jglick | 2009-05-05 13:19:49 -0700 (Tue, 05 May 2009) | 2 lines
Two unsuccessful attempts at form validation.
........
r17770 | jglick | 2009-05-05 13:48:37 -0700 (Tue, 05 May 2009) | 1 line
Better class names.
........
r17771 | kohsuke | 2009-05-05 14:12:21 -0700 (Tue, 05 May 2009) | 5 lines
brought the form validation check back. The trick is to use the 'value' parameter.
In the end we'd expect this check to go away anyway, as we change input field to drop-down list, but in the mean time, this is why it didn't work.
Maybe we probably need more static code checkers? Like FindBugs rules?
........
r17901 | kohsuke | 2009-05-09 19:15:40 -0700 (Sat, 09 May 2009) | 1 line
having two toolHome is odd.
........
r17906 | kohsuke | 2009-05-10 11:09:13 -0700 (Sun, 10 May 2009) | 1 line
adding the generalization of UpdateCenter, but for compatibility reasons, we are leaving UpdateCenter as-is.
........
r17911 | kohsuke | 2009-05-10 17:02:53 -0700 (Sun, 10 May 2009) | 1 line
integrated json-lib with a bit of bug fix
........
r17912 | kohsuke | 2009-05-10 17:13:05 -0700 (Sun, 10 May 2009) | 1 line
JDK list is now fetched from hudson.dev.java.net
........
r17958 | kohsuke | 2009-05-11 13:44:25 -0700 (Mon, 11 May 2009) | 48 lines
Handle AbortException better to avoid error like this:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to delete directory: C:\files\hudson\workspace\hudson\hudson\main\remoting\target. Reason: Unable to delete file C:\files\hudson\workspace\hudson\hudson\main\remoting\target\remoting-1.304-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31 seconds
[INFO] Finished at: Sun May 10 18:15:33 PDT 2009
[INFO] Final Memory: 25M/48M
[INFO] ------------------------------------------------------------------------
Recording fingerprints
Archiving artifacts
Recording test results
ERROR: Failed to archive JUnit reports
hudson.util.IOException2: remote file operation failed
at hudson.FilePath.act(FilePath.java:596)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:82)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:372)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:360)
at hudson.model.Build$RunnerImpl.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:345)
at hudson.model.Run.run(Run.java:943)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:119)
Caused by: hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, \files\hudson\workspace\hudson\hudson\main\core\target\surefire-reports\TEST-hudson.BulkChangeTest.xml is 2 days 23 hr old
at hudson.tasks.junit.TestResult.parse(TestResult.java:134)
at hudson.tasks.junit.TestResult.<init>(TestResult.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:95)
at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:82)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1583)
at hudson.remoting.UserRequest.perform(UserRequest.java:92)
at hudson.remoting.UserRequest.perform(UserRequest.java:46)
at hudson.remoting.Request$2.run(Request.java:236)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
........
r17961 | kohsuke | 2009-05-11 15:16:39 -0700 (Mon, 11 May 2009) | 1 line
adding Windows JDK silent installation
........
r17962 | kohsuke | 2009-05-11 16:08:13 -0700 (Mon, 11 May 2009) | 1 line
Fixing JDK offline installatino for Windows
........
r17970 | kohsuke | 2009-05-11 19:37:59 -0700 (Mon, 11 May 2009) | 1 line
Fixing a problem that prevents the usage of this tag in <repeatable> block, which reinserts the same fragment over and over. So statically assigning IDs won't work
........
r17971 | kohsuke | 2009-05-11 22:17:09 -0700 (Mon, 11 May 2009) | 1 line
continuing to remove static ID generation, which breaks the tag when used inside <repetable> tag.
........
r17972 | kohsuke | 2009-05-11 22:19:11 -0700 (Mon, 11 May 2009) | 1 line
I don't know when this started, but even in the hudson-dev:run mode, the versionis no longer '?', so we need a different way to force reload
........
r17973 | kohsuke | 2009-05-11 22:26:34 -0700 (Mon, 11 May 2009) | 1 line
adjusted the text a bit since multiple "add" and "delete"s were rather confusing
........
r17974 | kohsuke | 2009-05-11 22:31:58 -0700 (Mon, 11 May 2009) | 1 line
added help screen
........
r17975 | kohsuke | 2009-05-11 22:41:39 -0700 (Mon, 11 May 2009) | 1 line
form validation now works against the checkbox, too
........
r17976 | kohsuke | 2009-05-11 22:43:00 -0700 (Mon, 11 May 2009) | 1 line
with auto installation, we expect users to specify a directory that doesn't exist yet, so don't report it as an error
........
r17977 | kohsuke | 2009-05-11 22:43:24 -0700 (Mon, 11 May 2009) | 1 line
improving the text
........
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17985 71c3de6d-444a-0410-be80-ed276b4c234a
2009-05-12 21:59:10 +08:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2010-12-14 06:19:26 +08:00
|
|
|
/**
|
|
|
|
* Run chmod via libc if we can, otherwise fall back to Ant.
|
|
|
|
*/
|
|
|
|
private static void _chmod(File f, int mask) throws IOException {
|
|
|
|
if (Functions.isWindows()) return; // noop
|
|
|
|
|
|
|
|
try {
|
|
|
|
if(LIBC.chmod(f.getAbsolutePath(),mask)!=0) {
|
|
|
|
throw new IOException("Failed to chmod "+f+" : "+LIBC.strerror(Native.getLastError()));
|
|
|
|
}
|
2011-01-11 21:01:27 +08:00
|
|
|
} catch(NoClassDefFoundError e) { // cf. https://groups.google.com/group/hudson-dev/browse_thread/thread/6d16c3e8ea0dbc9?hl=fr
|
|
|
|
_chmodAnt(f, mask);
|
|
|
|
} catch(UnsatisfiedLinkError e2) { // HUDSON-8155: use Ant's chmod task on non-GNU C systems
|
|
|
|
_chmodAnt(f, mask);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void _chmodAnt(File f, int mask) {
|
|
|
|
if (!CHMOD_WARNED) { // only warn this once to avoid flooding the log
|
|
|
|
CHMOD_WARNED = true;
|
|
|
|
LOGGER.warning("GNU C Library not available: Using Ant's chmod task instead.");
|
2010-12-14 06:19:26 +08:00
|
|
|
}
|
2011-01-11 21:01:27 +08:00
|
|
|
Chmod chmodTask = new Chmod();
|
|
|
|
chmodTask.setProject(new Project());
|
|
|
|
chmodTask.setFile(f);
|
|
|
|
chmodTask.setPerm(Integer.toOctalString(mask));
|
|
|
|
chmodTask.execute();
|
2010-12-14 06:19:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private static boolean CHMOD_WARNED = false;
|
|
|
|
|
2009-06-15 00:04:36 +08:00
|
|
|
/**
|
|
|
|
* Gets the file permission bit mask.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* -1 on Windows, since such a concept doesn't make sense.
|
|
|
|
* @since 1.311
|
|
|
|
* @see #chmod(int)
|
|
|
|
*/
|
|
|
|
public int mode() throws IOException, InterruptedException {
|
|
|
|
if(!isUnix()) return -1;
|
|
|
|
return act(new FileCallable<Integer>() {
|
|
|
|
public Integer invoke(File f, VirtualChannel channel) throws IOException {
|
2011-04-16 08:25:12 +08:00
|
|
|
return IOUtils.mode(f);
|
2009-06-15 00:04:36 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2006-11-06 05:16:01 +08:00
|
|
|
/**
|
2008-11-14 10:26:13 +08:00
|
|
|
* List up files and directories in this directory.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* This method returns direct children of the directory denoted by the 'this' object.
|
|
|
|
*/
|
|
|
|
public List<FilePath> list() throws IOException, InterruptedException {
|
|
|
|
return list((FileFilter)null);
|
|
|
|
}
|
|
|
|
|
2009-05-22 02:10:58 +08:00
|
|
|
/**
|
|
|
|
* List up subdirectories.
|
|
|
|
*
|
|
|
|
* @return can be empty but never null. Doesn't contain "." and ".."
|
|
|
|
*/
|
|
|
|
public List<FilePath> listDirectories() throws IOException, InterruptedException {
|
|
|
|
return list(new DirectoryFilter());
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final class DirectoryFilter implements FileFilter, Serializable {
|
|
|
|
public boolean accept(File f) {
|
|
|
|
return f.isDirectory();
|
|
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
}
|
|
|
|
|
2008-11-14 10:26:13 +08:00
|
|
|
/**
|
|
|
|
* List up files in this directory, just like {@link File#listFiles(FileFilter)}.
|
2006-12-30 03:15:53 +08:00
|
|
|
*
|
|
|
|
* @param filter
|
|
|
|
* The optional filter used to narrow down the result.
|
|
|
|
* If non-null, must be {@link Serializable}.
|
|
|
|
* If this {@link FilePath} represents a remote path,
|
|
|
|
* the filter object will be executed on the remote machine.
|
2006-11-06 05:16:01 +08:00
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
public List<FilePath> list(final FileFilter filter) throws IOException, InterruptedException {
|
2009-05-30 00:28:50 +08:00
|
|
|
if (filter != null && !(filter instanceof Serializable)) {
|
|
|
|
throw new IllegalArgumentException("Non-serializable filter of " + filter.getClass());
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
return act(new FileCallable<List<FilePath>>() {
|
|
|
|
public List<FilePath> invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
File[] children = f.listFiles(filter);
|
|
|
|
if(children ==null) return null;
|
|
|
|
|
|
|
|
ArrayList<FilePath> r = new ArrayList<FilePath>(children.length);
|
|
|
|
for (File child : children)
|
|
|
|
r.add(new FilePath(child));
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
2009-06-09 09:19:04 +08:00
|
|
|
}, (filter!=null?filter:this).getClass().getClassLoader());
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
2007-01-31 22:14:27 +08:00
|
|
|
/**
|
|
|
|
* List up files in this directory that matches the given Ant-style filter.
|
|
|
|
*
|
|
|
|
* @param includes
|
2009-04-12 03:04:54 +08:00
|
|
|
* See {@link FileSet} for the syntax. String like "foo/*.zip" or "foo/**/*.xml"
|
2007-08-13 07:44:00 +08:00
|
|
|
* @return
|
|
|
|
* can be empty but always non-null.
|
2007-01-31 22:14:27 +08:00
|
|
|
*/
|
|
|
|
public FilePath[] list(final String includes) throws IOException, InterruptedException {
|
2011-04-10 21:29:55 +08:00
|
|
|
return list(includes, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List up files in this directory that matches the given Ant-style filter.
|
|
|
|
*
|
|
|
|
* @param includes
|
|
|
|
* @param excludes
|
|
|
|
* See {@link FileSet} for the syntax. String like "foo/*.zip" or "foo/**/*.xml"
|
|
|
|
* @return
|
|
|
|
* can be empty but always non-null.
|
2011-05-19 01:20:13 +08:00
|
|
|
* @since 1.407
|
2011-04-10 21:29:55 +08:00
|
|
|
*/
|
|
|
|
public FilePath[] list(final String includes, final String excludes) throws IOException, InterruptedException {
|
2012-05-09 03:01:09 +08:00
|
|
|
return list(includes, excludes, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List up files in this directory that matches the given Ant-style filter.
|
|
|
|
*
|
|
|
|
* @param includes
|
|
|
|
* @param excludes
|
|
|
|
* See {@link FileSet} for the syntax. String like "foo/*.zip" or "foo/**/*.xml"
|
|
|
|
* @param defaultExcludes whether to use the ant default excludes
|
|
|
|
* @return
|
|
|
|
* can be empty but always non-null.
|
|
|
|
* @since 1.465
|
|
|
|
*/
|
|
|
|
public FilePath[] list(final String includes, final String excludes, final boolean defaultExcludes) throws IOException, InterruptedException {
|
2007-01-31 22:14:27 +08:00
|
|
|
return act(new FileCallable<FilePath[]>() {
|
|
|
|
public FilePath[] invoke(File f, VirtualChannel channel) throws IOException {
|
2012-05-09 03:01:09 +08:00
|
|
|
String[] files = glob(f, includes, excludes, defaultExcludes);
|
2007-01-31 22:14:27 +08:00
|
|
|
|
|
|
|
FilePath[] r = new FilePath[files.length];
|
|
|
|
for( int i=0; i<r.length; i++ )
|
|
|
|
r[i] = new FilePath(new File(f,files[i]));
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2007-08-13 13:12:50 +08:00
|
|
|
/**
|
|
|
|
* Runs Ant glob expansion.
|
2008-07-24 09:58:32 +08:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* A set of relative file names from the base directory.
|
2007-08-13 13:12:50 +08:00
|
|
|
*/
|
2012-05-09 03:01:09 +08:00
|
|
|
private static String[] glob(File dir, String includes, String excludes, boolean defaultExcludes) throws IOException {
|
2008-07-24 10:00:38 +08:00
|
|
|
if(isAbsolute(includes))
|
2010-06-19 14:45:26 +08:00
|
|
|
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
|
2011-04-10 21:29:55 +08:00
|
|
|
FileSet fs = Util.createFileSet(dir,includes,excludes);
|
2012-05-09 03:01:09 +08:00
|
|
|
fs.setDefaultexcludes(defaultExcludes);
|
2007-08-13 13:12:50 +08:00
|
|
|
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
|
|
|
|
String[] files = ds.getIncludedFiles();
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Reads this file.
|
|
|
|
*/
|
|
|
|
public InputStream read() throws IOException {
|
|
|
|
if(channel==null)
|
|
|
|
return new FileInputStream(new File(remote));
|
|
|
|
|
|
|
|
final Pipe p = Pipe.createRemoteToLocal();
|
|
|
|
channel.callAsync(new Callable<Void,IOException>() {
|
|
|
|
public Void call() throws IOException {
|
2009-02-18 03:06:35 +08:00
|
|
|
FileInputStream fis=null;
|
|
|
|
try {
|
|
|
|
fis = new FileInputStream(new File(remote));
|
|
|
|
Util.copyStream(fis,p.getOut());
|
|
|
|
return null;
|
|
|
|
} finally {
|
|
|
|
IOUtils.closeQuietly(fis);
|
|
|
|
IOUtils.closeQuietly(p.getOut());
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return p.getIn();
|
|
|
|
}
|
|
|
|
|
2009-05-22 02:10:58 +08:00
|
|
|
/**
|
|
|
|
* Reads this file into a string, by using the current system encoding.
|
|
|
|
*/
|
|
|
|
public String readToString() throws IOException {
|
|
|
|
InputStream in = read();
|
|
|
|
try {
|
|
|
|
return IOUtils.toString(in);
|
|
|
|
} finally {
|
|
|
|
in.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Writes to this file.
|
|
|
|
* If this file already exists, it will be overwritten.
|
2007-01-08 11:57:47 +08:00
|
|
|
* If the directory doesn't exist, it will be created.
|
2012-06-16 09:30:16 +08:00
|
|
|
*
|
|
|
|
* <P>
|
|
|
|
* I/O operation to remote {@link FilePath} happens asynchronously, meaning write operations to the returned
|
|
|
|
* {@link OutputStream} will return without receiving a confirmation from the remote that the write happened.
|
|
|
|
* I/O operations also happens asynchronously from the {@link Channel#call(Callable)} operations, so if
|
|
|
|
* you write to a remote file and then execute {@link Channel#call(Callable)} and try to access the newly copied
|
|
|
|
* file, it might not be fully written yet.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
*
|
2006-12-30 03:15:53 +08:00
|
|
|
*/
|
2007-01-09 01:19:35 +08:00
|
|
|
public OutputStream write() throws IOException, InterruptedException {
|
2007-01-16 07:48:38 +08:00
|
|
|
if(channel==null) {
|
2008-10-04 13:02:21 +08:00
|
|
|
File f = new File(remote).getAbsoluteFile();
|
2007-01-16 07:48:38 +08:00
|
|
|
f.getParentFile().mkdirs();
|
|
|
|
return new FileOutputStream(f);
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
|
2007-01-09 01:19:35 +08:00
|
|
|
return channel.call(new Callable<OutputStream,IOException>() {
|
|
|
|
public OutputStream call() throws IOException {
|
2008-10-04 13:02:21 +08:00
|
|
|
File f = new File(remote).getAbsoluteFile();
|
2007-01-08 11:57:47 +08:00
|
|
|
f.getParentFile().mkdirs();
|
|
|
|
FileOutputStream fos = new FileOutputStream(f);
|
2007-01-09 01:19:35 +08:00
|
|
|
return new RemoteOutputStream(fos);
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2007-04-29 21:48:37 +08:00
|
|
|
/**
|
|
|
|
* Overwrites this file by placing the given String as the content.
|
|
|
|
*
|
|
|
|
* @param encoding
|
|
|
|
* Null to use the platform default encoding.
|
|
|
|
* @since 1.105
|
|
|
|
*/
|
|
|
|
public void write(final String content, final String encoding) throws IOException, InterruptedException {
|
2009-01-17 09:12:48 +08:00
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
2007-04-29 21:48:37 +08:00
|
|
|
f.getParentFile().mkdirs();
|
|
|
|
FileOutputStream fos = new FileOutputStream(f);
|
2008-08-07 00:50:03 +08:00
|
|
|
Writer w = encoding != null ? new OutputStreamWriter(fos, encoding) : new OutputStreamWriter(fos);
|
2007-04-29 21:48:37 +08:00
|
|
|
try {
|
|
|
|
w.write(content);
|
|
|
|
} finally {
|
2008-08-07 00:50:03 +08:00
|
|
|
w.close();
|
2007-04-29 21:48:37 +08:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Computes the MD5 digest of the file in hex string.
|
|
|
|
*/
|
|
|
|
public String digest() throws IOException, InterruptedException {
|
|
|
|
return act(new FileCallable<String>() {
|
|
|
|
public String invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
return Util.getDigestOf(new FileInputStream(f));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2008-05-08 12:48:09 +08:00
|
|
|
/**
|
|
|
|
* Rename this file/directory to the target filepath. This FilePath and the target must
|
|
|
|
* be on the some host
|
|
|
|
*/
|
|
|
|
public void renameTo(final FilePath target) throws IOException, InterruptedException {
|
|
|
|
if(this.channel != target.channel) {
|
|
|
|
throw new IOException("renameTo target must be on the same host");
|
|
|
|
}
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
f.renameTo(new File(target.remote));
|
|
|
|
return null;
|
2009-05-22 02:10:58 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Moves all the contents of this directory into the specified directory, then delete this directory itself.
|
|
|
|
*
|
|
|
|
* @since 1.308.
|
|
|
|
*/
|
|
|
|
public void moveAllChildrenTo(final FilePath target) throws IOException, InterruptedException {
|
|
|
|
if(this.channel != target.channel) {
|
|
|
|
throw new IOException("pullUpTo target must be on the same host");
|
|
|
|
}
|
|
|
|
act(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
|
|
|
File t = new File(target.getRemote());
|
|
|
|
|
|
|
|
for(File child : f.listFiles()) {
|
|
|
|
File target = new File(t, child.getName());
|
|
|
|
if(!child.renameTo(target))
|
|
|
|
throw new IOException("Failed to rename "+child+" to "+target);
|
|
|
|
}
|
|
|
|
f.delete();
|
|
|
|
return null;
|
2008-05-08 12:48:09 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Copies this file to the specified target.
|
|
|
|
*/
|
|
|
|
public void copyTo(FilePath target) throws IOException, InterruptedException {
|
|
|
|
try {
|
2009-11-20 09:49:03 +08:00
|
|
|
OutputStream out = target.write();
|
|
|
|
try {
|
|
|
|
copyTo(out);
|
|
|
|
} finally {
|
|
|
|
out.close();
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
throw new IOException2("Failed to copy "+this+" to "+target,e);
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-15 00:04:36 +08:00
|
|
|
/**
|
2011-08-25 03:02:14 +08:00
|
|
|
* Copies this file to the specified target, with file permissions and other meta attributes intact.
|
2009-06-15 00:04:36 +08:00
|
|
|
* @since 1.311
|
|
|
|
*/
|
|
|
|
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
|
2009-06-15 01:35:54 +08:00
|
|
|
copyTo(target);
|
2009-06-15 00:04:36 +08:00
|
|
|
// copy file permission
|
|
|
|
target.chmod(mode());
|
2011-12-30 23:47:13 +08:00
|
|
|
target.setLastModifiedIfPossible(lastModified());
|
2009-06-15 00:04:36 +08:00
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Sends the contents of this file into the given {@link OutputStream}.
|
|
|
|
*/
|
|
|
|
public void copyTo(OutputStream os) throws IOException, InterruptedException {
|
|
|
|
final OutputStream out = new RemoteOutputStream(os);
|
|
|
|
|
|
|
|
act(new FileCallable<Void>() {
|
2011-12-30 23:50:45 +08:00
|
|
|
private static final long serialVersionUID = 4088559042349254141L;
|
2006-12-30 03:15:53 +08:00
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
2009-02-19 13:25:21 +08:00
|
|
|
FileInputStream fis = null;
|
|
|
|
try {
|
|
|
|
fis = new FileInputStream(f);
|
|
|
|
Util.copyStream(fis,out);
|
|
|
|
return null;
|
|
|
|
} finally {
|
|
|
|
IOUtils.closeQuietly(fis);
|
|
|
|
IOUtils.closeQuietly(out);
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
});
|
2011-03-15 04:26:11 +08:00
|
|
|
|
2012-06-16 09:30:16 +08:00
|
|
|
// make sure the writes fully got delivered to 'os' before we return.
|
|
|
|
// this is needed because I/O operation is asynchronous
|
2011-05-11 07:21:10 +08:00
|
|
|
syncIO();
|
|
|
|
}
|
|
|
|
|
2012-06-16 09:30:16 +08:00
|
|
|
/**
|
|
|
|
* With fix to JENKINS-11251 (remoting 2.15), this is no longer necessary.
|
|
|
|
* But I'm keeping it for a while so that users who manually deploy slave.jar has time to deploy new version
|
|
|
|
* before this goes away.
|
|
|
|
*/
|
2011-05-11 07:21:10 +08:00
|
|
|
private void syncIO() throws InterruptedException {
|
|
|
|
try {
|
|
|
|
if (channel!=null)
|
|
|
|
_syncIO();
|
|
|
|
} catch (AbstractMethodError e) {
|
|
|
|
// legacy slave.jar. Handle this gracefully
|
|
|
|
try {
|
|
|
|
LOGGER.log(Level.WARNING,"Looks like an old slave.jar. Please update "+ Which.jarFile(Channel.class)+" to the new version",e);
|
|
|
|
} catch (IOException _) {
|
|
|
|
// really ignore this time
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
|
|
|
|
* on BugParade for more details.
|
|
|
|
*/
|
|
|
|
private void _syncIO() throws InterruptedException {
|
|
|
|
channel.syncLocalIO();
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remoting interface used for {@link FilePath#copyRecursiveTo(String, FilePath)}.
|
|
|
|
*
|
|
|
|
* TODO: this might not be the most efficient way to do the copy.
|
|
|
|
*/
|
|
|
|
interface RemoteCopier {
|
2007-02-27 12:11:35 +08:00
|
|
|
/**
|
|
|
|
* @param fileName
|
|
|
|
* relative path name to the output file. Path separator must be '/'.
|
|
|
|
*/
|
2006-12-30 03:15:53 +08:00
|
|
|
void open(String fileName) throws IOException;
|
|
|
|
void write(byte[] buf, int len) throws IOException;
|
|
|
|
void close() throws IOException;
|
|
|
|
}
|
|
|
|
|
2009-06-20 11:13:29 +08:00
|
|
|
/**
|
|
|
|
* Copies the contents of this directory recursively into the specified target directory.
|
2011-07-24 16:31:09 +08:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* the number of files copied.
|
2009-06-20 11:13:29 +08:00
|
|
|
* @since 1.312
|
|
|
|
*/
|
|
|
|
public int copyRecursiveTo(FilePath target) throws IOException, InterruptedException {
|
|
|
|
return copyRecursiveTo("**/*",target);
|
|
|
|
}
|
|
|
|
|
2011-07-24 16:31:09 +08:00
|
|
|
/**
|
|
|
|
* Copies the files that match the given file mask to the specified target node.
|
|
|
|
*
|
|
|
|
* @param fileMask
|
|
|
|
* Ant GLOB pattern.
|
|
|
|
* String like "foo/bar/*.xml" Multiple patterns can be separated
|
|
|
|
* by ',', and whitespace can surround ',' (so that you can write
|
|
|
|
* "abc, def" and "abc,def" to mean the same thing.
|
|
|
|
* @return
|
|
|
|
* the number of files copied.
|
|
|
|
*/
|
2007-01-30 23:29:44 +08:00
|
|
|
public int copyRecursiveTo(String fileMask, FilePath target) throws IOException, InterruptedException {
|
|
|
|
return copyRecursiveTo(fileMask,null,target);
|
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
/**
|
|
|
|
* Copies the files that match the given file mask to the specified target node.
|
|
|
|
*
|
2008-08-14 06:33:34 +08:00
|
|
|
* @param fileMask
|
|
|
|
* Ant GLOB pattern.
|
|
|
|
* String like "foo/bar/*.xml" Multiple patterns can be separated
|
|
|
|
* by ',', and whitespace can surround ',' (so that you can write
|
|
|
|
* "abc, def" and "abc,def" to mean the same thing.
|
2007-01-30 23:29:44 +08:00
|
|
|
* @param excludes
|
|
|
|
* Files to be excluded. Can be null.
|
2006-12-30 03:15:53 +08:00
|
|
|
* @return
|
|
|
|
* the number of files copied.
|
|
|
|
*/
|
2007-01-30 23:29:44 +08:00
|
|
|
public int copyRecursiveTo(final String fileMask, final String excludes, final FilePath target) throws IOException, InterruptedException {
|
2006-12-30 03:15:53 +08:00
|
|
|
if(this.channel==target.channel) {
|
|
|
|
// local to local copy.
|
|
|
|
return act(new FileCallable<Integer>() {
|
|
|
|
public Integer invoke(File base, VirtualChannel channel) throws IOException {
|
2009-01-22 10:12:31 +08:00
|
|
|
if(!base.exists()) return 0;
|
2006-12-30 03:15:53 +08:00
|
|
|
assert target.channel==null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
class CopyImpl extends Copy {
|
|
|
|
private int copySize;
|
|
|
|
|
|
|
|
public CopyImpl() {
|
|
|
|
setProject(new org.apache.tools.ant.Project());
|
|
|
|
}
|
|
|
|
|
2009-09-15 03:10:57 +08:00
|
|
|
@Override
|
2006-12-30 03:15:53 +08:00
|
|
|
protected void doFileOperations() {
|
|
|
|
copySize = super.fileCopyMap.size();
|
|
|
|
super.doFileOperations();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getNumCopied() {
|
|
|
|
return copySize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CopyImpl copyTask = new CopyImpl();
|
|
|
|
copyTask.setTodir(new File(target.remote));
|
2008-01-15 13:26:38 +08:00
|
|
|
copyTask.addFileset(Util.createFileSet(base,fileMask,excludes));
|
2010-04-28 07:53:41 +08:00
|
|
|
copyTask.setOverwrite(true);
|
2009-03-05 12:58:02 +08:00
|
|
|
copyTask.setIncludeEmptyDirs(false);
|
2006-12-30 03:15:53 +08:00
|
|
|
|
|
|
|
copyTask.execute();
|
|
|
|
return copyTask.getNumCopied();
|
|
|
|
} catch (BuildException e) {
|
|
|
|
throw new IOException2("Failed to copy "+base+"/"+fileMask+" to "+target,e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2007-04-06 22:19:15 +08:00
|
|
|
} else
|
|
|
|
if(this.channel==null) {
|
|
|
|
// local -> remote copy
|
|
|
|
final Pipe pipe = Pipe.createLocalToRemote();
|
|
|
|
|
|
|
|
Future<Void> future = target.actAsync(new FileCallable<Void>() {
|
|
|
|
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
2007-04-13 04:51:37 +08:00
|
|
|
try {
|
2009-04-21 08:13:54 +08:00
|
|
|
readFromTar(remote+'/'+fileMask, f,TarCompression.GZIP.extract(pipe.getIn()));
|
2007-04-13 04:51:37 +08:00
|
|
|
return null;
|
|
|
|
} finally {
|
|
|
|
pipe.getIn().close();
|
|
|
|
}
|
2007-04-06 22:19:15 +08:00
|
|
|
}
|
|
|
|
});
|
2009-04-25 01:58:02 +08:00
|
|
|
int r = writeToTar(new File(remote),fileMask,excludes,TarCompression.GZIP.compress(pipe.getOut()));
|
2007-04-06 22:19:15 +08:00
|
|
|
try {
|
|
|
|
future.get();
|
|
|
|
} catch (ExecutionException e) {
|
|
|
|
throw new IOException2(e);
|
|
|
|
}
|
|
|
|
return r;
|
2006-12-30 03:15:53 +08:00
|
|
|
} else {
|
2007-04-06 22:19:15 +08:00
|
|
|
// remote -> local copy
|
|
|
|
final Pipe pipe = Pipe.createRemoteToLocal();
|
2006-12-30 03:15:53 +08:00
|
|
|
|
2007-04-06 22:19:15 +08:00
|
|
|
Future<Integer> future = actAsync(new FileCallable<Integer>() {
|
|
|
|
public Integer invoke(File f, VirtualChannel channel) throws IOException {
|
2007-04-13 04:51:37 +08:00
|
|
|
try {
|
2009-04-25 01:58:02 +08:00
|
|
|
return writeToTar(f,fileMask,excludes,TarCompression.GZIP.compress(pipe.getOut()));
|
2007-04-13 04:51:37 +08:00
|
|
|
} finally {
|
|
|
|
pipe.getOut().close();
|
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
});
|
2007-04-13 04:51:37 +08:00
|
|
|
try {
|
2009-04-21 08:13:54 +08:00
|
|
|
readFromTar(remote+'/'+fileMask,new File(target.remote),TarCompression.GZIP.extract(pipe.getIn()));
|
2007-04-13 04:51:37 +08:00
|
|
|
} catch (IOException e) {// BuildException or IOException
|
|
|
|
try {
|
|
|
|
future.get(3,TimeUnit.SECONDS);
|
|
|
|
throw e; // the remote side completed successfully, so the error must be local
|
|
|
|
} catch (ExecutionException x) {
|
|
|
|
// report both errors
|
2008-06-06 11:43:25 +08:00
|
|
|
throw new IOException2(Functions.printThrowable(e),x);
|
2007-04-13 04:52:23 +08:00
|
|
|
} catch (TimeoutException _) {
|
2007-04-13 04:51:37 +08:00
|
|
|
// remote is hanging
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
2007-04-06 22:19:15 +08:00
|
|
|
try {
|
|
|
|
return future.get();
|
|
|
|
} catch (ExecutionException e) {
|
|
|
|
throw new IOException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-03 02:20:13 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes files in 'this' directory to a tar stream.
|
|
|
|
*
|
|
|
|
* @param glob
|
|
|
|
* Ant file pattern mask, like "**/*.java".
|
|
|
|
*/
|
|
|
|
public int tar(OutputStream out, final String glob) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
return archive(ArchiverFactory.TAR, out, glob);
|
2009-07-03 02:20:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public int tar(OutputStream out, FileFilter filter) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
return archive(ArchiverFactory.TAR, out, filter);
|
2009-07-03 02:20:13 +08:00
|
|
|
}
|
|
|
|
|
2010-01-22 07:25:14 +08:00
|
|
|
/**
|
|
|
|
* Uses the given scanner on 'this' directory to list up files and then archive it to a tar stream.
|
|
|
|
*/
|
|
|
|
public int tar(OutputStream out, DirScanner scanner) throws IOException, InterruptedException {
|
2010-05-15 21:40:29 +08:00
|
|
|
return archive(ArchiverFactory.TAR, out, scanner);
|
2010-01-22 07:25:14 +08:00
|
|
|
}
|
|
|
|
|
2009-07-03 02:20:13 +08:00
|
|
|
/**
|
|
|
|
* Writes to a tar stream and stores obtained files to the base dir.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* number of files/directories that are written.
|
|
|
|
*/
|
2010-11-11 23:07:33 +08:00
|
|
|
private static Integer writeToTar(File baseDir, String fileMask, String excludes, OutputStream out) throws IOException {
|
2010-05-15 21:40:29 +08:00
|
|
|
Archiver tw = ArchiverFactory.TAR.create(out);
|
2009-07-03 02:20:13 +08:00
|
|
|
try {
|
|
|
|
new DirScanner.Glob(fileMask,excludes).scan(baseDir,tw);
|
|
|
|
} finally {
|
|
|
|
tw.close();
|
|
|
|
}
|
2010-05-15 21:40:29 +08:00
|
|
|
return tw.countEntries();
|
2007-04-06 22:19:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads from a tar stream and stores obtained files to the base dir.
|
|
|
|
*/
|
2009-03-11 15:02:11 +08:00
|
|
|
private static void readFromTar(String name, File baseDir, InputStream in) throws IOException {
|
|
|
|
TarInputStream t = new TarInputStream(in);
|
2008-11-06 03:16:45 +08:00
|
|
|
try {
|
2009-03-11 15:02:11 +08:00
|
|
|
TarEntry te;
|
|
|
|
while ((te = t.getNextEntry()) != null) {
|
|
|
|
File f = new File(baseDir,te.getName());
|
|
|
|
if(te.isDirectory()) {
|
|
|
|
f.mkdirs();
|
|
|
|
} else {
|
|
|
|
File parent = f.getParentFile();
|
|
|
|
if (parent != null) parent.mkdirs();
|
|
|
|
|
2012-03-10 10:25:40 +08:00
|
|
|
byte linkFlag = (Byte) LINKFLAG_FIELD.get(te);
|
|
|
|
if (linkFlag==TarEntry.LF_SYMLINK) {
|
|
|
|
new FilePath(f).symlinkTo(te.getLinkName(), TaskListener.NULL);
|
|
|
|
} else {
|
|
|
|
IOUtils.copy(t,f);
|
2012-05-08 05:02:01 +08:00
|
|
|
|
|
|
|
f.setLastModified(te.getModTime().getTime());
|
|
|
|
int mode = te.getMode()&0777;
|
|
|
|
if(mode!=0 && !Functions.isWindows()) // be defensive
|
|
|
|
_chmod(f,mode);
|
2012-03-10 10:25:40 +08:00
|
|
|
}
|
2009-03-11 15:02:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch(IOException e) {
|
|
|
|
throw new IOException2("Failed to extract "+name,e);
|
2012-03-10 10:25:40 +08:00
|
|
|
} catch (InterruptedException e) {
|
|
|
|
Thread.currentThread().interrupt(); // process this later
|
|
|
|
throw new IOException2("Failed to extract "+name,e);
|
|
|
|
} catch (IllegalAccessException e) {
|
|
|
|
throw new IOException2("Failed to extract "+name,e);
|
2009-03-11 15:02:11 +08:00
|
|
|
} finally {
|
|
|
|
t.close();
|
2007-04-13 04:51:37 +08:00
|
|
|
}
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
2007-03-23 07:30:06 +08:00
|
|
|
/**
|
|
|
|
* Creates a {@link Launcher} for starting processes on the node
|
2007-03-23 07:30:18 +08:00
|
|
|
* that has this file.
|
2007-03-24 09:06:51 +08:00
|
|
|
* @since 1.89
|
2007-03-23 07:30:06 +08:00
|
|
|
*/
|
2009-03-31 04:45:35 +08:00
|
|
|
public Launcher createLauncher(TaskListener listener) throws IOException, InterruptedException {
|
2007-03-23 07:30:06 +08:00
|
|
|
if(channel==null)
|
|
|
|
return new LocalLauncher(listener);
|
|
|
|
else
|
2009-03-31 04:45:35 +08:00
|
|
|
return new RemoteLauncher(listener,channel,channel.call(new IsUnix()));
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final class IsUnix implements Callable<Boolean,IOException> {
|
|
|
|
public Boolean call() throws IOException {
|
|
|
|
return File.pathSeparatorChar==':';
|
|
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
2007-03-23 07:30:06 +08:00
|
|
|
}
|
|
|
|
|
2007-03-24 09:06:51 +08:00
|
|
|
/**
|
2007-04-08 03:54:56 +08:00
|
|
|
* Validates the ant file mask (like "foo/bar/*.txt, zot/*.jar")
|
2007-03-24 09:06:51 +08:00
|
|
|
* against this directory, and try to point out the problem.
|
|
|
|
*
|
2007-03-24 09:18:13 +08:00
|
|
|
* <p>
|
2009-03-23 11:26:55 +08:00
|
|
|
* This is useful in conjunction with {@link FormValidation}.
|
2007-03-24 09:18:13 +08:00
|
|
|
*
|
2007-03-24 09:06:51 +08:00
|
|
|
* @return
|
2009-03-17 09:54:22 +08:00
|
|
|
* null if no error was found. Otherwise returns a human readable error message.
|
2007-03-24 09:06:51 +08:00
|
|
|
* @since 1.90
|
2009-03-23 11:26:55 +08:00
|
|
|
* @see #validateFileMask(FilePath, String)
|
2007-03-24 09:06:51 +08:00
|
|
|
*/
|
2007-04-08 03:54:56 +08:00
|
|
|
public String validateAntFileMask(final String fileMasks) throws IOException, InterruptedException {
|
2007-03-24 09:06:51 +08:00
|
|
|
return act(new FileCallable<String>() {
|
|
|
|
public String invoke(File dir, VirtualChannel channel) throws IOException {
|
2008-12-13 09:19:02 +08:00
|
|
|
if(fileMasks.startsWith("~"))
|
|
|
|
return Messages.FilePath_TildaDoesntWork();
|
|
|
|
|
2008-01-17 13:51:52 +08:00
|
|
|
StringTokenizer tokens = new StringTokenizer(fileMasks,",");
|
2007-04-08 03:54:56 +08:00
|
|
|
|
|
|
|
while(tokens.hasMoreTokens()) {
|
|
|
|
final String fileMask = tokens.nextToken().trim();
|
2008-02-05 14:38:12 +08:00
|
|
|
if(hasMatch(dir,fileMask))
|
|
|
|
continue; // no error on this portion
|
|
|
|
|
|
|
|
// in 1.172 we introduced an incompatible change to stop using ' ' as the separator
|
|
|
|
// so see if we can match by using ' ' as the separator
|
|
|
|
if(fileMask.contains(" ")) {
|
|
|
|
boolean matched = true;
|
|
|
|
for (String token : Util.tokenize(fileMask))
|
|
|
|
matched &= hasMatch(dir,token);
|
|
|
|
if(matched)
|
|
|
|
return Messages.FilePath_validateAntFileMask_whitespaceSeprator();
|
|
|
|
}
|
|
|
|
|
|
|
|
// a common mistake is to assume the wrong base dir, and there are two variations
|
|
|
|
// to this: (1) the user gave us aa/bb/cc/dd where cc/dd was correct
|
|
|
|
// and (2) the user gave us cc/dd where aa/bb/cc/dd was correct.
|
|
|
|
|
|
|
|
{// check the (1) above first
|
|
|
|
String f=fileMask;
|
|
|
|
while(true) {
|
|
|
|
int idx = findSeparator(f);
|
|
|
|
if(idx==-1) break;
|
|
|
|
f=f.substring(idx+1);
|
|
|
|
|
|
|
|
if(hasMatch(dir,f))
|
|
|
|
return Messages.FilePath_validateAntFileMask_doesntMatchAndSuggest(fileMask,f);
|
2007-04-08 03:54:56 +08:00
|
|
|
}
|
2008-02-05 14:38:12 +08:00
|
|
|
}
|
2007-03-24 09:06:51 +08:00
|
|
|
|
2009-09-23 07:18:27 +08:00
|
|
|
{// check the (2) above next as this is more expensive.
|
2008-02-05 14:38:12 +08:00
|
|
|
// Try prepending "**/" to see if that results in a match
|
|
|
|
FileSet fs = Util.createFileSet(dir,"**/"+fileMask);
|
|
|
|
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
|
|
|
|
if(ds.getIncludedFilesCount()!=0) {
|
|
|
|
// try shorter name first so that the suggestion results in least amount of changes
|
|
|
|
String[] names = ds.getIncludedFiles();
|
|
|
|
Arrays.sort(names,SHORTER_STRING_FIRST);
|
|
|
|
for( String f : names) {
|
|
|
|
// now we want to decompose f to the leading portion that matched "**"
|
|
|
|
// and the trailing portion that matched the file mask, so that
|
|
|
|
// we can suggest the user error.
|
|
|
|
//
|
|
|
|
// this is not a very efficient/clever way to do it, but it's relatively simple
|
|
|
|
|
|
|
|
String prefix="";
|
|
|
|
while(true) {
|
|
|
|
int idx = findSeparator(f);
|
|
|
|
if(idx==-1) break;
|
|
|
|
|
|
|
|
prefix+=f.substring(0,idx)+'/';
|
|
|
|
f=f.substring(idx+1);
|
|
|
|
if(hasMatch(dir,prefix+fileMask))
|
|
|
|
return Messages.FilePath_validateAntFileMask_doesntMatchAndSuggest(fileMask, prefix+fileMask);
|
|
|
|
}
|
|
|
|
}
|
2007-04-08 03:54:56 +08:00
|
|
|
}
|
2008-02-05 14:38:12 +08:00
|
|
|
}
|
2007-03-24 09:06:51 +08:00
|
|
|
|
2008-02-05 14:38:12 +08:00
|
|
|
{// finally, see if we can identify any sub portion that's valid. Otherwise bail out
|
|
|
|
String previous = null;
|
|
|
|
String pattern = fileMask;
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
if(hasMatch(dir,pattern)) {
|
|
|
|
// found a match
|
|
|
|
if(previous==null)
|
2009-07-11 06:19:09 +08:00
|
|
|
return Messages.FilePath_validateAntFileMask_portionMatchAndSuggest(fileMask,pattern);
|
2008-02-05 14:38:12 +08:00
|
|
|
else
|
2009-07-11 06:19:09 +08:00
|
|
|
return Messages.FilePath_validateAntFileMask_portionMatchButPreviousNotMatchAndSuggest(fileMask,pattern,previous);
|
2008-02-05 14:38:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int idx = findSeparator(pattern);
|
|
|
|
if(idx<0) {// no more path component left to go back
|
|
|
|
if(pattern.equals(fileMask))
|
2009-07-11 06:17:23 +08:00
|
|
|
return Messages.FilePath_validateAntFileMask_doesntMatchAnything(fileMask);
|
2008-02-05 14:38:12 +08:00
|
|
|
else
|
2009-07-11 06:19:09 +08:00
|
|
|
return Messages.FilePath_validateAntFileMask_doesntMatchAnythingAndSuggest(fileMask,pattern);
|
2008-02-05 14:38:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// cut off the trailing component and try again
|
|
|
|
previous = pattern;
|
|
|
|
pattern = pattern.substring(0,idx);
|
|
|
|
}
|
2007-04-08 03:54:56 +08:00
|
|
|
}
|
2007-03-24 09:06:51 +08:00
|
|
|
}
|
2007-04-08 03:54:56 +08:00
|
|
|
|
|
|
|
return null; // no error
|
2007-03-24 09:06:51 +08:00
|
|
|
}
|
2008-02-05 14:38:12 +08:00
|
|
|
|
|
|
|
private boolean hasMatch(File dir, String pattern) {
|
|
|
|
FileSet fs = Util.createFileSet(dir,pattern);
|
|
|
|
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
|
|
|
|
|
|
|
|
return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds the position of the first path separator.
|
|
|
|
*/
|
|
|
|
private int findSeparator(String pattern) {
|
|
|
|
int idx1 = pattern.indexOf('\\');
|
|
|
|
int idx2 = pattern.indexOf('/');
|
|
|
|
if(idx1==-1) return idx2;
|
|
|
|
if(idx2==-1) return idx1;
|
|
|
|
return Math.min(idx1,idx2);
|
|
|
|
}
|
2007-03-24 09:06:51 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-03-23 11:26:55 +08:00
|
|
|
/**
|
|
|
|
* Shortcut for {@link #validateFileMask(String)} in case the left-hand side can be null.
|
|
|
|
*/
|
|
|
|
public static FormValidation validateFileMask(FilePath pathOrNull, String value) throws IOException {
|
|
|
|
if(pathOrNull==null) return FormValidation.ok();
|
|
|
|
return pathOrNull.validateFileMask(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Short for {@code validateFileMask(value,true)}
|
|
|
|
*/
|
|
|
|
public FormValidation validateFileMask(String value) throws IOException {
|
|
|
|
return validateFileMask(value,true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-09-23 07:18:27 +08:00
|
|
|
* Checks the GLOB-style file mask. See {@link #validateAntFileMask(String)}.
|
2011-02-16 08:38:50 +08:00
|
|
|
* Requires configure permission on ancestor AbstractProject object in request,
|
|
|
|
* or admin permission if no such ancestor is found.
|
2009-03-23 11:26:55 +08:00
|
|
|
* @since 1.294
|
|
|
|
*/
|
|
|
|
public FormValidation validateFileMask(String value, boolean errorIfNotExist) throws IOException {
|
2011-02-16 08:38:50 +08:00
|
|
|
checkPermissionForValidate();
|
2009-09-23 07:18:27 +08:00
|
|
|
|
2009-03-23 11:26:55 +08:00
|
|
|
value = fixEmpty(value);
|
|
|
|
if(value==null)
|
|
|
|
return FormValidation.ok();
|
|
|
|
|
|
|
|
try {
|
|
|
|
if(!exists()) // no workspace. can't check
|
|
|
|
return FormValidation.ok();
|
|
|
|
|
|
|
|
String msg = validateAntFileMask(value);
|
|
|
|
if(errorIfNotExist) return FormValidation.error(msg);
|
|
|
|
else return FormValidation.warning(msg);
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
return FormValidation.ok();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validates a relative file path from this {@link FilePath}.
|
2011-02-16 08:38:50 +08:00
|
|
|
* Requires configure permission on ancestor AbstractProject object in request,
|
|
|
|
* or admin permission if no such ancestor is found.
|
2009-03-23 11:26:55 +08:00
|
|
|
*
|
|
|
|
* @param value
|
|
|
|
* The relative path being validated.
|
|
|
|
* @param errorIfNotExist
|
|
|
|
* If true, report an error if the given relative path doesn't exist. Otherwise it's a warning.
|
|
|
|
* @param expectingFile
|
|
|
|
* If true, we expect the relative path to point to a file.
|
|
|
|
* Otherwise, the relative path is expected to be pointing to a directory.
|
|
|
|
*/
|
|
|
|
public FormValidation validateRelativePath(String value, boolean errorIfNotExist, boolean expectingFile) throws IOException {
|
2011-02-16 08:38:50 +08:00
|
|
|
checkPermissionForValidate();
|
2009-03-23 11:26:55 +08:00
|
|
|
|
|
|
|
value = fixEmpty(value);
|
|
|
|
|
|
|
|
// none entered yet, or something is seriously wrong
|
2011-02-06 08:21:57 +08:00
|
|
|
if(value==null) return FormValidation.ok();
|
2009-03-23 11:26:55 +08:00
|
|
|
|
|
|
|
// a common mistake is to use wildcard
|
2009-07-11 06:17:23 +08:00
|
|
|
if(value.contains("*")) return FormValidation.error(Messages.FilePath_validateRelativePath_wildcardNotAllowed());
|
2009-03-23 11:26:55 +08:00
|
|
|
|
|
|
|
try {
|
|
|
|
if(!exists()) // no base directory. can't check
|
|
|
|
return FormValidation.ok();
|
|
|
|
|
|
|
|
FilePath path = child(value);
|
|
|
|
if(path.exists()) {
|
|
|
|
if (expectingFile) {
|
|
|
|
if(!path.isDirectory())
|
|
|
|
return FormValidation.ok();
|
|
|
|
else
|
2009-07-11 06:17:23 +08:00
|
|
|
return FormValidation.error(Messages.FilePath_validateRelativePath_notFile(value));
|
2009-03-23 11:26:55 +08:00
|
|
|
} else {
|
|
|
|
if(path.isDirectory())
|
|
|
|
return FormValidation.ok();
|
|
|
|
else
|
2009-07-11 06:17:23 +08:00
|
|
|
return FormValidation.error(Messages.FilePath_validateRelativePath_notDirectory(value));
|
2009-03-23 11:26:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-11 06:17:23 +08:00
|
|
|
String msg = expectingFile ? Messages.FilePath_validateRelativePath_noSuchFile(value) :
|
|
|
|
Messages.FilePath_validateRelativePath_noSuchDirectory(value);
|
2009-03-23 11:26:55 +08:00
|
|
|
if(errorIfNotExist) return FormValidation.error(msg);
|
|
|
|
else return FormValidation.warning(msg);
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
return FormValidation.ok();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-16 08:38:50 +08:00
|
|
|
private static void checkPermissionForValidate() {
|
|
|
|
AccessControlled subject = Stapler.getCurrentRequest().findAncestorObject(AbstractProject.class);
|
|
|
|
if (subject == null)
|
2011-05-29 01:11:48 +08:00
|
|
|
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
|
2011-02-16 08:38:50 +08:00
|
|
|
else
|
|
|
|
subject.checkPermission(Item.CONFIGURE);
|
|
|
|
}
|
|
|
|
|
2009-03-23 11:26:55 +08:00
|
|
|
/**
|
|
|
|
* A convenience method over {@link #validateRelativePath(String, boolean, boolean)}.
|
|
|
|
*/
|
|
|
|
public FormValidation validateRelativeDirectory(String value, boolean errorIfNotExist) throws IOException {
|
|
|
|
return validateRelativePath(value,errorIfNotExist,false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public FormValidation validateRelativeDirectory(String value) throws IOException {
|
|
|
|
return validateRelativeDirectory(value,true);
|
|
|
|
}
|
|
|
|
|
2009-09-15 03:10:57 +08:00
|
|
|
@Deprecated @Override
|
2006-11-06 05:16:01 +08:00
|
|
|
public String toString() {
|
|
|
|
// to make writing JSPs easily, return local
|
2006-12-30 03:15:53 +08:00
|
|
|
return remote;
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
public VirtualChannel getChannel() {
|
|
|
|
if(channel!=null) return channel;
|
2011-05-29 01:11:48 +08:00
|
|
|
else return Jenkins.MasterComputer.localChannel;
|
2006-12-30 03:15:53 +08:00
|
|
|
}
|
|
|
|
|
2007-04-09 03:30:40 +08:00
|
|
|
/**
|
|
|
|
* Returns true if this {@link FilePath} represents a remote file.
|
|
|
|
*/
|
|
|
|
public boolean isRemote() {
|
2007-04-10 06:39:15 +08:00
|
|
|
return channel!=null;
|
2007-04-09 03:30:40 +08:00
|
|
|
}
|
|
|
|
|
2006-12-30 03:15:53 +08:00
|
|
|
private void writeObject(ObjectOutputStream oos) throws IOException {
|
|
|
|
Channel target = Channel.current();
|
|
|
|
|
|
|
|
if(channel!=null && channel!=target)
|
|
|
|
throw new IllegalStateException("Can't send a remote FilePath to a different remote channel");
|
|
|
|
|
|
|
|
oos.defaultWriteObject();
|
|
|
|
oos.writeBoolean(channel==null);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
|
|
|
Channel channel = Channel.current();
|
|
|
|
assert channel!=null;
|
|
|
|
|
|
|
|
ois.defaultReadObject();
|
|
|
|
if(ois.readBoolean()) {
|
|
|
|
this.channel = channel;
|
|
|
|
} else {
|
|
|
|
this.channel = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
2007-04-06 22:19:15 +08:00
|
|
|
|
2008-11-06 03:16:45 +08:00
|
|
|
public static int SIDE_BUFFER_SIZE = 1024;
|
|
|
|
|
2010-12-14 05:21:55 +08:00
|
|
|
private static final Logger LOGGER = Logger.getLogger(FilePath.class.getName());
|
|
|
|
|
2007-04-06 22:19:15 +08:00
|
|
|
/**
|
|
|
|
* Adapts {@link FileCallable} to {@link Callable}.
|
|
|
|
*/
|
|
|
|
private class FileCallableWrapper<T> implements DelegatingCallable<T,IOException> {
|
|
|
|
private final FileCallable<T> callable;
|
2009-06-09 09:19:04 +08:00
|
|
|
private transient ClassLoader classLoader;
|
2007-04-06 22:19:15 +08:00
|
|
|
|
|
|
|
public FileCallableWrapper(FileCallable<T> callable) {
|
|
|
|
this.callable = callable;
|
2009-06-09 09:19:04 +08:00
|
|
|
this.classLoader = callable.getClass().getClassLoader();
|
|
|
|
}
|
|
|
|
|
|
|
|
private FileCallableWrapper(FileCallable<T> callable, ClassLoader classLoader) {
|
|
|
|
this.callable = callable;
|
|
|
|
this.classLoader = classLoader;
|
2007-04-06 22:19:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public T call() throws IOException {
|
2010-01-27 10:31:39 +08:00
|
|
|
try {
|
|
|
|
return callable.invoke(new File(remote), Channel.current());
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
throw new TunneledInterruptedException(e);
|
|
|
|
}
|
2007-04-06 22:19:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public ClassLoader getClassLoader() {
|
2009-06-09 09:19:04 +08:00
|
|
|
return classLoader;
|
2007-04-06 22:19:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
}
|
2008-02-05 14:38:12 +08:00
|
|
|
|
2010-01-27 10:31:39 +08:00
|
|
|
/**
|
|
|
|
* Used to tunnel {@link InterruptedException} over a Java signature that only allows {@link IOException}
|
|
|
|
*/
|
|
|
|
private static class TunneledInterruptedException extends IOException2 {
|
|
|
|
private TunneledInterruptedException(InterruptedException cause) {
|
|
|
|
super(cause);
|
|
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
}
|
|
|
|
|
2008-02-05 14:38:12 +08:00
|
|
|
private static final Comparator<String> SHORTER_STRING_FIRST = new Comparator<String>() {
|
|
|
|
public int compare(String o1, String o2) {
|
|
|
|
return o1.length()-o2.length();
|
|
|
|
}
|
|
|
|
};
|
2012-03-10 10:25:40 +08:00
|
|
|
|
|
|
|
private static final Field LINKFLAG_FIELD = getTarEntryLinkFlagField();
|
|
|
|
|
|
|
|
private static Field getTarEntryLinkFlagField() {
|
|
|
|
try {
|
|
|
|
Field f = TarEntry.class.getDeclaredField("linkFlag");
|
|
|
|
f.setAccessible(true);
|
|
|
|
return f;
|
|
|
|
} catch (SecurityException e) {
|
|
|
|
throw new AssertionError(e);
|
|
|
|
} catch (NoSuchFieldException e) {
|
|
|
|
throw new AssertionError(e);
|
|
|
|
}
|
|
|
|
}
|
2006-11-06 05:16:01 +08:00
|
|
|
}
|