【发布时间】:2019-11-08 12:02:16
【问题描述】:
嘿,我想以编程方式配置一个带有管道作业的 Jenkins 管道,您可以在以下位置找到它:https://github.com/divramod/pipeline-testing/blob/master/cicd/jobs/master.jenkins
这运行良好。但是现在,我也喜欢以编程方式配置管道的其他部分,我不知道从哪里开始。例如,我喜欢配置 repo 的 github url,我可以在以下位置手动配置:
我也喜欢自动检查构建触发器,但不知道在哪里搜索正确的 groovy 配置命令:(如您所见)
pipelineJob('master pipe') {
displayName('Master pipe')
logRotator {
numToKeep(10)
daysToKeep(30)
}
configure { project ->
project / 'properties' / 'org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty' {
hint('PERFORMANCE_OPTIMIZED')
}
}
definition {
cpsScm {
scm {
git {
remote {
url('git@github.com:divramod/pipeline-testing.git')
credentials('jenkins')
}
branches('*/master')
}
}
scriptPath('cicd/pipelines/master.jenkins')
}
}
}
【问题讨论】: