Jenkins 在 dsl 中禁用标记每个构建

Jenkins disable tag every build in dsl

我的工作dsl如下

pipelineJob('demo/Development') {
     definition {
    cpsScm {
        scm {
                 git('https://github.com/demo/demo.git','development')
        }
        scriptPath('Jenkinsfile')
    }
}
}

创建作业时,它默认添加了附加行为,用于为每个构建创建标签。我怎样才能在工作 dsl 上禁用它?

已成功解决问题

 git('https://github.com/demo/demo.git','development',{node -> node / 'extensions' << '' })

只需要添加配置块来摆脱扩展块,如果需要可以直接修改xml。

另一个选项(在 Jenkins Job DSL 1.64 中)是添加一个空的配置块。如果您需要为 scm 设置其他值,这很有用,例如:

pipelineJob('DSL_Pipeline') {

  def repo = 'https://github.com/path/to/your/repo.git'

  triggers {
    scm('H/5 * * * *')
  }
  description("Pipeline for $repo")

  definition {
    cpsScm {
      scm {
        git {
          remote { url(repo) }
          branches('master', '**/feature*')
          scriptPath('misc/Jenkinsfile.v2')
          extensions { }
        }

      }
    }
  }
}

http://job-dsl.herokuapp.com/ 是破解 DSL 并找出有效方法的有用工具。