From e6fdc19cf9174390386a98935ff1d7cf81dbe82f Mon Sep 17 00:00:00 2001 From: Stephen Connolly Date: Mon, 16 Mar 2015 12:36:04 +0000 Subject: [PATCH] [JENKINS-27058] Clarify that remoteFS can be relative if you know what you are doing - Get the absolute path on connect and use that while the connection is on-line (which is ok as when the connection is not online a null was returned from getRootPath() anyway) --- core/src/main/java/hudson/model/Slave.java | 50 ++++++++++------ .../java/hudson/slaves/CommandLauncher.java | 23 ++++---- .../java/hudson/slaves/SlaveComputer.java | 59 ++++++++++++++----- .../hudson/model/Messages.properties | 4 +- 4 files changed, 90 insertions(+), 46 deletions(-) diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 92ac16518d..6d32b29e94 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -1,19 +1,19 @@ /* * The MIT License - * + * * Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, * Erik Ramfelt, Martin Eigenbrodt, Stephen Connolly, Tom Huybrechts - * + * * 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 @@ -63,6 +63,7 @@ import jenkins.security.MasterToSlaveCallable; import jenkins.slaves.WorkspaceLocator; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; @@ -92,8 +93,12 @@ public abstract class Slave extends Node implements Serializable { private final String description; /** - * Absolute path to the root of the workspace - * from the view point of this node, such as "/hudson" + * Path to the root of the workspace from the view point of this node, such as "/hudson", this need not + * be absolute provided that the launcher establishes a consistent working directory, such as "./.jenkins-slave" + * when used with an SSH launcher. + * + * NOTE: if the administrator is using a relative path they are responsible for ensuring that the launcher used + * provides a consistent working directory */ protected final String remoteFS; @@ -121,14 +126,14 @@ public abstract class Slave extends Node implements Serializable { * Whitespace-separated labels. */ private String label=""; - + private /*almost final*/ DescribableList,NodePropertyDescriptor> nodeProperties = new DescribableList,NodePropertyDescriptor>(Jenkins.getInstance()); /** * Lazily computed set of labels from {@link #label}. */ private transient volatile Set