3

How is it possible to use Metadata in on_success/on_failure? For example, to send emails via https://github.com/pivotal-cf/email-resource?

I haven't found a way, as I can't change content of files where email resources reside (subject/body), as the metadata is not available to tasks.

And yep, that might be a duplicate for Concourse CI and Build number

But still my question IMHO is a valid use case for notifications.

Max Romanovsky
  • 2,644
  • 5
  • 26
  • 36

1 Answers1

2

The metadata you are referring to, I assume, is the environment variables provided to resources, not tasks.

This can be used with the slack resource to provide information about what build failed.

For example:

on_failure:
    put: slack-alert
    params:
      text: |
        The `science` pipeline has failed. Please resolve any issues and ensure the pipeline lock was released. Check it out at:
        $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME

The email resource, you're referencing has an open PR to support these environment variables. I'd discuss your need for that feature there.

ajsharma
  • 1,169
  • 1
  • 10
  • 16
jtarchie
  • 253
  • 2
  • 12