当前位置:  开发笔记 > 编程语言 > 正文

如何正确使用Jenkins管道`options`

如何解决《如何正确使用Jenkins管道`options`》经验,为你挑选了1个好方法。

摘要生成器properties为我创建了一个区块。首次运行报告

WorkflowScript: 1: The properties section has been renamed as of version 0.8. Use options instead. @ line 1, column 1.
   pipeline {

替换propertiesoptions结果并显示以下错误:

Errors encountered validating Jenkinsfile:
WorkflowScript: 4: options can not be empty @ line 4, column 5.
   options([$class: 'ThrottleJobProperty',

这是完整jenkinsfile的参考

pipeline {
    agent any

    options([[$class: 'ThrottleJobProperty',
            categories: ['xcodebuild'],
            limitOneJobWithMatchingParams: false,
            maxConcurrentPerNode: 0,
            maxConcurrentTotal: 0,
            paramsToUseForLimit: '',
            throttleEnabled: true,
            throttleOption: 'category']])

    stages {
        stage("Empty" {
            steps {
                echo "Do nothing"
            }
        }
    }
}

Anton Matoso.. 7

TLDR

It's no longer possible to use custom $class in the options

Note that [$class: 'Foo', arg1: 'something', ...] syntax can not be used, only booleanParam(...) and the like.

Full Options Syntax

Description: Traditional JobPropertys, such as buildDiscarder or disableConcurrentBuilds, Declarative-specifc options, such as skipDefaultCheckout, and "wrappers" that should wrap the entire build, such as timeout.

Required: No

Allowed In: Top-level pipeline closure only.

Parameters: None

关闭:是的

闭包内容:一个或多个声明性选项或作业属性配置的序列,使用@Symbol构造函数的名称。

注意,[$class: 'Foo', arg1: 'something', ...]不能仅使用语法booleanParam(...)等。

请注意,parameterspipelineTriggers @Symbol不能在此处直接使用。

例:

options {
    buildDiscarder(logRotator(numToKeepStr:'1'))
    disableConcurrentBuilds()
}

资源



1> Anton Matoso..:

TLDR

It's no longer possible to use custom $class in the options

Note that [$class: 'Foo', arg1: 'something', ...] syntax can not be used, only booleanParam(...) and the like.

Full Options Syntax

Description: Traditional JobPropertys, such as buildDiscarder or disableConcurrentBuilds, Declarative-specifc options, such as skipDefaultCheckout, and "wrappers" that should wrap the entire build, such as timeout.

Required: No

Allowed In: Top-level pipeline closure only.

Parameters: None

关闭:是的

闭包内容:一个或多个声明性选项或作业属性配置的序列,使用@Symbol构造函数的名称。

注意,[$class: 'Foo', arg1: 'something', ...]不能仅使用语法booleanParam(...)等。

请注意,parameterspipelineTriggers @Symbol不能在此处直接使用。

例:

options {
    buildDiscarder(logRotator(numToKeepStr:'1'))
    disableConcurrentBuilds()
}

资源


非常有帮助,但是您知道为什么被剪断的Generator仍会生成旧代码吗?有毛病吗?
推荐阅读
ERIK又
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有