[英]Jenkins shared library - create a generic function for the options section
我想扩展共享库的用法-想添加一个函数,其中包含管道的所有选项:
options {
disableConcurrentBuilds()
timestamps()
timeout(time: 30, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '30'))
}
所以在我的管道中,我会遇到类似
pipeline {
agent any
pipelineOptions()
stages {
stage('phase1') {
steps {
sh 'echo Hello World '
}
}
}
}
尝试了类似的东西,但是没有用
//pipelineOptions.groovy
def call() {
options {
disableConcurrentBuilds()
timestamps()
timeout(time: 5, unit: 'MINUTES')
//buildDiscarder(logRotator(numToKeepStr: ' params.history'))
buildDiscarder(logRotator(numToKeepStr: ' 5'))
}
}
找不到如何做...,有可能吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.