Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
8b92f50f
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,发现更多精彩内容 >>
提交
8b92f50f
编写于
12月 23, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replacing the reference to channel via checkChannel()
上级
e45f734e
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
77 addition
and
74 deletion
+77
-74
core/src/main/java/hudson/cli/CLICommand.java
core/src/main/java/hudson/cli/CLICommand.java
+13
-3
core/src/main/java/hudson/cli/CommandDuringBuild.java
core/src/main/java/hudson/cli/CommandDuringBuild.java
+1
-1
core/src/main/java/hudson/cli/GroovyCommand.java
core/src/main/java/hudson/cli/GroovyCommand.java
+1
-1
core/src/main/java/hudson/cli/InstallPluginCommand.java
core/src/main/java/hudson/cli/InstallPluginCommand.java
+11
-9
core/src/main/java/hudson/cli/InstallToolCommand.java
core/src/main/java/hudson/cli/InstallToolCommand.java
+2
-2
core/src/main/java/hudson/cli/LoginCommand.java
core/src/main/java/hudson/cli/LoginCommand.java
+1
-1
core/src/main/java/hudson/cli/LogoutCommand.java
core/src/main/java/hudson/cli/LogoutCommand.java
+1
-1
core/src/main/java/hudson/cli/SetBuildDescriptionCommand.java
.../src/main/java/hudson/cli/SetBuildDescriptionCommand.java
+44
-48
core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java
.../src/main/java/hudson/cli/SetBuildDisplayNameCommand.java
+1
-5
core/src/main/java/hudson/cli/declarative/CLIRegisterer.java
core/src/main/java/hudson/cli/declarative/CLIRegisterer.java
+0
-1
core/src/main/java/hudson/model/FileParameterDefinition.java
core/src/main/java/hudson/model/FileParameterDefinition.java
+1
-1
core/src/main/java/hudson/model/ParameterDefinition.java
core/src/main/java/hudson/model/ParameterDefinition.java
+1
-1
未找到文件。
core/src/main/java/hudson/cli/CLICommand.java
浏览文件 @
8b92f50f
...
...
@@ -131,6 +131,10 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
* <p>
* Starting 1.445, CLI transports are not required to provide a channel
* (think of sshd, telnet, etc), so in such a case this field is null.
*
* <p>
* See {@link #checkChannel()} to get a channel and throw an user-friendly
* exception
*/
public
transient
Channel
channel
;
...
...
@@ -215,6 +219,12 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
}
}
public
Channel
checkChannel
()
throws
AbortException
{
if
(
channel
==
null
)
throw
new
AbortException
(
"This command can only run with Jenkins CLI. See https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI"
);
return
channel
;
}
/**
* Loads the persisted authentication information from {@link ClientAuthenticationCache}
* if the current transport provides {@link Channel}.
...
...
@@ -309,7 +319,7 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
* Convenience method for subtypes to obtain the system property of the client.
*/
protected
String
getClientSystemProperty
(
String
name
)
throws
IOException
,
InterruptedException
{
return
ch
annel
.
call
(
new
GetSystemProperty
(
name
));
return
ch
eckChannel
()
.
call
(
new
GetSystemProperty
(
name
));
}
private
static
final
class
GetSystemProperty
implements
Callable
<
String
,
IOException
>
{
...
...
@@ -327,7 +337,7 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
}
protected
Charset
getClientCharset
()
throws
IOException
,
InterruptedException
{
String
charsetName
=
ch
annel
.
call
(
new
GetCharset
());
String
charsetName
=
ch
eckChannel
()
.
call
(
new
GetCharset
());
try
{
return
Charset
.
forName
(
charsetName
);
}
catch
(
UnsupportedCharsetException
e
)
{
...
...
@@ -348,7 +358,7 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
* Convenience method for subtypes to obtain environment variables of the client.
*/
protected
String
getClientEnvironmentVariable
(
String
name
)
throws
IOException
,
InterruptedException
{
return
ch
annel
.
call
(
new
GetEnvironmentVariable
(
name
));
return
ch
eckChannel
()
.
call
(
new
GetEnvironmentVariable
(
name
));
}
private
static
final
class
GetEnvironmentVariable
implements
Callable
<
String
,
IOException
>
{
...
...
core/src/main/java/hudson/cli/CommandDuringBuild.java
浏览文件 @
8b92f50f
...
...
@@ -46,7 +46,7 @@ public abstract class CommandDuringBuild extends CLICommand {
try
{
CLICommand
c
=
CLICommand
.
getCurrent
();
if
(
c
==
null
)
throw
new
IllegalStateException
(
"Not executing a CLI command"
);
String
[]
envs
=
c
.
ch
annel
.
call
(
new
GetCharacteristicEnvironmentVariables
());
String
[]
envs
=
c
.
ch
eckChannel
()
.
call
(
new
GetCharacteristicEnvironmentVariables
());
if
(
envs
[
0
]==
null
||
envs
[
1
]==
null
)
throw
new
CmdLineException
(
"This CLI command works only when invoked from inside a build"
);
...
...
core/src/main/java/hudson/cli/GroovyCommand.java
浏览文件 @
8b92f50f
...
...
@@ -103,7 +103,7 @@ public class GroovyCommand extends CLICommand implements Serializable {
if
(
script
.
equals
(
"="
))
return
IOUtils
.
toString
(
stdin
);
return
ch
annel
.
call
(
new
Callable
<
String
,
IOException
>()
{
return
ch
eckChannel
()
.
call
(
new
Callable
<
String
,
IOException
>()
{
public
String
call
()
throws
IOException
{
File
f
=
new
File
(
script
);
if
(
f
.
exists
())
...
...
core/src/main/java/hudson/cli/InstallPluginCommand.java
浏览文件 @
8b92f50f
...
...
@@ -76,6 +76,7 @@ public class InstallPluginCommand extends CLICommand {
for
(
String
source
:
sources
)
{
// is this a file?
if
(
channel
!=
null
)
{
FilePath
f
=
new
FilePath
(
channel
,
source
);
if
(
f
.
exists
())
{
stdout
.
println
(
Messages
.
InstallPluginCommand_InstallingPluginFromLocalFile
(
f
));
...
...
@@ -86,6 +87,7 @@ public class InstallPluginCommand extends CLICommand {
pm
.
dynamicLoad
(
getTargetFile
());
continue
;
}
}
// is this an URL?
try
{
...
...
core/src/main/java/hudson/cli/InstallToolCommand.java
浏览文件 @
8b92f50f
...
...
@@ -68,7 +68,7 @@ public class InstallToolCommand extends CLICommand {
h
.
checkPermission
(
Jenkins
.
READ
);
// where is this build running?
BuildIDs
id
=
ch
annel
.
call
(
new
BuildIDs
());
BuildIDs
id
=
ch
eckChannel
()
.
call
(
new
BuildIDs
());
if
(!
id
.
isComplete
())
throw
new
AbortException
(
"This command can be only invoked from a build executing inside Hudson"
);
...
...
@@ -129,7 +129,7 @@ public class InstallToolCommand extends CLICommand {
}
if
(
t
instanceof
EnvironmentSpecific
)
{
EnvironmentSpecific
e
=
(
EnvironmentSpecific
)
t
;
t
=
(
ToolInstallation
)
e
.
forEnvironment
(
EnvVars
.
getRemote
(
ch
annel
));
t
=
(
ToolInstallation
)
e
.
forEnvironment
(
EnvVars
.
getRemote
(
ch
eckChannel
()
));
}
stdout
.
println
(
t
.
getHome
());
return
0
;
...
...
core/src/main/java/hudson/cli/LoginCommand.java
浏览文件 @
8b92f50f
...
...
@@ -33,7 +33,7 @@ public class LoginCommand extends CLICommand {
if
(
a
==
Jenkins
.
ANONYMOUS
)
throw
new
CmdLineException
(
"No credentials specified."
);
// this causes CLI to show the command line options.
ClientAuthenticationCache
store
=
new
ClientAuthenticationCache
(
ch
annel
);
ClientAuthenticationCache
store
=
new
ClientAuthenticationCache
(
ch
eckChannel
()
);
store
.
set
(
a
);
return
0
;
...
...
core/src/main/java/hudson/cli/LogoutCommand.java
浏览文件 @
8b92f50f
...
...
@@ -17,7 +17,7 @@ public class LogoutCommand extends CLICommand {
@Override
protected
int
run
()
throws
Exception
{
ClientAuthenticationCache
store
=
new
ClientAuthenticationCache
(
ch
annel
);
ClientAuthenticationCache
store
=
new
ClientAuthenticationCache
(
ch
eckChannel
()
);
store
.
remove
();
return
0
;
}
...
...
core/src/main/java/hudson/cli/SetBuildDescriptionCommand.java
浏览文件 @
8b92f50f
...
...
@@ -33,11 +33,7 @@ public class SetBuildDescriptionCommand extends CLICommand implements Serializab
run
.
checkPermission
(
Run
.
UPDATE
);
if
(
"="
.
equals
(
description
))
{
description
=
channel
.
call
(
new
Callable
<
String
,
IOException
>()
{
public
String
call
()
throws
IOException
{
return
IOUtils
.
toString
(
System
.
in
);
}
});
description
=
IOUtils
.
toString
(
stdin
);
}
run
.
setDescription
(
description
);
...
...
core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java
浏览文件 @
8b92f50f
...
...
@@ -32,11 +32,7 @@ public class SetBuildDisplayNameCommand extends CLICommand implements Serializab
run
.
checkPermission
(
Run
.
UPDATE
);
if
(
"-"
.
equals
(
displayName
))
{
displayName
=
channel
.
call
(
new
Callable
<
String
,
IOException
>()
{
public
String
call
()
throws
IOException
{
return
IOUtils
.
toString
(
System
.
in
);
}
});
displayName
=
IOUtils
.
toString
(
stdin
);
}
run
.
setDisplayName
(
displayName
);
...
...
core/src/main/java/hudson/cli/declarative/CLIRegisterer.java
浏览文件 @
8b92f50f
...
...
@@ -120,7 +120,6 @@ public class CLIRegisterer extends ExtensionFinder {
this
.
stdout
=
stdout
;
this
.
stderr
=
stderr
;
this
.
locale
=
locale
;
this
.
channel
=
Channel
.
current
();
registerOptionHandlers
();
CmdLineParser
parser
=
new
CmdLineParser
(
null
);
...
...
core/src/main/java/hudson/model/FileParameterDefinition.java
浏览文件 @
8b92f50f
...
...
@@ -75,7 +75,7 @@ public class FileParameterDefinition extends ParameterDefinition {
@Override
public
ParameterValue
createValue
(
CLICommand
command
,
String
value
)
throws
IOException
,
InterruptedException
{
// capture the file to the server
FilePath
src
=
new
FilePath
(
command
.
ch
annel
,
value
);
FilePath
src
=
new
FilePath
(
command
.
ch
eckChannel
()
,
value
);
File
local
=
File
.
createTempFile
(
"hudson"
,
"parameter"
);
src
.
copyTo
(
new
FilePath
(
local
));
...
...
core/src/main/java/hudson/model/ParameterDefinition.java
浏览文件 @
8b92f50f
...
...
@@ -173,7 +173,7 @@ public abstract class ParameterDefinition implements
* Create a parameter value from the string given in the CLI.
*
* @param command
* This is the command that got the parameter. You can use its {@link CLICommand#ch
annel
}
* This is the command that got the parameter. You can use its {@link CLICommand#ch
eckChannel()
}
* for interacting with the CLI JVM.
* @throws AbortException
* If the CLI processing should be aborted. Hudson will report the error message
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录