提交 b6abcee1 编写于 作者: J Jesse Glick

Close; have not yet cut a 1.0, pending HOSTING-442.

上级 3a781f5a
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.34</version>
<relativePath />
</parent>
<artifactId>command-launcher</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<jenkins.version>2.86-SNAPSHOT</jenkins.version> <!-- TODO pending split -->
<java.level>8</java.level>
</properties>
<name>Command Agent Launcher Plugin</name>
<description>Allows agents to be launched using a specified command.</description>
<url>https://wiki.jenkins.io/display/JENKINS/Command+Agent+Launcher+Plugin</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<!-- TODO after split
<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
</scm>
-->
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.18.1</version>
</dependency>
</dependencies>
</project>
/*
* The MIT License
*
* Copyright (c) 2010, InfraDNA, Inc.
*
* 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.
*/
package hudson.slaves;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Util;
import hudson.model.TaskListener;
import hudson.util.FormValidation;
import java.io.IOException;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.command_launcher.Messages;
import org.jenkinsci.plugins.command_launcher.SystemCommandLanguage;
import org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
/**
* Executes a program on the master and expect that script to connect.
*
* @author Kohsuke Kawaguchi
*/
public class CommandConnector extends ComputerConnector {
public final String command;
@DataBoundConstructor
public CommandConnector(String command) {
this.command = command;
// TODO add withKey if we can determine the Cloud.name being configured
ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser());
}
private Object readResolve() {
ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create());
return this;
}
@Override
public CommandLauncher launch(String host, TaskListener listener) throws IOException, InterruptedException {
// no need to call ScriptApproval.using here; CommandLauncher.launch will do that
return new CommandLauncher(new EnvVars("SLAVE", host), command);
}
@Extension @Symbol("command")
public static class DescriptorImpl extends ComputerConnectorDescriptor {
@Override
public String getDisplayName() {
return Messages.CommandLauncher_displayName();
}
public FormValidation doCheckCommand(@QueryParameter String value) {
if (Util.fixEmptyAndTrim(value) == null) {
return FormValidation.error(Messages.CommandLauncher_NoLaunchCommand());
} else {
return ScriptApproval.get().checking(value, SystemCommandLanguage.get());
}
}
}
}
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Stephen Connolly
*
* 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.
*/
package hudson.slaves;
import hudson.AbortException;
import hudson.EnvVars;
import hudson.Util;
import hudson.Extension;
import hudson.Functions;
import hudson.model.Descriptor;
import hudson.model.Slave;
import jenkins.model.Jenkins;
import hudson.model.TaskListener;
import hudson.remoting.Channel;
import hudson.util.StreamCopyThread;
import hudson.util.FormValidation;
import hudson.util.ProcessTree;
import java.io.IOException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.command_launcher.SystemCommandLanguage;
import org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
import org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
/**
* {@link ComputerLauncher} through a remote login mechanism like ssh/rsh.
*
* @author Stephen Connolly
* @author Kohsuke Kawaguchi
*/
public class CommandLauncher extends ComputerLauncher {
/**
* Command line to launch the agent, like
* "ssh myslave java -jar /path/to/hudson-remoting.jar"
*/
private final String agentCommand;
/**
* Optional environment variables to add to the current environment. Can be null.
*/
private final EnvVars env;
/** Constructor for use from UI. Conditionally approves the script. */
@DataBoundConstructor
public CommandLauncher(String command) {
agentCommand = command;
env = null;
// TODO add withKey if we can determine the Slave.nodeName being configured
ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser());
}
/** Constructor for programmatic use. Always approves the script. */
public CommandLauncher(String command, EnvVars env) {
this.agentCommand = command;
this.env = env;
ScriptApproval.get().preapprove(command, SystemCommandLanguage.get());
}
/** Constructor for use from {@link CommandConnector}. Never approves the script. */
CommandLauncher(EnvVars env, String command) {
this.agentCommand = command;
this.env = env;
}
private Object readResolve() {
ScriptApproval.get().configuring(agentCommand, SystemCommandLanguage.get(), ApprovalContext.create());
return this;
}
public String getCommand() {
return agentCommand;
}
/**
* Gets the formatted current time stamp.
*/
private static String getTimestamp() {
return String.format("[%1$tD %1$tT]", new Date());
}
@Override
public void launch(SlaveComputer computer, final TaskListener listener) {
EnvVars _cookie = null;
Process _proc = null;
try {
Slave node = computer.getNode();
if (node == null) {
throw new AbortException("Cannot launch commands on deleted nodes");
}
listener.getLogger().println(org.jenkinsci.plugins.command_launcher.Messages.Slave_Launching(getTimestamp()));
String command = ScriptApproval.get().using(getCommand(), SystemCommandLanguage.get());
if (command.trim().length() == 0) {
listener.getLogger().println(org.jenkinsci.plugins.command_launcher.Messages.CommandLauncher_NoLaunchCommand());
return;
}
listener.getLogger().println("$ " + command);
ProcessBuilder pb = new ProcessBuilder(Util.tokenize(command));
final EnvVars cookie = _cookie = EnvVars.createCookie();
pb.environment().putAll(cookie);
pb.environment().put("WORKSPACE", StringUtils.defaultString(computer.getAbsoluteRemoteFs(), node.getRemoteFS())); //path for local slave log
{// system defined variables
String rootUrl = Jenkins.getInstance().getRootUrl();
if (rootUrl!=null) {
pb.environment().put("HUDSON_URL", rootUrl); // for backward compatibility
pb.environment().put("JENKINS_URL", rootUrl);
pb.environment().put("SLAVEJAR_URL", rootUrl+"/jnlpJars/agent.jar");
pb.environment().put("AGENTJAR_URL", rootUrl+"/jnlpJars/agent.jar");
}
}
if (env != null) {
pb.environment().putAll(env);
}
final Process proc = _proc = pb.start();
// capture error information from stderr. this will terminate itself
// when the process is killed.
new StreamCopyThread("stderr copier for remote agent on " + computer.getDisplayName(),
proc.getErrorStream(), listener.getLogger()).start();
computer.setChannel(proc.getInputStream(), proc.getOutputStream(), listener.getLogger(), new Channel.Listener() {
@Override
public void onClosed(Channel channel, IOException cause) {
reportProcessTerminated(proc, listener);
try {
ProcessTree.get().killAll(proc, cookie);
} catch (InterruptedException e) {
LOGGER.log(Level.INFO, "interrupted", e);
}
}
});
LOGGER.info("agent launched for " + computer.getDisplayName());
} catch (InterruptedException e) {
Functions.printStackTrace(e, listener.error(Messages.ComputerLauncher_abortedLaunch()));
} catch (UnapprovedUsageException e) {
listener.error(e.getMessage());
} catch (RuntimeException e) {
Functions.printStackTrace(e, listener.error(Messages.ComputerLauncher_unexpectedError()));
} catch (Error e) {
Functions.printStackTrace(e, listener.error(Messages.ComputerLauncher_unexpectedError()));
} catch (IOException e) {
Util.displayIOException(e, listener);
String msg = Util.getWin32ErrorMessage(e);
if (msg == null) {
msg = "";
} else {
msg = " : " + msg;
// FIXME TODO i18n what is this!?
}
msg = org.jenkinsci.plugins.command_launcher.Messages.Slave_UnableToLaunch(computer.getDisplayName(), msg);
LOGGER.log(Level.SEVERE, msg, e);
Functions.printStackTrace(e, listener.error(msg));
if(_proc!=null) {
reportProcessTerminated(_proc, listener);
try {
ProcessTree.get().killAll(_proc, _cookie);
} catch (InterruptedException x) {
Functions.printStackTrace(x, listener.error(Messages.ComputerLauncher_abortedLaunch()));
}
}
}
}
private static void reportProcessTerminated(Process proc, TaskListener listener) {
try {
int exitCode = proc.exitValue();
listener.error("Process terminated with exit code " + exitCode);
} catch (IllegalThreadStateException e) {
// hasn't terminated yet
}
}
private static final Logger LOGGER = Logger.getLogger(CommandLauncher.class.getName());
@Extension @Symbol("command")
public static class DescriptorImpl extends Descriptor<ComputerLauncher> {
public String getDisplayName() {
return org.jenkinsci.plugins.command_launcher.Messages.CommandLauncher_displayName();
}
public FormValidation doCheckCommand(@QueryParameter String value) {
if(Util.fixEmptyAndTrim(value)==null)
return FormValidation.error(org.jenkinsci.plugins.command_launcher.Messages.CommandLauncher_NoLaunchCommand());
else
return ScriptApproval.get().checking(value, SystemCommandLanguage.get());
}
}
}
/*
* The MIT License
*
* Copyright 2017 CloudBees, Inc.
*
* 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.
*/
package org.jenkinsci.plugins.command_launcher;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.Util;
import org.jenkinsci.plugins.scriptsecurity.scripts.Language;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
/**
* Language for launched processes, as per {@link Util#tokenize(String)} and {@link ProcessBuilder}.
*/
@Restricted(NoExternalUse.class) // TODO move to script-security after split
@Extension
public class SystemCommandLanguage extends Language {
public static Language get() {
return ExtensionList.lookup(Language.class).get(SystemCommandLanguage.class);
}
@Override
public String getName() {
return "system-command";
}
@Override
public String getDisplayName() {
return "System Commands";
}
}
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
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.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="${%Launch command}" field="command">
<f:textbox />
</f:entry>
</j:jelly>
\ No newline at end of file
# The MIT License
#
# Bulgarian translation: Copyright (c) 2016, Alexander Shopov <ash@kambanaria.org>
#
# 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.
Launch\ command=\
\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435
# The MIT License
#
# Copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributers
#
# 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.
Launch\ command=Startkommando
# The MIT License
#
# Copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributers
#
# 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.
Launch\ command=Comando a ejecutar para lanzar la tarea
# The MIT License
#
# Copyright (c) 2012, Seiji Sogabe
#
# 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.
Launch\ command=\u8d77\u52d5\u30b3\u30de\u30f3\u30c9
# The MIT License
#
# Copyright (c) 2004-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributers
#
# 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.
Launch\ command=Comando de lan\u00e7amento
# This file is under the MIT License by authors
Launch\ command=\u0418\u0437\u0432\u0440\u0448\u0438 \u043F\u0440\u043E\u0433\u0440\u0430\u043C
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2013, Chunghwa Telecom Co., Ltd., Pei-Tang Huang
#
# 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.
Launch\ command=\u555f\u52d5\u6307\u4ee4
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
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.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="${%Launch command}" field="command">
<f:textbox />
</f:entry>
</j:jelly>
\ No newline at end of file
# The MIT License
#
# Bulgarian translation: Copyright (c) 2016, Alexander Shopov <ash@kambanaria.org>
#
# 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.
Launch\ command=\
\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen.
#
# 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.
Launch\ command=Opstartskommando
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Simon Wiest
#
# 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.
Launch\ command=Startkommando
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# 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.
Launch\ command=Comando para iniciar la ejecución
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant
#
# 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.
Launch\ command=Commande de lancement
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# 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.
Launch\ command=\u8d77\u52d5\u30b3\u30de\u30f3\u30c9
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Reginaldo L. Russinholi, Cleiber Silva
#
# 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.
Launch\ command=Executar comando
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Mike Salnikov
#
# 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.
Launch\ command=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430
# This file is under the MIT License by authors
Launch\ command=\u041A\u043E\u043C\u0430\u043D\u0434\u0430 \u0437\u0430 \u043F\u043E\u043A\u0440\u0435\u0442\u0430\u045A\u0435
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# 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.
Launch\ command=Startkommando
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Oguz Dag
#
# 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.
Launch\ command=komutu \u00e7al\u0131\u015ft\u0131r
# The MIT License
#
# Copyright (c) 2013, Chunghwa Telecom Co., Ltd., Pei-Tang Huang
#
# 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.
Launch\ command=\u555f\u52d5\u6307\u4ee4
<div>
Command to be used to launch an agent program, which controls the agent
computer and communicates with the master. Jenkins assumes that
the executed program launches the <tt>agent.jar</tt> program on the correct
machine.
<p>
A copy of <tt>agent.jar</tt> can be downloaded from <a href="${rootURL}/jnlpJars/agent.jar"><tt>here</tt></a>.
<p>
In a simple case, this could be
something like "ssh <i>hostname</i> java -jar ~/bin/agent.jar".
However, it is often a good idea to write a small shell script, like the following, on an agent
so that you can control the location of Java and/or agent.jar, as well as set up any
environment variables specific to this node, such as PATH.
<pre>
#!/bin/sh
exec java -jar ~/bin/agent.jar
</pre>
<p>
You can use any command to run a process on the agent machine, such as RSH,
as long as stdin/stdout of this process will be connected to
"java -jar ~/bin/agent.jar" eventually.
<p>
In a larger deployment, it is also worth considering to load <tt>agent.jar</tt> from
a NFS-mounted common location, so that you don't have to update this file every time
you update Jenkins.
<p>
Setting this to "ssh -v <i>hostname</i>" may be useful for debugging connectivity
issue.
</div>
<div>
Команда за стартирането на агента, който управлява компютъра и комуникира
с управляващия компютър. Jenkins приема, че изпълнената програма ще
стартира <tt>agent.jar</tt> на правилната машина.
<p>
Може да изтеглите <tt>agent.jar</tt>
<a href="${rootURL}/jnlpJars/agent.jar"><tt>оттук</tt></a>.
<p>
В най-простия случай, това може да е команда като тази:
„ssh <i>hostname</i> java -jar ~/bin/agent.jar“.
Често е по-добре да напишете малък скрипт подобен на този отдолу, за да може да
настройвате местоположението на Java и/или agent.jar, както и да променяте
променливите на средата на машината, например „PATH“:
<pre>
#!/bin/sh
exec java -jar ~/bin/agent.jar
</pre>
<p>
Може да използвате произволна команда за стартирането на процеса на управляваната
машина, стига тя да е в състояние да изпълни „java -jar ~/bin/agent.jar“ като
остане свързана със стандартните вход и изход на този процес.
<p>
При по-големи инсталации може да зареждате <tt>agent.jar</tt> от споделен монтиран
ресурс, например NFS, така че да не се налага ръчно да обновявате файла при всяко
обновяване на Jenkins.
<p>
Ако имате проблеми със свързаността, може да ги изчистите по-лесно като зададете
командата да е „ssh -v <i>hostname</i>“.
</div>
<div>
La commande à utiliser pour lancer un agent esclave, qui contrôle la
machine-esclave et communique avec la machine-maître.
<h3>Les agents esclaves JNLP</h3>
<p>
Laissez ce champ vide si vous souhaitez lancer les esclaves par JNLP.
Avec cette configuration, la page d'information sur les esclaves
(jenkins/computer/***/) aura une icône de lancement JNLP. Vous pouvez
cliquer sur ce lien pour lancer un agent esclave par JNLP.
<p>
Ce mode est utile pour les esclaves Windows qui n'ont généralement pas
de mécanisme d'exécution à distance.
<h3>Les agents esclaves ssh/rsh</h3>
<p>
Quand une commande est spécifiée dans ce champ, elle est exécutée
sur le maître et Jenkins suppose que le programme exécuté lance le
programme <tt>agent.jar</tt> sur la bonne machine esclave.
<p>
Une copie du <tt>agent.jar</tt> peut être téléchargée
<a href="${rootURL}/jnlpJars/agent.jar"><tt>ici</tt></a>.
<p>
Pour un cas simple, cette commande pourrait être du type
"ssh <i>hostname</i> java -jar ~/bin/agent.jar".
Cela dit, il est généralement préférable d'écrire un petit script sur
l'esclave, comme celui qui suit, afin de gérer le répertoire
d'installation de Java et/ou de agent.jar. Vous pouvez aussi
positionner des variables d'environnement spécifiques à cette machine
esclave, comme le PATH.
<pre>
#!/bin/sh
exec java -jar ~/bin/agent.jar
</pre>
<p>
Vous pouvez utiliser n'importe quelle commande d'exécution d'un
process sur la machine-esclave, comme RSH, du moment que les
sorties stdin/stdout de ce process sont au final connectées
sur "java -jar ~/bin/agent.jar".
<p>
Dans un déploiement à plus grande échelle, on peut envisager de charger
<tt>agent.jar</tt> à partir d'une location commune montée par NFS, afin
de ne pas nécessiter la mise à jour de ce fichier à chaque mise à jour
de Jenkins.
<p>
Mettre la valeur "ssh -v <i>hostname</i>" dans ce champ peut être
utile pour débugger les problèmes de connexion.
</div>
<div>
スレーブエージェントとプログラムの起動に使用するコマンドで、スレーブのコンピュータの制御、
マスターとの通信を行います。
<p>
この項目にコマンドが指定されたとき、マスターでこのコマンドが実行されます。そして、
Jenkinsは、その実行コマンドが正しいスレーブマシーン上で<tt>agent.jar</tt>を起動することを想定しています。
<p>
<tt>agent.jar</tt>のコピーが、<tt>jenkins.war</tt>の中の<a href="${rootURL}/jnlpJars/agent.jar"><tt>WEB-INF/agent.jar</tt></a>にあります。
<p>
シンプルなケースでは、このコマンドは"ssh <i>hostname</i> java -jar ~/bin/agent.jar"のようなものになります。
しかし、PATHのようなこのスレーブノード独自の環境変数を設定するのと同時に、javaやagent.jarの場所を制御できるように、
スレーブに以下のような小さいシェルスクリプトを書くのはいい考えです。
<pre>
#!/bin/sh
exec java -jar ~/bin/agent.jar
</pre>
<p>
RSHのようなスレーブマシンでプロセスを起動できるようなコマンドを使用することができます。
ただし、プロセスの標準入出力が"java -jar ~/bin/agent.jar"を接続している必要があります。
<p>
スレーブがたくさん配置されている場合、NFSでマウントされた共通の場所から、
<tt>agent.jar</tt>をロードすることは考える価値があります。
そうすれば、Jenkinsを更新するごとにこのファイルを更新する必要がありません。
<p>
"ssh -v <i>ホスト名</i>"とすると、接続確認するのに便利です。
</div>
<div>
Команда, которая будет использована для запуска программы-агента на подчиненном узле. Эта
программа необходима для контроля подчиненного узла и обмена данными с мастером.
<p>
Когда в этом поле указана команда, она будет выполнена на мастере и Jenkins предполагает
что эта команда запустит <tt>agent.jar</tt> на соответствующем подчиненном узле.
<p>
Копию файла <tt>agent.jar</tt> вы можете загрузить по <a href="${rootURL}/jnlpJars/agent.jar">этой ссылке</a>.
<p>
В самом простом случае команда будет выглядеть приблизительно так:
"ssh <i>hostname</i> java -jar ~/bin/agent.jar"
Однако, обычно лучшей идеей будет написание простого shell скрипта, содержащего
указанную команду, чтобы вам было удобнее контролировать путь к java и/или agent.jar,
равно как и устанавливать любые переменные окружения, специфичные для конкретного узла,
например, такие как PATH.
<pre>
#!/bin/sh
exec java -jar ~/bin/agent.jar
</pre>
<p>
Вы можете использовать любую команду для запуска процесса на подчиненном узле,
такую как RSH, главное - чтобы стандартный вывод и ввод этого процесса был связан
с "java -jar ~/bin/agent.jar".
<p>
Для построения систем с большим количеством подчиненных узлов может быть полезно
загружать <tt>agent.jar</tt> из замонтированного по NFS общего источника, так чтобы
вам не пришлось обновлять все узлы при обновлении Jenkins.
<p>
Установите в качестве команды "ssh -v <i>hostname</i>" для проверки и определения
проблем при установке соединения.
</div>
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc.
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.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
${%blurb}
</j:jelly>
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Seiji Sogabe
#
# 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.
blurb=Starts an agent by having Jenkins execute a command from the master. \
Use this when the master is capable of remotely executing a process on another machine, e.g. via SSH or RSH.
# The MIT License
#
# Bulgarian translation: Copyright (c) 2016, Alexander Shopov <ash@kambanaria.org>
#
# 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.
# Starts an agent by having Jenkins execute a command from the master. \
# Use this when the master is capable of remotely executing a process on another machine, e.g. via SSH or RSH.
blurb=\
\u0421\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442 \u043a\u0430\u0442\u043e Jenkins \u0438\u0437\u043f\u044a\u043b\u043d\u044f\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0432\u0430\u0449\u0438\u044f \u043a\u043e\u043c\u043f\u044e\u0442\u044a\u0440.\
\u041f\u043e\u043b\u0437\u0432\u0430\u0439\u0442\u0435 \u0442\u043e\u0437\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0433\u0430\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0432\u0430\u0449\u0438\u044f\u0442 \u043a\u043e\u043c\u043f\u044e\u0442\u044a\u0440 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0438\u0437\u043f\u044a\u043b\u043d\u044f\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0438\
\u043d\u0430 \u0434\u0440\u0443\u0433\u0438 \u043c\u0430\u0448\u0438\u043d\u0438, \u043d\u0430\u043f\u0440. \u0447\u0440\u0435\u0437 SSH \u0438\u043b\u0438 RSH.
# The MIT License
#
# Copyright (c) 2017 Daniel Beck and a number of other of contributors
#
# 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.
blurb=Startet einen Agenten durch Ausf\u00FChrung eines Befehls auf dem Master-Knoten. \
Verwenden Sie diese Methode, wenn der Master-Knoten einen Prozess auf einem anderen System, z.B. via SSH oder RSH, ausf\u00FChren kann.
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Seiji Sogabe
#
# 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.
blurb=Arranca un nodo secundario ejecutando un commando desde el principal.\
Utiliza esta opción cuando el nodo principal sea capaz de ejecutar comandos remotos en el secundario (ssh/rsh).
# This file is under the MIT License by authors
blurb=\u041F\u043E\u043A\u0440\u0435\u043D\u0435 \u0430\u0433\u0435\u043D\u0442\u0430 \u0442\u0430\u043A\u043E \u0448\u0442\u043E Jenkins \u0438\u0437\u0432\u0440\u0448\u0438 \u043A\u043E\u043C\u0430\u043D\u0434\u0443 \u0441\u0430 \u0433\u043B\u0430\u0432\u043D\u0435 \u043C\u0430\u0448\u0438\u043D\u0435. \u041A\u043E\u0440\u0438\u0441\u0442\u0438\u0442\u0435 \u043E\u0432\u0443 \u043E\u043F\u0446\u0438\u0458\u0443 \u043A\u0430\u0434 \u0433\u043E\u0434 \u0433\u043B\u0430\u0432\u043D\u0430 \u043C\u0430\u0448\u0438\u043D\u0430 \u0458\u0435 \u0443 \u0441\u0442\u0430\u045A\u0443 \u0434\u0430 \u0438\u0437\u0432\u0440\u0448\u0438 \u043F\u0440\u043E\u0446\u0435\u0441 \u043D\u0430 \u0434\u0440\u0443\u0433\u043E\u0458 \u043C\u0430\u0448\u0438\u043D\u0438, \u043D\u043F\u0440. \u043F\u0440\u0435\u043A\u043E SSH \u0438\u043B\u0438 RSH.
<?jelly escape-by-default='true'?>
<div>
Allows agents to be launched using a specified command.
</div>
# The MIT License
#
# Copyright 2017 CloudBees, Inc.
#
# 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.
Slave.Launching={0} Launching agent
CommandLauncher.NoLaunchCommand=No launch command specified
CommandLauncher.displayName=Launch agent via execution of command on the master
Slave.UnableToLaunch=Unable to launch the agent for {0}{1}
CommandLauncher.NoLaunchCommand=\
\u041d\u0435 \u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435.
CommandLauncher.displayName=\
\u0421\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442 \u0447\u0440\u0435\u0437 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u044e\u0442\u044a\u0440
Slave.UnableToLaunch=\
\u0410\u0433\u0435\u043d\u0442\u044a\u0442 \u0437\u0430 {0}{1} \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0441\u0435 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430
Slave.Launching=Starte Agenten
CommandLauncher.NoLaunchCommand=Kein Startkommando angegeben.
CommandLauncher.displayName=Agent durch Ausf\u00FChrung eines Befehls auf dem Master-Knoten starten
Slave.UnableToLaunch=Kann Agent \u201E{0}\u201C nicht starten{1}
Slave.Launching={0} Arrancando el agente
CommandLauncher.NoLaunchCommand=No se ha especificado ningún comando
Slave.UnableToLaunch=Imposible ejecutar el agente en {0}{1}
CommandLauncher.NoLaunchCommand=Aucune commande de lancement sp\u00e9cifi\u00e9e
CommandLauncher.NoLaunchCommand=\u8d77\u52d5\u30b3\u30de\u30f3\u30c9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
Slave.Launching={0} Paleid\u017eiamas agentas
Slave.UnableToLaunch=Nepavyksta paleisti agento skirto {0}{1}
CommandLauncher.NoLaunchCommand=Sem nenhum comando de lan\u00e7amento especificado
Slave.Launching={0} \u043F\u043E\u043A\u0440\u0435\u0442\u0430\u045A\u0435 \u0430\u0433\u0435\u043D\u0442\u043E\u043C
CommandLauncher.NoLaunchCommand=\u041D\u0438\u0458\u0435 \u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043E \u043A\u043E\u043C\u0430\u043D\u0434\u0430 \u0437\u0430 \u043F\u043E\u043A\u0440\u0435\u0442\u0430\u045A\u0435.
CommandLauncher.displayName=\u041F\u043E\u043A\u0440\u0435\u043D\u0438 \u0430\u0433\u0435\u043D\u0442\u0430 \u0438\u0437\u0432\u0440\u0448\u0430\u0432\u0430\u045A\u0443 \u043A\u043E\u043C\u0430\u043D\u0434\u0435 \u043D\u0430 \u0433\u043B\u0430\u0432\u043D\u043E\u0458 \u043C\u0430\u0448\u0438\u043D\u0438
Slave.UnableToLaunch=\u0410\u0433\u0435\u043D\u0430\u0442 \u0437\u0430 {0}{1} \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0441\u0435 \u043F\u043E\u043A\u0440\u0435\u043D\u0435
/*
* The MIT License
*
* Copyright (c) 2010, InfraDNA, Inc.
*
* 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.
*/
package hudson.slaves;
import org.jvnet.hudson.test.HudsonTestCase;
/**
* @author Kohsuke Kawaguchi
*/
public class CommandConnectorTest extends HudsonTestCase {
public void testConfigRoundtrip() throws Exception {
CommandConnector cc = new CommandConnector("abc def");
assertEqualDataBoundBeans(cc,configRoundtrip(cc));
}
}
/*
* The MIT License
*
* Copyright 2017 CloudBees, Inc.
*
* 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.
*/
package hudson.slaves;
import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import hudson.XmlFile;
import hudson.cli.CLICommand;
import hudson.cli.CLICommandInvoker;
import hudson.cli.UpdateNodeCommand;
import hudson.model.Computer;
import hudson.model.User;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Set;
import javax.annotation.CheckForNull;
import jenkins.model.Jenkins;
import org.apache.tools.ant.filters.StringInputStream;
import static org.hamcrest.Matchers.*;
import org.jenkinsci.plugins.command_launcher.SystemCommandLanguage;
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runners.model.Statement;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockAuthorizationStrategy;
import org.jvnet.hudson.test.RestartableJenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;
public class CommandLauncher2Test {
@Rule
public RestartableJenkinsRule rr = new RestartableJenkinsRule();
@Issue("SECURITY-478")
@Test
public void requireApproval() throws Exception {
rr.addStep(new Statement() { // TODO .then, when using sufficiently new jenkins-test-harness
@Override
public void evaluate() throws Throwable {
rr.j.jenkins.setSecurityRealm(rr.j.createDummySecurityRealm());
rr.j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy().
grant(Jenkins.ADMINISTER).everywhere().to("admin").
grant(Jenkins.READ, Computer.CONFIGURE).everywhere().to("dev"));
ScriptApproval.get().preapprove("echo unconfigured", SystemCommandLanguage.get());
DumbSlave s = new DumbSlave("s", "/", new CommandLauncher("echo unconfigured"));
rr.j.jenkins.addNode(s);
// First, reconfigure using GUI.
JenkinsRule.WebClient wc = rr.j.createWebClient().login("admin");
HtmlForm form = wc.getPage(s, "configure").getFormByName("config");
HtmlTextInput input = form.getInputByName("_.command");
assertEquals("echo unconfigured", input.getText());
input.setText("echo configured by GUI");
rr.j.submit(form);
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo configured by GUI", ((CommandLauncher) s.getLauncher()).getCommand());
assertSerialForm(s, "echo configured by GUI");
// Then by REST.
String configDotXml = s.toComputer().getUrl() + "config.xml";
String xml = wc.goTo(configDotXml, "application/xml").getWebResponse().getContentAsString();
assertThat(xml, containsString("echo configured by GUI"));
WebRequest req = new WebRequest(wc.createCrumbedUrl(configDotXml), HttpMethod.POST);
req.setEncodingType(null);
req.setRequestBody(xml.replace("echo configured by GUI", "echo configured by REST"));
wc.getPage(req);
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo configured by REST", ((CommandLauncher) s.getLauncher()).getCommand());
assertSerialForm(s, "echo configured by REST");
// Then by CLI.
CLICommand cmd = new UpdateNodeCommand();
cmd.setTransportAuth(User.get("admin").impersonate());
assertThat(new CLICommandInvoker(rr.j, cmd).withStdin(new StringInputStream(xml.replace("echo configured by GUI", "echo configured by CLI"))).invokeWithArgs("s"), CLICommandInvoker.Matcher.succeededSilently());
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo configured by CLI", ((CommandLauncher) s.getLauncher()).getCommand());
assertEquals(Collections.emptySet(), ScriptApproval.get().getPendingScripts());
assertSerialForm(s, "echo configured by CLI");
// Now verify that all modes failed as dev. First as GUI.
ScriptApproval.get().preapprove("echo configured by admin", SystemCommandLanguage.get());
s.setLauncher(new CommandLauncher("echo configured by admin"));
s.save();
wc = rr.j.createWebClient().login("dev");
form = wc.getPage(s, "configure").getFormByName("config");
input = form.getInputByName("_.command");
assertEquals("echo configured by admin", input.getText());
input.setText("echo GUI ATTACK");
rr.j.submit(form);
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo GUI ATTACK", ((CommandLauncher) s.getLauncher()).getCommand());
Set<ScriptApproval.PendingScript> pendingScripts = ScriptApproval.get().getPendingScripts();
assertEquals(1, pendingScripts.size());
ScriptApproval.PendingScript pendingScript = pendingScripts.iterator().next();
assertEquals(SystemCommandLanguage.get(), pendingScript.getLanguage());
assertEquals("echo GUI ATTACK", pendingScript.script);
assertEquals("dev", pendingScript.getContext().getUser());
ScriptApproval.get().denyScript(pendingScript.getHash());
assertSerialForm(s, "echo GUI ATTACK");
// Then by REST.
req = new WebRequest(wc.createCrumbedUrl(configDotXml), HttpMethod.POST);
req.setEncodingType(null);
req.setRequestBody(xml.replace("echo configured by GUI", "echo REST ATTACK"));
wc.getPage(req);
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo REST ATTACK", ((CommandLauncher) s.getLauncher()).getCommand());
pendingScripts = ScriptApproval.get().getPendingScripts();
assertEquals(1, pendingScripts.size());
pendingScript = pendingScripts.iterator().next();
assertEquals(SystemCommandLanguage.get(), pendingScript.getLanguage());
assertEquals("echo REST ATTACK", pendingScript.script);
assertEquals(/* deserialization, not recording user */ null, pendingScript.getContext().getUser());
ScriptApproval.get().denyScript(pendingScript.getHash());
assertSerialForm(s, "echo REST ATTACK");
// Then by CLI.
cmd = new UpdateNodeCommand();
cmd.setTransportAuth(User.get("dev").impersonate());
assertThat(new CLICommandInvoker(rr.j, cmd).withStdin(new StringInputStream(xml.replace("echo configured by GUI", "echo CLI ATTACK"))).invokeWithArgs("s"), CLICommandInvoker.Matcher.succeededSilently());
s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo CLI ATTACK", ((CommandLauncher) s.getLauncher()).getCommand());
pendingScripts = ScriptApproval.get().getPendingScripts();
assertEquals(1, pendingScripts.size());
pendingScript = pendingScripts.iterator().next();
assertEquals(SystemCommandLanguage.get(), pendingScript.getLanguage());
assertEquals("echo CLI ATTACK", pendingScript.script);
assertEquals(/* ditto */null, pendingScript.getContext().getUser());
ScriptApproval.get().denyScript(pendingScript.getHash());
assertSerialForm(s, "echo CLI ATTACK");
// Now also check that SYSTEM deserialization works after a restart.
}
private void assertSerialForm(DumbSlave s, @CheckForNull String expectedCommand) throws IOException {
// cf. private methods in Nodes
File nodesDir = new File(rr.j.jenkins.getRootDir(), "nodes");
XmlFile configXml = new XmlFile(Jenkins.XSTREAM, new File(new File(nodesDir, s.getNodeName()), "config.xml"));
assertThat(configXml.asString(), expectedCommand != null ? containsString("<agentCommand>" + expectedCommand + "</agentCommand>") : not(containsString("<agentCommand>")));
}
});
rr.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
DumbSlave s = (DumbSlave) rr.j.jenkins.getNode("s");
assertEquals("echo CLI ATTACK", ((CommandLauncher) s.getLauncher()).getCommand());
Set<ScriptApproval.PendingScript> pendingScripts = ScriptApproval.get().getPendingScripts();
assertEquals(1, pendingScripts.size());
ScriptApproval.PendingScript pendingScript = pendingScripts.iterator().next();
assertEquals(SystemCommandLanguage.get(), pendingScript.getLanguage());
assertEquals("echo CLI ATTACK", pendingScript.script);
assertEquals(/* ditto */null, pendingScript.getContext().getUser());
}
});
}
@LocalData // saved by Hudson 1.215
@Test
public void ancientSerialForm() {
rr.addStep(new Statement() {
@Override
public void evaluate() throws Throwable {
ComputerLauncher launcher = ((DumbSlave) rr.j.jenkins.getNode("test")).getLauncher();
assertThat(launcher, instanceOf(CommandLauncher.class));
assertEquals("echo from CLI", ((CommandLauncher) launcher).getCommand());
}
});
}
}
/*
* The MIT License
*
* Copyright (c) 2015 Red Hat, Inc.
*
* 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.
*/
package hudson.slaves;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import hudson.Functions;
import hudson.model.Node;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
public class CommandLauncherTest {
@Rule
public JenkinsRule j = new JenkinsRule();
@Test
// TODO sometimes gets EOFException as in commandSucceedsWithoutChannel
public void commandFails() throws Exception {
assumeTrue(!Functions.isWindows());
DumbSlave slave = createSlave("false");
String log = slave.toComputer().getLog();
assertTrue(log, slave.toComputer().isOffline());
assertThat(log, containsString("ERROR: Process terminated with exit code"));
assertThat(log, not(containsString("ERROR: Process terminated with exit code 0")));
}
// TODO Sometimes gets `EOFException: unexpected stream termination` before then on CI builder; maybe needs to wait in a loop for a message to appear?
@Test
public void commandSucceedsWithoutChannel() throws Exception {
assumeTrue(!Functions.isWindows());
DumbSlave slave = createSlave("true");
String log = slave.toComputer().getLog();
assertTrue(log, slave.toComputer().isOffline());
assertThat(log, containsString("ERROR: Process terminated with exit code 0"));
}
public DumbSlave createSlave(String command) throws Exception {
DumbSlave slave;
synchronized (j.jenkins) { // TODO this lock smells like a bug post 1.607
slave = new DumbSlave(
"dummy",
"dummy",
j.createTmpDir().getPath(),
"1",
Node.Mode.NORMAL,
"",
new CommandLauncher(command),
RetentionStrategy.NOOP,
Collections.EMPTY_LIST
);
j.jenkins.addNode(slave);
}
try {
slave.toComputer().connect(false).get(1, TimeUnit.SECONDS);
fail("the slave was not supposed to connect successfully");
} catch (ExecutionException e) {
// ignore, we just want to
}
return slave;
}
}
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<numExecutors>2</numExecutors>
<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
<securityRealm class="hudson.security.SecurityRealm$None"/>
<jdks/>
<slaves>
<slave>
<name>test</name>
<description></description>
<remoteFS>/tmp</remoteFS>
<numExecutors>1</numExecutors>
<mode>NORMAL</mode>
<agentCommand>echo from CLI</agentCommand>
<label></label>
</slave>
</slaves>
<quietPeriod>5</quietPeriod>
<slaveAgentPort>0</slaveAgentPort>
<secretKey>ede47f10a483fb5bcc4ffe063a7890b847c31baffcecb124305738bc0d969b3d</secretKey>
</hudson>
\ No newline at end of file
......@@ -49,7 +49,6 @@ THE SOFTWARE.
<modules>
<module>core</module>
<module>command-launcher-plugin</module>
<module>war</module>
<module>test</module>
<module>cli</module>
......
......@@ -404,14 +404,12 @@ THE SOFTWARE.
<version>2.16.0</version>
<type>hpi</type>
</artifactItem>
<!-- TODO after split:
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>command-launcher</artifactId>
<version>1.0</version>
<version>1.0-20171017.180336-1</version> <!-- TODO pending hosting release -->
<type>hpi</type>
</artifactItem>
-->
</artifactItems>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/detached-plugins</outputDirectory>
<stripVersion>true</stripVersion>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册