How can I set an email to be sent upon completion or failure of a job in Concourse?
Asked
Active
Viewed 1,991 times
2 Answers
2
You can use https://github.com/pivotal-cf/email-resource along with the on_failure step: https://concourse-ci.org/on-failure-step.html
![](../../users/profiles/974690.webp)
Dwayne Forde
- 1,206
- 13
- 13
![](../../users/profiles/1013507.webp)
Benedict Dodd
- 245
- 2
- 8
-
Can this be expanded upon? How do you use a "put" resource within the on failure task? Example please? – Austin L Jan 06 '20 at 20:42
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: 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
Checkout the documentation for more details on the email resource https://github.com/pivotal-cf/email-resource
![](../../users/profiles/3591417.webp)
Peter Arboleda
- 195
- 1
- 10