Jenkins JObDSL条件构建步骤发送电子邮件问题

时间:2015-05-20 17:49:11

标签: groovy jenkins

如果条件为真,我正在尝试编写jobdsl块以进行条件构建步骤发送电子邮件, 它失败了,请帮助改进下面的代码(下面的堆栈跟踪)

   job {
    name 'ci'
    description 'Build and test the app.'
    scm {
      git {
        remote {
          github 'sheehan/job-dsl-playground'
        }
      }
    }
   steps {
      gradle 'test'
       conditionalSteps {
         condition {
             stringsMatch('${ENV,var="CHILD_BUILD"}', "true", false)
         }
         extendedEmail("mthakkar@mycompany.com", "for Componets",
                      "Test Jira")  
    }
  }
        publishers {
          archiveJunit 'build/test-results/**/*.xml'
      }
}

堆栈追踪:

  

groovy.lang.MissingMethodException:没有方法签名:   javaposse.jobdsl.dsl.helpers.step.ConditionalStepsContext.extendedEmail()   适用于参数类型:(java.lang.String,java.lang.String,   java.lang.String)值:[mthakkar@mycompany.com,适用于Componets,Test   吉拉]   javaposse.jobdsl.dsl.helpers.AbstractExtensibleContext.methodMissing(AbstractExtensibleContext.groovy:19)     在   javaposse.jobdsl.dsl.AbstractContext.invokeMethod(AbstractContext.groovy)     在   script14321438737322039521488 $ _run_closure1_closure3_closure7.doCall(script14321438737322039521488.groovy:17)     在   script14321438737322039521488 $ _run_closure1_closure3_closure7.doCall(script14321438737322039521488.groovy)     在   javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:14)     在javaposse.jobdsl.dsl.ContextHelper $ executeInContext.call(未知   来源)at   javaposse.jobdsl.dsl.ContextHelper $ executeInContext.call(未知   来源)at   javaposse.jobdsl.dsl.helpers.step.StepContext.conditionalSteps(StepContext.groovy:554)     在   script14321438737322039521488 $ _run_closure1_closure3.doCall(script14321438737322039521488.groovy:13)at   script14321438737322039521488 $ _run_closure1_closure3.doCall(script14321438737322039521488.groovy)     在   javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:14)     在javaposse.jobdsl.dsl.ContextHelper $ executeInContext.call(未知   来源)at   javaposse.jobdsl.dsl.ContextHelper $ executeInContext.call(未知   来源)在javaposse.jobdsl.dsl.Job.steps(Job.groovy:510)at at   script14321438737322039521488 $ _run_closure1.doCall(script14321438737322039521488.groovy:11)     在javaposse.jobdsl.dsl.JobParent.job(JobParent.groovy:110)at   javaposse.jobdsl.dsl.JobParent.job(JobParent.groovy)at at   javaposse.jobdsl.dsl.DslFactory $ job.callCurrent(未知来源)at at   script14321438737322039521488.run(script14321438737322039521488.groovy:1)     在   javaposse.jobdsl.dsl.DslScriptLoader.runDslEngineForParent(DslScriptLoader.java:72)     在   javaposse.jobdsl.dsl.DslScriptLoader $ runDslEngineForParent.call(未知   来源)at   com.sheehan.jobdsl.DslScriptExecutor.execute(DslScriptExecutor.groovy:31)     在com.sheehan.jobdsl.ScriptExecutor $ execute.call(未知来源)at   Ratpack $ _run_closure1_closure3_closure7.doCall(Ratpack.groovy:39)at   ratpack.groovy.internal.ClosureInvoker.invoke(ClosureInvoker.java:65)     在   ratpack.groovy.handling.internal.ClosureBackedHandler.handle(ClosureBackedHandler.java:42)

1 个答案:

答案 0 :(得分:0)

我目前无法测试此扩展电子邮件步骤是发布商

根据documentation

  

出版商

     

阻止包含发布商列表。

     

扩展电子邮件插件

 job {
     publishers {
         extendedEmail(String recipients = null, String subjectTemplate = null,
                       String contentTemplate = null) {
             trigger(String triggerName, String subject = null, String body = null,
                     String recipientList = null, Boolean sendToDevelopers = null,
                     Boolean sendToRequester = null, includeCulprits = null,
                     Boolean sendToRecipientList = null)
             trigger(Map args)
             configure(Closure configureClosure)
         }
     }
 }