Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
259477a1
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
259477a1
编写于
8月 09, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-9968] added an option to do polling before a build.
上级
b3758892
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
40 addition
and
1 deletion
+40
-1
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/cli/BuildCommand.java
core/src/main/java/hudson/cli/BuildCommand.java
+16
-1
core/src/main/java/hudson/cli/CLICommand.java
core/src/main/java/hudson/cli/CLICommand.java
+21
-0
未找到文件。
changelog.html
浏览文件 @
259477a1
...
...
@@ -77,6 +77,9 @@ Upcoming changes</a>
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10414"
>
issue 10414
</a>
)
<li
class=
rfe
>
Added a dignosis CLI command to report the current granted authorities.
<li
class=
rfe
>
Added an option in CLI build command to check for SCM changes before carrying out a build
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-9968"
>
issue 9968
</a>
)
<li
class=
rfe
>
If CLI fails to connect via a JNLP Slave port, fall back to HTTP full-duplex.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10611"
>
issue 10611
</a>
)
...
...
core/src/main/java/hudson/cli/BuildCommand.java
浏览文件 @
259477a1
...
...
@@ -30,13 +30,17 @@ import hudson.model.ParametersAction;
import
hudson.model.ParameterValue
;
import
hudson.model.ParametersDefinitionProperty
;
import
hudson.model.ParameterDefinition
;
import
hudson.model.TaskListener
;
import
hudson.Extension
;
import
hudson.AbortException
;
import
hudson.model.Item
;
import
hudson.util.EditDistance
;
import
hudson.scm.PollingResult
;
import
hudson.util.StreamTaskListener
;
import
org.kohsuke.args4j.Argument
;
import
org.kohsuke.args4j.Option
;
import
java.nio.charset.Charset
;
import
java.util.concurrent.Future
;
import
java.util.Map
;
import
java.util.HashMap
;
...
...
@@ -63,6 +67,9 @@ public class BuildCommand extends CLICommand {
@Option
(
name
=
"-s"
,
usage
=
"Wait until the completion/abortion of the command"
)
public
boolean
sync
=
false
;
@Option
(
name
=
"-c"
,
usage
=
"Check for SCM changes before starting the build, and if there's no change, exit without doing a build"
)
public
boolean
checkSCM
=
false
;
@Option
(
name
=
"-p"
,
usage
=
"Specify the build parameters in the key=value format."
)
public
Map
<
String
,
String
>
parameters
=
new
HashMap
<
String
,
String
>();
...
...
@@ -89,6 +96,12 @@ public class BuildCommand extends CLICommand {
a
=
new
ParametersAction
(
values
);
}
if
(
checkSCM
)
{
if
(
job
.
poll
(
new
StreamTaskListener
(
stdout
,
getClientCharset
()))
==
PollingResult
.
NO_CHANGES
)
{
return
0
;
}
}
Future
<?
extends
AbstractBuild
>
f
=
job
.
scheduleBuild2
(
0
,
new
CLICause
(),
a
);
if
(!
sync
)
return
0
;
...
...
@@ -104,7 +117,9 @@ public class BuildCommand extends CLICommand {
"Aside from general scripting use, this command can be\n"
+
"used to invoke another job from within a build of one job.\n"
+
"With the -s option, this command changes the exit code based on\n"
+
"the outcome of the build (exit code 0 indicates a success.)\n"
"the outcome of the build (exit code 0 indicates a success.)\n"
+
"With the -c option, a build will only run if there has been\n"
+
"an SCM change"
);
}
...
...
core/src/main/java/hudson/cli/CLICommand.java
浏览文件 @
259477a1
...
...
@@ -51,8 +51,11 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.PrintStream
;
import
java.lang.reflect.Type
;
import
java.nio.charset.Charset
;
import
java.nio.charset.UnsupportedCharsetException
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
/**
...
...
@@ -303,6 +306,24 @@ public abstract class CLICommand implements ExtensionPoint, Cloneable {
private
static
final
long
serialVersionUID
=
1L
;
}
protected
Charset
getClientCharset
()
throws
IOException
,
InterruptedException
{
String
charsetName
=
channel
.
call
(
new
GetCharset
());
try
{
return
Charset
.
forName
(
charsetName
);
}
catch
(
UnsupportedCharsetException
e
)
{
LOGGER
.
log
(
Level
.
FINE
,
"Server doesn't have charset "
+
charsetName
);
return
Charset
.
defaultCharset
();
}
}
private
static
final
class
GetCharset
implements
Callable
<
String
,
IOException
>
{
public
String
call
()
throws
IOException
{
return
Charset
.
defaultCharset
().
name
();
}
private
static
final
long
serialVersionUID
=
1L
;
}
/**
* Convenience method for subtypes to obtain environment variables of the client.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录