简体   繁体   English

Jenkins DSL API中的声纳质量门

[英]Sonar Quality Gate in Jenkins DSL API

I´m using Jenkins DSL to create my jobs, and I would like to use one of the sonar plugins to check the Quality gate that I configure in Sonar. 我正在使用Jenkins DSL创建我的工作,我想使用一个声纳插件来检查我在Sonar中配置的质量门。 I´ve been checking in Jenkins DSL API but I cannot find anything. 我一直在检查Jenkins DSL API,但找不到任何东西。

Anybody knows if there´s an option in Jenkins DSL to add that option in my job? 有人知道Jenkins DSL中是否有可以在我的工作中添加该选项的选项?

Regards. 问候。

The Job DSL API does not support all plugins. Job DSL API不支持所有插件。 Try to configure the job manually, then port the config to Job DSL. 尝试手动配置作业,然后将配置移植到作业DSL。 Use a Configure Block to add any config not suppored by the API. 使用配置块可添加API不支持的任何配置。

The following configure block worked for me: 以下配置块对我有用:

configure { project ->
  project / 'publishers' << 'org.quality.gates.jenkins.plugin.QGPublisher' {
    jobConfigData{
      projectKey('yourKey')
      sonarInstanceName('yourSonar')   
      buildStatus('UNSTABLE')             
    }  
    buildDecision{
      qualityGatesProvider{
        qualityGateResponseParser{}
        sonarHttpRequester(class: 'org.quality.gates.sonar.api61.SonarHttpRequester61')
        {
          logged('false')
        }
        sonarInstanceValidationService{}
      }
    }
    jobConfigurationService{}
    jobExecutionService{}
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM