Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concourse CI: Use Metadata (Build number, URL etc) in on_success/on_failure

Tags:

concourse

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.

like image 697
Max Romanovsky Avatar asked Sep 18 '25 15:09

Max Romanovsky


1 Answers

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.

like image 128
jtarchie Avatar answered Sep 23 '25 05:09

jtarchie