Skip to content

mdomke/concourse-email-resource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Resource

A Concourse CI resource to send emails.

Source Configuration

  • from: Required. The email address of the sender as a string.

  • host: Optional. The smtp host to send from.

Example

Adding the resource to your project:

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

Resource configuration:

resources:
- name: send-email
  type: email
  source:
    from: ci@example.com
    host: smtp.example.com

Sending an email message:

- put: send-email
  params:
    to: [recipient@example.com]
    subject: subject.txt
    body: body.txt

Behavior

check and in operations are a noop.

out: Send an email message

Parameters

  • to|to_file: (mandatory) Use to to specify a list of recipients as strings or use to_file to specify file with addresses, each address should be in a new line.
  • subject|subject_text: (mandatory) Use subject to specify a path to the file holding the email subject or use subject_text to specify a plain text subject.
  • body|body_text: (mandatory) Use body to specify a path to the file holding the email body or use body_text to specify a plain text email body.
  • vars: (optional) A path to a JSON-file holding template vars.
  • type: (optional) The MIME subtype (defaults to "html")
  • inline_css: (optional) Inline CSS to style attributes in HTML.
  • attachments: A list of file names that will be attached to the email. Attachments only work if type is "html", wildcards (*) are supported, ex: your-attachment-*.zip.

subject|subject_text and body|body_text can both either be plain text, html or a jinja-template. In the latter case you can specify an additional file (vars) for holding template variables that should be rendered into the template. Additionally to the variables from the vars-file, all environment variables can be used in the template (e.g.: BUILD_ID). By default (if the MIME subtype is "html"), the CSS styles will be inlined to the HTML. If you don't want that, you can set the inline_css parameter to False. If you want to use jinja-template in subject_text or body_text you need to define the content as a multiline text, otherwise a syntax error will be reported for malformed yaml.

- put: send-email
  params:
    to: [recipient@example.com]
    subject_text: |
      {% block BUILD_PIPELINE_NAME %}{% endblock %}:{% block BUILD_JOB_NAME %}{% endblock %} failed
    body_text: |
      {% block BUILD_PIPELINE_NAME %}{% endblock %}:{% block BUILD_JOB_NAME %}{% endblock %} failed

A more elaborate usage example would look like this:

- put: send-email
  params:
    to: [recipient@example.com]
    subject: subject
    body: body.html
    vars: vars.json

or for a plain text example:

- put: send-email
  params:
    to: [recipient@example.com]
    subject: subject.txt
    body: body.txt
    type: plain

About

A simple email resource for concourse CI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages