相关疑难解决方法(0)

如何编写Pipeline来丢弃旧版本?

groovy语法生成器不适用于示例步骤properties: Set Job Properties.我已经选择Discard old builds然后进入10Max # of builds to keep领域,然后Generate Groovy没有任何显示.

詹金斯版:2.7

jenkins jenkins-pipeline

66
推荐指数
7
解决办法
4万
查看次数

如何在jenkins管道中使用`def`

我正在学习jenkins管道,我试着遵循这个管道代码.但我的詹金斯总是抱怨这def不合法.我想知道我是否错过任何插件?我已经安装了groovy,job-dsl但是没有用.

jenkins jenkins-plugins jenkins-pipeline

8
推荐指数
2
解决办法
1万
查看次数

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

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

WorkflowScript: 1: The properties section has been renamed as of version 0.8. Use options instead. @ line 1, column 1.
   pipeline {
Run Code Online (Sandbox Code Playgroud)

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

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

这是完整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" …
Run Code Online (Sandbox Code Playgroud)

groovy jenkins jenkins-pipeline

7
推荐指数
2
解决办法
1万
查看次数

有条件地启用 Jenkins 声明式管道选项?

Jenkins 是否提供任何功能来实现下面描述的以下管道?

pipeline
{
    agent any
    options
    {
        when {
            branch 'master'
        }
        disableConcurrentBuilds()
    }
    stages { ... }
}
Run Code Online (Sandbox Code Playgroud)

对于这个单一管道必须管理的存储库,我有两种状态:

  1. 为提交到合并请求分支(预合并)而构建,允许同时运行构建
  2. 在合并请求(post-merge)合并时构建主分支,不允许同时运行构建。

jenkins jenkins-plugins jenkins-pipeline

6
推荐指数
1
解决办法
1077
查看次数