Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
6c5856ed
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6c5856ed
编写于
9月 07, 2017
作者:
N
Nicolas De Loof
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
prefer ‘agent.jar’ over ‘slave.jar’
上级
68f55859
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
53 addition
and
52 deletion
+53
-52
core/src/main/java/hudson/FilePath.java
core/src/main/java/hudson/FilePath.java
+3
-3
core/src/main/java/hudson/Launcher.java
core/src/main/java/hudson/Launcher.java
+1
-1
core/src/main/java/hudson/model/Slave.java
core/src/main/java/hudson/model/Slave.java
+2
-2
core/src/main/java/hudson/slaves/Channels.java
core/src/main/java/hudson/slaves/Channels.java
+2
-2
core/src/main/java/hudson/slaves/CommandLauncher.java
core/src/main/java/hudson/slaves/CommandLauncher.java
+1
-1
core/src/main/java/hudson/slaves/SlaveComputer.java
core/src/main/java/hudson/slaves/SlaveComputer.java
+2
-2
core/src/main/resources/hudson/slaves/CommandLauncher/help-command.html
...resources/hudson/slaves/CommandLauncher/help-command.html
+7
-7
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_bg.html
...ources/hudson/slaves/CommandLauncher/help-command_bg.html
+8
-8
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_fr.html
...ources/hudson/slaves/CommandLauncher/help-command_fr.html
+8
-8
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_ja.html
...ources/hudson/slaves/CommandLauncher/help-command_ja.html
+7
-7
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_ru.html
...ources/hudson/slaves/CommandLauncher/help-command_ru.html
+7
-7
core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
.../src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
+2
-2
core/src/main/resources/windows-service/jenkins-slave.xml
core/src/main/resources/windows-service/jenkins-slave.xml
+1
-1
test/src/test/java/hudson/model/Slave2Test.java
test/src/test/java/hudson/model/Slave2Test.java
+1
-0
test/src/test/resources/hudson/model/update-center.json
test/src/test/resources/hudson/model/update-center.json
+1
-1
未找到文件。
core/src/main/java/hudson/FilePath.java
浏览文件 @
6c5856ed
...
...
@@ -2042,7 +2042,7 @@ public final class FilePath implements Serializable {
/**
* With fix to JENKINS-11251 (remoting 2.15), this is no longer necessary.
* But I'm keeping it for a while so that users who manually deploy
slave
.jar has time to deploy new version
* But I'm keeping it for a while so that users who manually deploy
agent
.jar has time to deploy new version
* before this goes away.
*/
private
void
syncIO
()
throws
InterruptedException
{
...
...
@@ -2050,9 +2050,9 @@ public final class FilePath implements Serializable {
if
(
channel
!=
null
)
channel
.
syncLocalIO
();
}
catch
(
AbstractMethodError
e
)
{
// legacy
slave
.jar. Handle this gracefully
// legacy
agent
.jar. Handle this gracefully
try
{
LOGGER
.
log
(
Level
.
WARNING
,
"Looks like an old
slave
.jar. Please update "
+
Which
.
jarFile
(
Channel
.
class
)+
" to the new version"
,
e
);
LOGGER
.
log
(
Level
.
WARNING
,
"Looks like an old
agent
.jar. Please update "
+
Which
.
jarFile
(
Channel
.
class
)+
" to the new version"
,
e
);
}
catch
(
IOException
_
)
{
// really ignore this time
}
...
...
core/src/main/java/hudson/Launcher.java
浏览文件 @
6c5856ed
...
...
@@ -1307,7 +1307,7 @@ public abstract class Launcher {
try
{
Channel
.
current
().
syncIO
();
}
catch
(
Throwable
t
)
{
// this includes a failure to sync,
slave
.jar too old, etc
// this includes a failure to sync,
agent
.jar too old, etc
}
}
}
...
...
core/src/main/java/hudson/model/Slave.java
浏览文件 @
6c5856ed
...
...
@@ -391,7 +391,7 @@ public abstract class Slave extends Node implements Serializable {
if
(
name
.
equals
(
"hudson-cli.jar"
))
{
name
=
"jenkins-cli.jar"
;
}
else
if
(
name
.
equals
(
"slave.jar"
)
||
name
.
equals
(
"remoting.jar"
))
{
}
else
if
(
name
.
equals
(
"
agent.jar"
)
||
name
.
equals
(
"
slave.jar"
)
||
name
.
equals
(
"remoting.jar"
))
{
name
=
"lib/"
+
Which
.
jarFile
(
Channel
.
class
).
getName
();
}
...
...
@@ -674,5 +674,5 @@ public abstract class Slave extends Node implements Serializable {
/**
* Provides a collection of file names, which are accessible via /jnlpJars link.
*/
private
static
final
Set
<
String
>
ALLOWED_JNLPJARS_FILES
=
ImmutableSet
.
of
(
"slave.jar"
,
"remoting.jar"
,
"jenkins-cli.jar"
,
"hudson-cli.jar"
);
private
static
final
Set
<
String
>
ALLOWED_JNLPJARS_FILES
=
ImmutableSet
.
of
(
"
agent.jar"
,
"
slave.jar"
,
"remoting.jar"
,
"jenkins-cli.jar"
,
"hudson-cli.jar"
);
}
core/src/main/java/hudson/slaves/Channels.java
浏览文件 @
6c5856ed
...
...
@@ -164,7 +164,7 @@ public class Channels {
* @param workDir
* If non-null, the new JVM will have this directory as the working directory. This must be a local path.
* @param classpath
* The classpath of the new JVM. Can be null if you just need {@code
slave
.jar} (and everything else
* The classpath of the new JVM. Can be null if you just need {@code
agent
.jar} (and everything else
* can be sent over the channel.) But if you have jars that are known to be necessary by the new JVM,
* setting it here will improve the classloading performance (by avoiding remote class file transfer.)
* Classes in this classpath will also take precedence over any other classes that's sent via the channel
...
...
@@ -195,7 +195,7 @@ public class Channels {
* @param workDir
* If non-null, the new JVM will have this directory as the working directory. This must be a local path.
* @param classpath
* The classpath of the new JVM. Can be null if you just need {@code
slave
.jar} (and everything else
* The classpath of the new JVM. Can be null if you just need {@code
agent
.jar} (and everything else
* can be sent over the channel.) But if you have jars that are known to be necessary by the new JVM,
* setting it here will improve the classloading performance (by avoiding remote class file transfer.)
* Classes in this classpath will also take precedence over any other classes that's sent via the channel
...
...
core/src/main/java/hudson/slaves/CommandLauncher.java
浏览文件 @
6c5856ed
...
...
@@ -114,7 +114,7 @@ public class CommandLauncher extends ComputerLauncher {
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/
slave
.jar"
);
pb
.
environment
().
put
(
"SLAVEJAR_URL"
,
rootUrl
+
"/jnlpJars/
agent
.jar"
);
}
}
...
...
core/src/main/java/hudson/slaves/SlaveComputer.java
浏览文件 @
6c5856ed
...
...
@@ -362,7 +362,7 @@ public class SlaveComputer extends Computer {
* Creates a {@link Channel} from the given stream and sets that to this agent.
*
* @param in
* Stream connected to the remote "
slave
.jar". It's the caller's responsibility to do
* Stream connected to the remote "
agent
.jar". It's the caller's responsibility to do
* buffering on this stream, if that's necessary.
* @param out
* Stream connected to the remote peer. It's the caller's responsibility to do
...
...
@@ -521,7 +521,7 @@ public class SlaveComputer extends Computer {
channel
.
addListener
(
listener
);
String
slaveVersion
=
channel
.
call
(
new
SlaveVersion
());
log
.
println
(
"
Slave
.jar version: "
+
slaveVersion
);
log
.
println
(
"
agent
.jar version: "
+
slaveVersion
);
boolean
_isUnix
=
channel
.
call
(
new
DetectOS
());
log
.
println
(
_isUnix
?
hudson
.
model
.
Messages
.
Slave_UnixSlave
():
hudson
.
model
.
Messages
.
Slave_WindowsSlave
());
...
...
core/src/main/resources/hudson/slaves/CommandLauncher/help-command.html
浏览文件 @
6c5856ed
<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>
slave
.jar
</tt>
program on the correct
the executed program launches the
<tt>
agent
.jar
</tt>
program on the correct
machine.
<p>
A copy of
<tt>
slave.jar
</tt>
can be downloaded from
<a
href=
"${rootURL}/jnlpJars/slave
.jar"
><tt>
here
</tt></a>
.
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/
slave
.jar".
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
slave
.jar, as well as set up any
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/
slave
.jar
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/
slave
.jar" eventually.
"java -jar ~/bin/
agent
.jar" eventually.
<p>
In a larger deployment, it is also worth considering to load
<tt>
slave
.jar
</tt>
from
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.
...
...
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_bg.html
浏览文件 @
6c5856ed
<div>
Команда за стартирането на агента, който управлява компютъра и комуникира
с управляващия компютър. Jenkins приема, че изпълнената програма ще
стартира
<tt>
slave
.jar
</tt>
на правилната машина.
стартира
<tt>
agent
.jar
</tt>
на правилната машина.
<p>
Може да изтеглите
<tt>
slave
.jar
</tt>
<a
href=
"${rootURL}/jnlpJars/
slave
.jar"
><tt>
оттук
</tt></a>
.
Може да изтеглите
<tt>
agent
.jar
</tt>
<a
href=
"${rootURL}/jnlpJars/
agent
.jar"
><tt>
оттук
</tt></a>
.
<p>
В най-простия случай, това може да е команда като тази:
„ssh
<i>
hostname
</i>
java -jar ~/bin/
slave
.jar“.
„ssh
<i>
hostname
</i>
java -jar ~/bin/
agent
.jar“.
Често е по-добре да напишете малък скрипт подобен на този отдолу, за да може да
настройвате местоположението на Java и/или
slave
.jar, както и да променяте
настройвате местоположението на Java и/или
agent
.jar, както и да променяте
променливите на средата на машината, например „PATH“:
<pre>
#!/bin/sh
exec java -jar ~/bin/
slave
.jar
exec java -jar ~/bin/
agent
.jar
</pre>
<p>
Може да използвате произволна команда за стартирането на процеса на управляваната
машина, стига тя да е в състояние да изпълни „java -jar ~/bin/
slave
.jar“ като
машина, стига тя да е в състояние да изпълни „java -jar ~/bin/
agent
.jar“ като
остане свързана със стандартните вход и изход на този процес.
<p>
При по-големи инсталации може да зареждате
<tt>
slave
.jar
</tt>
от споделен монтиран
При по-големи инсталации може да зареждате
<tt>
agent
.jar
</tt>
от споделен монтиран
ресурс, например NFS, така че да не се налага ръчно да обновявате файла при всяко
обновяване на Jenkins.
...
...
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_fr.html
浏览文件 @
6c5856ed
...
...
@@ -16,36 +16,36 @@
<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>
slave
.jar
</tt>
sur la bonne machine esclave.
programme
<tt>
agent
.jar
</tt>
sur la bonne machine esclave.
<p>
Une copie du
<tt>
slave
.jar
</tt>
est disponible dans le répertoire
<a
href=
"${rootURL}/jnlpJars/
slave.jar"
><tt>
WEB-INF/slave
.jar
</tt></a>
.
Une copie du
<tt>
agent
.jar
</tt>
est disponible dans le répertoire
<a
href=
"${rootURL}/jnlpJars/
agent.jar"
><tt>
WEB-INF/agent
.jar
</tt></a>
.
<p>
Pour un cas simple, cette commande pourrait être du type
"ssh
<i>
hostname
</i>
java -jar ~/bin/
slave
.jar".
"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
slave
.jar. Vous pouvez aussi
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/
slave
.jar
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/
slave
.jar".
sur "java -jar ~/bin/
agent
.jar".
<p>
Dans un déploiement à plus grande échelle, on peut envisager de charger
<tt>
slave
.jar
</tt>
à partir d'une location commune montée par NFS, afin
<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.
...
...
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_ja.html
浏览文件 @
6c5856ed
...
...
@@ -4,29 +4,29 @@
<p>
この項目にコマンドが指定されたとき、マスターでこのコマンドが実行されます。そして、
Jenkinsは、その実行コマンドが正しいスレーブマシーン上で
<tt>
slave
.jar
</tt>
を起動することを想定しています。
Jenkinsは、その実行コマンドが正しいスレーブマシーン上で
<tt>
agent
.jar
</tt>
を起動することを想定しています。
<p>
<tt>
slave.jar
</tt>
のコピーが、
<tt>
jenkins.war
</tt>
の中の
<a
href=
"${rootURL}/jnlpJars/slave.jar"
><tt>
WEB-INF/slave
.jar
</tt></a>
にあります。
<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/
slave
.jar"のようなものになります。
シンプルなケースでは、このコマンドは"ssh
<i>
hostname
</i>
java -jar ~/bin/
agent
.jar"のようなものになります。
しかし、PATHのようなこのスレーブノード独自の環境変数を設定するのと同時に、javaや
slave
.jarの場所を制御できるように、
しかし、PATHのようなこのスレーブノード独自の環境変数を設定するのと同時に、javaや
agent
.jarの場所を制御できるように、
スレーブに以下のような小さいシェルスクリプトを書くのはいい考えです。
<pre>
#!/bin/sh
exec java -jar ~/bin/
slave
.jar
exec java -jar ~/bin/
agent
.jar
</pre>
<p>
RSHのようなスレーブマシンでプロセスを起動できるようなコマンドを使用することができます。
ただし、プロセスの標準入出力が"java -jar ~/bin/
slave
.jar"を接続している必要があります。
ただし、プロセスの標準入出力が"java -jar ~/bin/
agent
.jar"を接続している必要があります。
<p>
スレーブがたくさん配置されている場合、NFSでマウントされた共通の場所から、
<tt>
slave
.jar
</tt>
をロードすることは考える価値があります。
<tt>
agent
.jar
</tt>
をロードすることは考える価値があります。
そうすれば、Jenkinsを更新するごとにこのファイルを更新する必要がありません。
<p>
...
...
core/src/main/resources/hudson/slaves/CommandLauncher/help-command_ru.html
浏览文件 @
6c5856ed
...
...
@@ -4,34 +4,34 @@
<p>
Когда в этом поле указана команда, она будет выполнена на мастере и Jenkins предполагает
что эта команда запустит
<tt>
slave
.jar
</tt>
на соответствующем подчиненном узле.
что эта команда запустит
<tt>
agent
.jar
</tt>
на соответствующем подчиненном узле.
<p>
Копия файла
<tt>
slave.jar
</tt>
вы можете найти в
<a
href=
"${rootURL}/jnlpJars/slave.jar"
><tt>
WEB-INF/slave.jar
</tt></a>
внутри
Копия файла
<tt>
agent.jar
</tt>
вы можете найти в
<a
href=
"${rootURL}/jnlpJars/agent.jar"
><tt>
WEB-INF/agent.jar
</tt></a>
внутри
<tt>
jenkins.war
</tt>
.
<p>
В самом простом случае команда будет выглядеть приблизительно так:
"ssh
<i>
hostname
</i>
java -jar ~/bin/
slave
.jar"
"ssh
<i>
hostname
</i>
java -jar ~/bin/
agent
.jar"
Однако, обычно лучшей идеей будет написание простого shell скрипта, содержащего
указанную команду, чтобы вам было удобнее контролировать путь к java и/или
slave
.jar,
указанную команду, чтобы вам было удобнее контролировать путь к java и/или
agent
.jar,
равно как и устанавливать любые переменные окружения, специфичные для конкретного узла,
например, такие как PATH.
<pre>
#!/bin/sh
exec java -jar ~/bin/
slave
.jar
exec java -jar ~/bin/
agent
.jar
</pre>
<p>
Вы можете использовать любую команду для запуска процесса на подчиненном узле,
такую как RSH, главное - чтобы стандартный вывод и ввод этого процесса был связан
с "java -jar ~/bin/
slave
.jar".
с "java -jar ~/bin/
agent
.jar".
<p>
Для построения систем с большим количеством подчиненных узлов может быть полезно
загружать
<tt>
slave.jar
</tt>
из замонтированного по NFS общего источника, так чтобы
загружать
<tt>
agent.jar
</tt>
из замонтированного по NFS общего источника, так чтобы
вам не пришлось обновлять все узлы при обновлении Jenkins.
<p>
...
...
core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
浏览文件 @
6c5856ed
...
...
@@ -57,7 +57,7 @@ THE SOFTWARE.
<p>
${%Or if the agent is headless:}
</p>
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/
slave.jar">slave
.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}slave-agent.jnlp ${it.launcher.getWorkDirOptions(it)}</pre>
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/
agent.jar">agent
.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}slave-agent.jnlp ${it.launcher.getWorkDirOptions(it)}</pre>
</li>
</j:when>
<j:otherwise>
...
...
@@ -66,7 +66,7 @@ THE SOFTWARE.
${%Run from agent command line:}
</p>
<!-- TODO conceal secret w/ JS if possible -->
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/
slave.jar">slave
.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}slave-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}</pre>
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/
agent.jar">agent
.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}slave-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}</pre>
</li>
</j:otherwise>
</j:choose>
...
...
core/src/main/resources/windows-service/jenkins-slave.xml
浏览文件 @
6c5856ed
...
...
@@ -35,7 +35,7 @@ THE SOFTWARE.
The following value assumes that you have java in your PATH.
-->
<executable>
@JAVA@
</executable>
<arguments>
-Xrs @VMARGS@ -jar "%BASE%\
slave
.jar" @ARGS@
</arguments>
<arguments>
-Xrs @VMARGS@ -jar "%BASE%\
agent
.jar" @ARGS@
</arguments>
<!--
interactive flag causes the empty black Java window to be displayed.
I'm still debugging this.
...
...
test/src/test/java/hudson/model/Slave2Test.java
浏览文件 @
6c5856ed
...
...
@@ -70,6 +70,7 @@ public class Slave2Test {
Slave
slave
=
rule
.
createSlave
();
// Spot-check correct requests
assertJnlpJarUrlIsAllowed
(
slave
,
"agent.jar"
);
assertJnlpJarUrlIsAllowed
(
slave
,
"slave.jar"
);
assertJnlpJarUrlIsAllowed
(
slave
,
"remoting.jar"
);
assertJnlpJarUrlIsAllowed
(
slave
,
"jenkins-cli.jar"
);
...
...
test/src/test/resources/hudson/model/update-center.json
浏览文件 @
6c5856ed
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录