如何通过 Concourse CI 管道发送电子邮件?

How to send email via Concourse CI pipeline?

如何设置在 Concourse 中完成或失败时发送电子邮件?

您可以使用https://github.com/pivotal-cf/email-resource along with the on_failure step: https://concourse-ci.org/on-failure-step.html

我认为这可能已经得到解答,但如果有帮助,它看起来会是这样的:

jobs:
- name: myBuild 
  plan:      
  - get: your-repo
    passed: []
    trigger: false
  - task: run-tests
    file: runMyTestsTask.yml   
  on_failure:
  - put: send-an-email
    params:
      subject_text: "Your email subect i.e Failed Build"
      body_text: "Your message when the build has failed"
  on_success:
    put: push-my-build

## Define your additional resources here

resources:
- name: send-an-email
  type: email
  source:
    smtp:
      host: smtp.example.com
      port: "587" # this must be a string
      username: a-user
      password: my-password
    from: build-system@example.com
    to: [ "dev-team@example.com", "product@example.net" ] #optional if `params.additional_recipient` is specified

resource_types:
  - name: email
    type: docker-image
    source:
      repository: pcfseceng/email-resource  

查看文档以获取有关电子邮件资源的更多详细信息 https://github.com/pivotal-cf/email-resource