Groovy script fails to call Slack notification parameter from Jenkins DSL job

坚强是说给别人听的谎言 提交于 2019-12-04 16:36:57

Hm, that's a bug in Job DSL, see JENKINS-39153.

You actually do not need to use the template string syntax "${FOO}" if you just want to use the value of FOO. All parameters are string variables which can be used directly:

job(JOB_NAME) {
  // ...
  publishers {
    slackNotifier {
      room(SLACK_CHANNEL)
      notifyAborted(true)
      notifyFailure(true)
      notifyNotBuilt(false)
      notifyUnstable(true)
      notifyBackToNormal(true)
      notifySuccess(false)
      notifyRepeatedFailure(false)
      startNotification(false)
      includeTestSummary(false)
      includeCustomMessage(false)
      customMessage(null)
      buildServerUrl(null)
      sendAs(null)
      commitInfoChoice('NONE')
      teamDomain(null)
      authToken(null)
    }
  }
  // ...
}

This syntax is more concise and does not trigger the bug.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!