Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
4eb314b3
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
4eb314b3
编写于
1月 02, 2018
作者:
O
Oleg Nenashev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[JENKINS-48761] - Restore binary compatibility with agents running old Remoting versions
上级
0ac93deb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
7 deletion
+43
-7
core/src/main/java/hudson/Launcher.java
core/src/main/java/hudson/Launcher.java
+6
-2
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Computer.java
+1
-1
core/src/main/java/hudson/slaves/ChannelPinger.java
core/src/main/java/hudson/slaves/ChannelPinger.java
+1
-1
core/src/main/java/hudson/slaves/SlaveComputer.java
core/src/main/java/hudson/slaves/SlaveComputer.java
+6
-1
core/src/main/java/jenkins/security/MasterToSlaveCallable.java
...src/main/java/jenkins/security/MasterToSlaveCallable.java
+28
-1
core/src/main/java/jenkins/slaves/StandardOutputSwapper.java
core/src/main/java/jenkins/slaves/StandardOutputSwapper.java
+1
-1
未找到文件。
core/src/main/java/hudson/Launcher.java
浏览文件 @
4eb314b3
...
...
@@ -1289,7 +1289,7 @@ public abstract class Launcher {
}
public
RemoteProcess
call
()
throws
IOException
{
final
Channel
channel
=
getOpenChannelOrFail
();
final
Channel
channel
=
_
getOpenChannelOrFail
();
Launcher
.
ProcStarter
ps
=
new
LocalLauncher
(
listener
).
launch
();
ps
.
cmds
(
cmd
).
masks
(
masks
).
envs
(
env
).
stdin
(
in
).
stdout
(
out
).
stderr
(
err
).
quiet
(
quiet
);
if
(
workDir
!=
null
)
ps
.
pwd
(
workDir
);
...
...
@@ -1308,7 +1308,11 @@ public abstract class Launcher {
Channel
taskChannel
=
null
;
try
{
// Sync IO will fail automatically if the channel is being closed, no need to use getOpenChannelOrFail()
taskChannel
=
Channel
.
currentOrFail
();
// TODOL Replace by Channel#currentOrFail() when Remoting version allows
taskChannel
=
Channel
.
current
();
if
(
taskChannel
==
null
)
{
throw
new
IOException
(
"No Remoting channel associated with this thread"
);
}
taskChannel
.
syncIO
();
}
catch
(
Throwable
t
)
{
// this includes a failure to sync, agent.jar too old, etc
...
...
core/src/main/java/hudson/model/Computer.java
浏览文件 @
4eb314b3
...
...
@@ -1426,7 +1426,7 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
private
static
final
class
DumpExportTableTask
extends
MasterToSlaveCallable
<
String
,
IOException
>
{
public
String
call
()
throws
IOException
{
final
Channel
ch
=
getChannelOrFail
();
final
Channel
ch
=
_
getChannelOrFail
();
StringWriter
sw
=
new
StringWriter
();
try
(
PrintWriter
pw
=
new
PrintWriter
(
sw
))
{
ch
.
dumpExportTable
(
pw
);
...
...
core/src/main/java/hudson/slaves/ChannelPinger.java
浏览文件 @
4eb314b3
...
...
@@ -134,7 +134,7 @@ public class ChannelPinger extends ComputerListener {
@Override
public
Void
call
()
throws
IOException
{
// No sense in setting up channel pinger if the channel is being closed
setUpPingForChannel
(
getOpenChannelOrFail
(),
null
,
pingTimeoutSeconds
,
pingIntervalSeconds
,
false
);
setUpPingForChannel
(
_
getOpenChannelOrFail
(),
null
,
pingTimeoutSeconds
,
pingIntervalSeconds
,
false
);
return
null
;
}
...
...
core/src/main/java/hudson/slaves/SlaveComputer.java
浏览文件 @
4eb314b3
...
...
@@ -38,6 +38,7 @@ import hudson.model.TaskListener;
import
hudson.model.User
;
import
hudson.remoting.Channel
;
import
hudson.remoting.ChannelBuilder
;
import
hudson.remoting.ChannelClosedException
;
import
hudson.remoting.Launcher
;
import
hudson.remoting.VirtualChannel
;
import
hudson.security.ACL
;
...
...
@@ -867,7 +868,11 @@ public class SlaveComputer extends Computer {
// ignore this error.
}
Channel
.
currentOrFail
().
setProperty
(
"slave"
,
Boolean
.
TRUE
);
// indicate that this side of the channel is the slave side.
try
{
_getChannelOrFail
().
setProperty
(
"slave"
,
Boolean
.
TRUE
);
// indicate that this side of the channel is the slave side.
}
catch
(
ChannelClosedException
e
)
{
throw
new
IllegalStateException
(
e
);
}
return
null
;
}
...
...
core/src/main/java/jenkins/security/MasterToSlaveCallable.java
浏览文件 @
4eb314b3
package
jenkins.security
;
import
hudson.remoting.Callable
;
import
hudson.remoting.Channel
;
import
hudson.remoting.ChannelClosedException
;
import
org.jenkinsci.remoting.RoleChecker
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.NoExternalUse
;
import
javax.annotation.Nonnull
;
/**
...
...
@@ -11,10 +17,31 @@ import org.jenkinsci.remoting.RoleChecker;
* @since 1.587 / 1.580.1
*/
public
abstract
class
MasterToSlaveCallable
<
V
,
T
extends
Throwable
>
implements
Callable
<
V
,
T
>
{
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
void
checkRoles
(
RoleChecker
checker
)
throws
SecurityException
{
checker
.
check
(
this
,
Roles
.
SLAVE
);
}
private
static
final
long
serialVersionUID
=
1L
;
//TODO: replace by Callable#getChannelOrFail() once Minimal supported Remoting version is 3.15 or above
@Restricted
(
NoExternalUse
.
class
)
protected
static
Channel
_getChannelOrFail
()
throws
ChannelClosedException
{
final
Channel
ch
=
Channel
.
current
();
if
(
ch
==
null
)
{
throw
new
ChannelClosedException
(
"No channel associated with the thread"
,
null
);
}
return
ch
;
}
//TODO: replace by Callable#getOpenChannelOrFail() once Minimal supported Remoting version is 3.15 or above
@Restricted
(
NoExternalUse
.
class
)
protected
static
Channel
_getOpenChannelOrFail
()
throws
ChannelClosedException
{
final
Channel
ch
=
_getChannelOrFail
();
if
(
ch
.
isClosingOrClosed
())
{
// TODO: Since Remoting 2.33, we still need to explicitly declare minimal Remoting version
throw
new
ChannelClosedException
(
"The associated channel "
+
ch
+
" is closing down or has closed down"
,
ch
.
getCloseRequestCause
());
}
return
ch
;
}
}
core/src/main/java/jenkins/slaves/StandardOutputSwapper.java
浏览文件 @
4eb314b3
...
...
@@ -39,7 +39,7 @@ public class StandardOutputSwapper extends ComputerListener {
private
static
final
class
ChannelSwapper
extends
MasterToSlaveCallable
<
Boolean
,
Exception
>
{
public
Boolean
call
()
throws
Exception
{
if
(
File
.
pathSeparatorChar
==
';'
)
return
false
;
// Windows
Channel
c
=
getOpenChannelOrFail
();
Channel
c
=
_
getOpenChannelOrFail
();
StandardOutputStream
sos
=
(
StandardOutputStream
)
c
.
getProperty
(
StandardOutputStream
.
class
);
if
(
sos
!=
null
)
{
swap
(
sos
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录