How to send email via Concourse CI pipeline?
Asked Answered
S

2

7

How can I set an email to be sent upon completion or failure of a job in Concourse?

Secretariat answered 28/9, 2016 at 15:56 Comment(0)
M
3

You can use https://github.com/pivotal-cf/email-resource along with the on_failure step: https://concourse-ci.org/on-failure-step.html

Might answered 29/9, 2016 at 5:32 Comment(1)
Can this be expanded upon? How do you use a "put" resource within the on failure task? Example please?Huxley
P
0

I think this may be already answered but if it helps it will look something this:

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: [email protected]
    to: [ "[email protected]", "[email protected]" ] #optional if `params.additional_recipient` is specified

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

Checkout the documentation for more details on the email resource https://github.com/pivotal-cf/email-resource

Piecework answered 12/1, 2020 at 17:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.