Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
f97b5b33
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,发现更多精彩内容 >>
提交
f97b5b33
编写于
3月 28, 2014
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show the user examples of when a cron tab list should actually run.
上级
ce1df7d3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
11 deletion
+52
-11
changelog.html
changelog.html
+2
-0
core/src/main/java/hudson/scheduler/CronTabList.java
core/src/main/java/hudson/scheduler/CronTabList.java
+28
-1
core/src/main/java/hudson/triggers/TimerTrigger.java
core/src/main/java/hudson/triggers/TimerTrigger.java
+19
-9
core/src/main/resources/hudson/triggers/Messages.properties
core/src/main/resources/hudson/triggers/Messages.properties
+3
-1
未找到文件。
changelog.html
浏览文件 @
f97b5b33
...
...
@@ -55,6 +55,8 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
rfe
>
Cron-style trigger configuration will now display expected prior and subsequent run times.
<li
class=
bug
>
Incorrect filtering of build queue and executors widgets after 1.514.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-20500"
>
issue 20500
</a>
)
...
...
core/src/main/java/hudson/scheduler/CronTabList.java
浏览文件 @
f97b5b33
...
...
@@ -24,10 +24,12 @@
package
hudson.scheduler
;
import
antlr.ANTLRException
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Vector
;
import
javax.annotation.CheckForNull
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.NoExternalUse
;
/**
* {@link CronTab} list (logically OR-ed).
...
...
@@ -89,4 +91,29 @@ public final class CronTabList {
}
return
new
CronTabList
(
r
);
}
@Restricted
(
NoExternalUse
.
class
)
// just for form validation
public
@CheckForNull
Calendar
previous
()
{
Calendar
nearest
=
null
;
for
(
CronTab
tab
:
tabs
)
{
Calendar
scheduled
=
tab
.
floor
(
Calendar
.
getInstance
());
if
(
nearest
==
null
||
nearest
.
before
(
scheduled
))
{
nearest
=
scheduled
;
}
}
return
nearest
;
}
@Restricted
(
NoExternalUse
.
class
)
// just for form validation
public
@CheckForNull
Calendar
next
()
{
Calendar
nearest
=
null
;
for
(
CronTab
tab
:
tabs
)
{
Calendar
scheduled
=
tab
.
ceil
(
Calendar
.
getInstance
());
if
(
nearest
==
null
||
nearest
.
after
(
scheduled
))
{
nearest
=
scheduled
;
}
}
return
nearest
;
}
}
core/src/main/java/hudson/triggers/TimerTrigger.java
浏览文件 @
f97b5b33
...
...
@@ -23,19 +23,21 @@
*/
package
hudson.triggers
;
import
antlr.ANTLRException
;
import
hudson.Extension
;
import
static
hudson
.
Util
.
fixNull
;
import
hudson.model.BuildableItem
;
import
hudson.model.Cause
;
import
hudson.model.Item
;
import
hudson.scheduler.CronTabList
;
import
hudson.scheduler.Hash
;
import
hudson.util.FormValidation
;
import
hudson.Extension
;
import
java.text.DateFormat
;
import
java.util.Calendar
;
import
org.kohsuke.stapler.AncestorInPath
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.QueryParameter
;
import
antlr.ANTLRException
;
/**
* {@link Trigger} that runs a job periodically.
*
...
...
@@ -64,18 +66,26 @@ public class TimerTrigger extends Trigger<BuildableItem> {
}
// backward compatibility
public
FormValidation
doCheck
(
@QueryParameter
String
value
)
{
return
doCheckSpec
(
value
);
public
FormValidation
doCheck
(
@QueryParameter
String
value
,
@AncestorInPath
Item
item
)
{
return
doCheckSpec
(
value
,
item
);
}
/**
* Performs syntax check.
*/
public
FormValidation
doCheckSpec
(
@QueryParameter
String
value
)
{
public
FormValidation
doCheckSpec
(
@QueryParameter
String
value
,
@AncestorInPath
Item
item
)
{
try
{
String
msg
=
CronTabList
.
create
(
fixNull
(
value
)).
checkSanity
();
CronTabList
ctl
=
CronTabList
.
create
(
fixNull
(
value
),
item
!=
null
?
Hash
.
from
(
item
.
getFullName
())
:
null
);
String
msg
=
ctl
.
checkSanity
();
if
(
msg
!=
null
)
return
FormValidation
.
warning
(
msg
);
return
FormValidation
.
ok
();
Calendar
prev
=
ctl
.
previous
();
Calendar
next
=
ctl
.
next
();
if
(
prev
!=
null
&&
next
!=
null
)
{
DateFormat
fmt
=
DateFormat
.
getDateTimeInstance
(
DateFormat
.
FULL
,
DateFormat
.
FULL
);
return
FormValidation
.
ok
(
Messages
.
TimerTrigger_would_last_have_run_at_would_next_run_at
(
fmt
.
format
(
prev
.
getTime
()),
fmt
.
format
(
next
.
getTime
())));
}
else
{
return
FormValidation
.
warning
(
Messages
.
TimerTrigger_no_schedules_so_will_never_run
());
}
}
catch
(
ANTLRException
e
)
{
if
(
value
.
trim
().
indexOf
(
'\n'
)==-
1
&&
value
.
contains
(
"**"
))
return
FormValidation
.
error
(
Messages
.
TimerTrigger_MissingWhitespace
());
...
...
core/src/main/resources/hudson/triggers/Messages.properties
浏览文件 @
f97b5b33
...
...
@@ -26,5 +26,7 @@ SCMTrigger.BuildAction.DisplayName=Polling Log
SCMTrigger.SCMTriggerCause.ShortDescription
=
Started by an SCM change
TimerTrigger.DisplayName
=
Build periodically
TimerTrigger.MissingWhitespace
=
You appear to be missing whitespace between * and *.
TimerTrigger.no_schedules_so_will_never_run
=
No schedules so will never run
TimerTrigger.TimerTriggerCause.ShortDescription
=
Started by timer
Trigger.init
=
Initializing timer for triggers
\ No newline at end of file
TimerTrigger.would_last_have_run_at_would_next_run_at
=
Would last have run at {0}; would next run at {1}.
Trigger.init
=
Initializing timer for triggers
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录