How can I set an email to be sent upon completion or failure of a job in Concourse?
How to send email via Concourse CI pipeline?
Asked Answered
You can use https://github.com/pivotal-cf/email-resource along with the on_failure step: https://concourse-ci.org/on-failure-step.html
Can this be expanded upon? How do you use a "put" resource within the on failure task? Example please? –
Huxley
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
© 2022 - 2024 — McMap. All rights reserved.