Srushti Patare
Srushti Patare

Reputation: 1

Can we send a file as an alert to SLACK via concourse

I am trying to send a CSV file as an alert to Slack via Concourse but not able to do so -- Any thoughts on this?

Is there a way with which we can send a file and get it as an alert into SLACK?

Upvotes: 0

Views: 474

Answers (1)

Anshita Singh
Anshita Singh

Reputation: 1884

Whatever file you want to send in slack. Upload in s3 (you can find other resources also) via concourse. For uploading a file into s3, you can configure s3 resource in concourse like this:

name: s3_upload_file
  type: s3
  source:
    access_key_id: <give_access_key>
    bucket: <bucket-name>
    secret_access_key: <secret-access-key>
    regexp: <file name or you can specify regex also here>

After uploading a file into s3, put an s3 URL in a file via concourse script like following:

echo -e "File can be downloaded from <s3-url> >> slack.txt"

And then sent this message into slack like this:

- put: slack-alert
        params:
          always_notify: true
          channel: ((slack-channel-name))
          text_file: 
          text: |
            $TEXT_FILE_CONTENT

So, with the URL anyone can download file from s3 or any other source wherever you have uploaded.

Upvotes: 2

Related Questions