小编Dan*_*ann的帖子

如何在多个代理上使用Jenkins管道的后续步骤?

当使用詹金斯管道,其中每个阶段都会对不同的代理运行时,它是很好的做法,以使用agent none开头:

pipeline {
  agent none
  stages {
    stage('Checkout') {
      agent { label 'master' }
      steps { script { currentBuild.result = 'SUCCESS' } }
    }
    stage('Build') {
      agent { label 'someagent' }
      steps { bat "exit 1" }
    }
  }
  post {
    always {
      step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "test@test.com", sendToIndividuals: true])
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但这样做会导致Required context class hudson.FilePath is missing电子邮件出现时出现错误消息:

[Pipeline] { (Declarative: Post Actions)
[Pipeline] step
Required context class hudson.FilePath is missing …
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-pipeline

19
推荐指数
2
解决办法
1万
查看次数

如何为 Jenkins 管道获取相同的 Mailer 行为

我开始使用 Jenkins 声明式管道。现在,我希望具有与Mailer 插件的使用中定义的相同的电子邮件通知行为:

  1. 每个失败的构建都会触发一封新电子邮件。
  2. 在失败(或不稳定)构建之后成功构建会触发新电子邮件,表明危机已经结束。
  3. 成功构建后的不稳定构建会触发一封新电子邮件,表明存在回归。
  4. 除非配置,否则每个不稳定的构建都会触发一封新电子邮件,表明回归仍然存在。

我阅读了Pipelines 中的 Notifications,但它没有根据上述规则进行通知。另外,在构建失败的情况下,消息正文中不包含控制台输出的一部分。

有人知道如何在声明性管道中做到这一点吗?

jenkins jenkins-pipeline

5
推荐指数
1
解决办法
2196
查看次数

标签 统计

jenkins ×2

jenkins-pipeline ×2