Skip to content
Permalink
Browse files

Revert "Merge pull request #2007 from amuniz/JENKINS-27268"

This reverts commit 84b3a20, reversing
changes made to be2787a.
  • Loading branch information
kohsuke committed Feb 13, 2016
1 parent 84b3a20 commit 75715398f2be09b77989bd7ee2a9455e9a22f45d
Showing 392 changed files with 2,568 additions and 467 deletions.
@@ -63,7 +63,7 @@
*
* <p>
* In Jenkins, often we need to build up "environment variable overrides"
* on master, then to execute the process on agents. This causes a problem
* on master, then to execute the process on slaves. This causes a problem
* when working with variables like <tt>PATH</tt>. So to make this work,
* we introduce a special convention <tt>PATH+FOO</tt> &mdash; all entries
* that starts with <tt>PATH+</tt> are merged and prepended to the inherited
@@ -134,7 +134,7 @@ public void override(String key, String value) {
String v = get(realKey);
if(v==null) v=value;
else {
// we might be handling environment variables for a agent that can have different path separator
// we might be handling environment variables for a slave that can have different path separator
// than the master, so the following is an attempt to get it right.
// it's still more error prone that I'd like.
char ch = platform==null ? File.pathSeparatorChar : platform.pathSeparator;
@@ -421,8 +421,8 @@ public EnvVars call() {
* variables only when you access this from the master.
*
* <p>
* If you access this field from agents, then this is the environment
* variable of the agent agent.
* If you access this field from slaves, then this is the environment
* variable of the slave agent.
*/
public static final Map<String,String> masterEnvVars = initMaster();

@@ -127,7 +127,7 @@
*
* <p>
* Unlike {@link File}, which always implies a file path on the current computer,
* {@link FilePath} represents a file path on a specific agent or the master.
* {@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
@@ -191,19 +191,19 @@
/**
* When this {@link FilePath} represents the remote path,
* this field is always non-null on master (the field represents
* the channel to the remote agent.) When transferred to a agent via remoting,
* 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 agent via remoting,
* 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 agent.
* This is used to determine whether we are running on the master or the slave.
*/
private transient VirtualChannel channel;

// since the platform of the agent might be different, can't use java.io.File
// since the platform of the slave might be different, can't use java.io.File
private final String remote;

/**
@@ -259,7 +259,7 @@ private String resolvePathIfRelative(FilePath base, String rel) {
return base.remote+'/'+rel.replace('\\','/');
} else {
// need this replace, see Slave.getWorkspaceFor and AbstractItem.getFullName, nested jobs on Windows
// agents will always have a rel containing at least one '/' character. JENKINS-13649
// slaves will always have a rel containing at least one '/' character. JENKINS-13649
return base.remote+'\\'+rel.replace('/','\\');
}
}
@@ -802,14 +802,14 @@ public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskLi
listener.getLogger().println(message);

if (isRemote()) {
// First try to download from the agent machine.
// First try to download from the slave machine.
try {
act(new Unpack(archive));
timestamp.touch(sourceTimestamp);
return true;
} catch (IOException x) {
if (listener != null) {
x.printStackTrace(listener.error("Failed to download " + archive + " from agent; will retry from master"));
x.printStackTrace(listener.error("Failed to download " + archive + " from slave; will retry from master"));
}
}
}
@@ -51,7 +51,7 @@
* STILL A WORK IN PROGRESS. SUBJECT TO CHANGE! DO NOT EXTEND.
*
* TODO: is this per {@link Computer}? Per {@link Job}?
* -> probably per agent.
* -> probably per slave.
*
* <h2>Design Problems</h2>
* <ol>
@@ -71,7 +71,7 @@
* one more configuration option. It's especially tricky because
* during the configuration we don't know the OS type.
*
* OTOH special agent type like the ones for network.com grid can
* OTOH special slave type like the ones for network.com grid can
* hide this.
* </ol>
*
@@ -80,8 +80,8 @@
*
* To recap,
*
* - when an agent connects, we auto-detect the file system provisioner.
* (for example, ZFS FSP would check the agent root user prop
* - when a slave connects, we auto-detect the file system provisioner.
* (for example, ZFS FSP would check the slave root user prop
* and/or attempt to "pfexec zfs create" and take over.)
*
* - the user may configure jobs for snapshot collection, along with
@@ -38,9 +38,9 @@
* Called to clean up a workspace that may potentially belong to this {@link FileSystemProvisioner}.
*
* <p>
* Because users may modify the file system behind Hudson, and agents may come and go when
* Because users may modify the file system behind Hudson, and slaves may come and go when
* configuration changes happen, in general case Hudson is unable to keep track of which jobs
* have workspaces in which agents.
* have workspaces in which slaves.
*
* <p>
* So instead we rey on a garbage collection mechanism, to look at workspaces left in the file system
@@ -1575,7 +1575,7 @@ public String getSystemProperty(String key) {
* Obtains the host name of the Hudson server that clients can use to talk back to.
* <p>
* This is primarily used in <tt>slave-agent.jnlp.jelly</tt> to specify the destination
* that the agents talk to.
* that the slaves talk to.
*/
public String getServerName() {
// Try to infer this from the configured root URL.
@@ -297,7 +297,7 @@ public InputStream stdin() {
*
* <p>
* In adition to what the current process
* is inherited (if this is going to be launched from a agent agent, that
* is inherited (if this is going to be launched from a slave agent, that
* becomes the "current" process), these variables will be also set.
*/
public ProcStarter envs(Map<String, String> overrides) {
@@ -611,7 +611,7 @@ public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, O
* from the current process
* @param envVars
* Environment variable overrides. In addition to what the current process
* is inherited (if this is going to be launched from an agent, that
* is inherited (if this is going to be launched from a slave agent, that
* becomes the "current" process), these variables will be also set.
*/
public abstract Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String,String> envVars) throws IOException, InterruptedException;
@@ -215,7 +215,7 @@ public static ProxyConfiguration load() throws IOException {
* This method should be used wherever {@link URL#openConnection()} to internet URLs is invoked directly.
*/
public static URLConnection open(URL url) throws IOException {
Jenkins h = Jenkins.getInstance(); // this code might run on agents
Jenkins h = Jenkins.getInstance(); // this code might run on slaves
ProxyConfiguration p = h!=null ? h.proxy : null;
if(p==null)
return url.openConnection();
@@ -241,7 +241,7 @@ public PasswordAuthentication getPasswordAuthentication() {
}

public static InputStream getInputStream(URL url) throws IOException {
Jenkins h = Jenkins.getInstance(); // this code might run on agents
Jenkins h = Jenkins.getInstance(); // this code might run on slaves
final ProxyConfiguration p = (h != null) ? h.proxy : null;
if (p == null)
return new RetryableHttpStream(url);
@@ -39,11 +39,11 @@
import java.util.logging.Logger;

/**
* Listens to incoming TCP connections from JNLP agents and CLI.
* Listens to incoming TCP connections from JNLP slave agents and CLI.
*
* <p>
* Aside from the HTTP endpoint, Jenkins runs {@link TcpSlaveAgentListener} that listens on a TCP socket.
* Historically this was used for inbound connection from agents (hence the name), but over time
* Historically this was used for inbound connection from slave agents (hence the name), but over time
* it was extended and made generic, so that multiple protocols of different purposes can co-exist on the
* same socket.
*
@@ -66,7 +66,7 @@
* Use 0 to choose a random port.
*/
public TcpSlaveAgentListener(int port) throws IOException {
super("TCP agent listener port="+port);
super("TCP slave agent listener port="+port);
try {
serverSocket = ServerSocketChannel.open();
serverSocket.socket().bind(new InetSocketAddress(port));
@@ -75,7 +75,7 @@ public TcpSlaveAgentListener(int port) throws IOException {
}
this.configuredPort = port;

LOGGER.log(Level.FINE, "JNLP agent listener started on TCP port {0}", getPort());
LOGGER.log(Level.FINE, "JNLP slave agent listener started on TCP port {0}", getPort());

start();
}
@@ -105,7 +105,7 @@ public void run() {
}
} catch (IOException e) {
if(!shuttingDown) {
LOGGER.log(Level.SEVERE,"Failed to accept JNLP agent connections",e);
LOGGER.log(Level.SEVERE,"Failed to accept JNLP slave agent connections",e);
}
}
}
@@ -134,7 +134,7 @@ public ConnectionHandler(Socket s) {
synchronized(getClass()) {
id = iotaGen++;
}
setName("TCP agent connection handler #"+id+" with "+s.getRemoteSocketAddress());
setName("TCP slave agent connection handler #"+id+" with "+s.getRemoteSocketAddress());
}

@Override
@@ -40,7 +40,7 @@
@Extension
public class OnlineNodeCommand extends CLICommand {

@Argument(metaVar="NAME", usage="Agent name, or empty string for master")
@Argument(metaVar="NAME", usage="Slave name, or empty string for master")
public String computerName;

private static final Logger LOGGER = Logger.getLogger(OnlineNodeCommand.class.getName());
@@ -88,10 +88,10 @@ public OutputStream decorateLogger(Run build, OutputStream logger) throws IOExce
}

/**
* Called to decorate logger for master/agent communication.
* Called to decorate logger for master/slave communication.
*
* @param computer
* Agent computer for which the logger is getting decorated. Useful to do
* Slave computer for which the logger is getting decorated. Useful to do
* contextual decoration.
* @since 1.632
*/
@@ -208,7 +208,7 @@ public void disable() {
}

private static final class SetLevel extends MasterToSlaveCallable<Void,Error> {
/** known loggers (kept per agent), to avoid GC */
/** known loggers (kept per slave), to avoid GC */
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection") private static final Set<Logger> loggers = new HashSet<Logger>();
private final String name;
private final Level level;
@@ -363,7 +363,7 @@ private XmlFile getConfigFile() {
}

/**
* Gets a view of log records per agent matching this recorder.
* Gets a view of log records per slave matching this recorder.
* @return a map (sorted by display name) from computer to (nonempty) list of log records
* @since 1.519
*/
@@ -109,7 +109,7 @@
private static final boolean upstreamCulprits = Boolean.getBoolean("hudson.upstreamCulprits");

/**
* Name of the agent this project was built on.
* Name of the slave this project was built on.
* Null or "" if built by the master. (null happens when we read old record that didn't have this information.)
*/
private String builtOn;
@@ -205,7 +205,7 @@ public R getNextBuild() {
* Returns a {@link Slave} on which this build was done.
*
* @return
* null, for example if the agent that this build run no longer exists.
* null, for example if the slave that this build run no longer exists.
*/
public @CheckForNull Node getBuiltOn() {
if (builtOn==null || builtOn.equals(""))
@@ -215,7 +215,7 @@ public R getNextBuild() {
}

/**
* Returns the name of the agent it was built on; null or "" if built by the master.
* Returns the name of the slave it was built on; null or "" if built by the master.
* (null happens when we read old record that didn't have this information.)
*/
@Exported(name="builtOn")
@@ -276,7 +276,7 @@ public String getUpUrl() {
* {@link AbstractBuildExecution#decideWorkspace(Node,WorkspaceList)}.
*
* @return
* null if the workspace is on an agent that's not connected. Note that once the build is completed,
* null if the workspace is on a slave that's not connected. Note that once the build is completed,
* the workspace may be used to build something else, so the value returned from this method may
* no longer show a workspace as it was used for this build.
* @since 1.319
@@ -808,7 +808,7 @@ protected final boolean perform(BuildStep bs, BuildListener listener) throws Int

private void reportBrokenChannel(BuildListener listener) throws IOException {
final Node node = getCurrentNode();
listener.hyperlink("/" + node.toComputer().getUrl() + "log", "Agent went offline during the build");
listener.hyperlink("/" + node.toComputer().getUrl() + "log", "Slave went offline during the build");
listener.getLogger().println();
final OfflineCause offlineCause = node.toComputer().getOfflineCause();
if (offlineCause != null) {
@@ -269,7 +269,7 @@ protected AbstractProject(ItemGroup parent, String name) {
final Jenkins j = Jenkins.getInstance();
final List<Node> nodes = j != null ? j.getNodes() : null;
if(nodes!=null && !nodes.isEmpty()) {
// if a new job is configured with Hudson that already has agent nodes
// if a new job is configured with Hudson that already has slave nodes
// make it roamable by default
canRoam = true;
}
@@ -408,7 +408,7 @@ public void setConcurrentBuild(boolean b) throws IOException {
/**
* Set of labels relevant to this job.
*
* This method is used to determine what agents are relevant to jobs, for example by {@link View}s.
* This method is used to determine what slaves are relevant to jobs, for example by {@link View}s.
* It does not affect the scheduling. This information is informational and the best-effort basis.
*
* @since 1.456
@@ -501,7 +501,7 @@ public String getBuildNowText() {
* Gets the directory where the module is checked out.
*
* @return
* null if the workspace is on an agent that's not connected.
* null if the workspace is on a slave that's not connected.
* @deprecated as of 1.319
* To support concurrent builds of the same project, this method is moved to {@link AbstractBuild}.
* For backward compatibility, this method returns the right {@link AbstractBuild#getWorkspace()} if called
@@ -1395,7 +1395,7 @@ private PollingResult _poll(TaskListener listener, SCM scm) throws IOException,
// At this point we start thinking about triggering a build just to get a workspace,
// because otherwise there's no way we can detect changes.
// However, first there are some conditions in which we do not want to do so.
// give time for agents to come online if we are right after reconnection (JENKINS-8408)
// give time for slaves to come online if we are right after reconnection (JENKINS-8408)
long running = Jenkins.getInstance().getInjector().getInstance(Uptime.class).getUptime();
long remaining = TimeUnit2.MINUTES.toMillis(10)-running;
if (remaining>0 && /* this logic breaks tests of polling */!Functions.getIsUnitTest()) {
@@ -1404,7 +1404,7 @@ private PollingResult _poll(TaskListener listener, SCM scm) throws IOException,
return NO_CHANGES;
}

// Do not trigger build, if no suitable agent is online
// Do not trigger build, if no suitable slave is online
if (workspaceOfflineReason.equals(WorkspaceOfflineReason.all_suitable_nodes_are_offline)) {
// No suitable executor is online
listener.getLogger().print(Messages.AbstractProject_AwaitingWorkspaceToComeOnline(running/1000));
@@ -1415,7 +1415,7 @@ private PollingResult _poll(TaskListener listener, SCM scm) throws IOException,
Label label = getAssignedLabel();
if (label != null && label.isSelfLabel()) {
// if the build is fixed on a node, then attempting a build will do us
// no good. We should just wait for the agent to come back.
// no good. We should just wait for the slave to come back.
listener.getLogger().print(Messages.AbstractProject_NoWorkspace());
listener.getLogger().println( " (" + workspaceOfflineReason.name() + ")");
return NO_CHANGES;

0 comments on commit 7571539

Please sign in to comment.
You can’t perform that action at this time.