jeu*_*nii 3 jenkins-job-dsl jenkins-pipeline
我有一份基于 DSL 的种子工作。这就是看起来的样子
pipelineJob("job name") {
description('Some explanation')
triggers {
cron('@midnight')
upstream('someJob', 'SUCCESS')
}
parameters {
...
Run Code Online (Sandbox Code Playgroud)
当我运行作业时,它最终不稳定并出现错误消息
Warning: (Builds.groovy, line 53) triggers is deprecated
Run Code Online (Sandbox Code Playgroud)
所以现在我重新编写了代码如下
pipelineJob("job name") {
description('Some explanation')
properties {
pipelineTriggers {
triggers {
cron('@midnight')
upstream('someJob', 'SUCCESS')
}
}
parameters {
...
Run Code Online (Sandbox Code Playgroud)
现在我得到了错误
ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.cron() is applicable for argument types: (java.lang.String) values: [@midnight]
Possible solutions: grep(), print(java.io.PrintWriter), print(java.lang.Object), grep(java.lang.Object), wait(), any()
Run Code Online (Sandbox Code Playgroud)
现在我将其重写为
pipelineJob("job name") {
description('Some explanation')
properties {
pipelineTriggers {
triggers {
cron{
spec('@midnight')
}
upstream('someJob', 'SUCCESS')
}
}
parameters {
...
Run Code Online (Sandbox Code Playgroud)
但现在这最终出现了错误
ERROR: (Builds.groovy, line 72) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.upstream() is applicable for argument types: (java.lang.String, java.lang.String) values: [someJob, SUCCESS]
Run Code Online (Sandbox Code Playgroud)
我在这里还错过了什么?
使用网址<JENKINS_URL>/plugin/job-dsl/api-viewer/index.html#path/pipelineJob-properties-pipelineTriggers-triggers
我得到了正确的格式
properties {
pipelineTriggers {
triggers {
cron {
spec('@midnight')
}
upstream{
upstreamProjects('someJob')
threshold('SUCCESS')
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4613 次 |
| 最近记录: |