如何使用jenkins dsl脚本发布valgrind结果

时间:2017-02-20 12:54:21

标签: jenkins jenkins-job-dsl

如何使用dsl脚本在jenkins中发布生成的valgrind结果。我可以做publishers.archiveArtifacts / publishers.archiveJunit,但我无法对valgrind做同样的事。

我尝试了下面的事情,但得到了以下异常

job.publishers {
 configure { node ->
   node << 'org.jenkinsci.plugins.valgrind.ValgrindPublisher' {
   }
 }
}

javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.configure() is applicable for argument types:
 (builders.JobBuilder$_create_job_closure6_closure19) values
 [builders.JobBuilder$_create_job_closure6_closure19@af5d326]

1 个答案:

答案 0 :(得分:0)

Configure Block仅适用于job上下文,但不适用于publishers上下文:

job('example-1') {
  configure { node ->
    node / publishers << 'org.jenkinsci.plugins.valgrind.ValgrindPublisher' {
      // options
    }
  }
}

作为替代方案,您可以使用Automatically Generated DSL

job(String name) {
  publishers {
    valgrindPublisher {
      pattern(String value)
      failThresholdInvalidReadWrite(String value)
      failThresholdDefinitelyLost(String value)
      failThresholdTotal(String value)
      unstableThresholdInvalidReadWrite(String value)
      unstableThresholdDefinitelyLost(String value)
      unstableThresholdTotal(String value)
      publishResultsForAbortedBuilds(boolean value)
      publishResultsForFailedBuilds(boolean value)
      failBuildOnMissingReports(boolean value)
      failBuildOnInvalidReports(boolean value)
    }
  }
}