# How can I send an Allure report link to Slack?

**URL:** <https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510>\
**Category:** Pipeline Workflows\
**Created:** [February 22, 2021, 12:50pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510 "2021-02-22T12:50:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [February 22, 2021, 12:50pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/1 "2021-02-22T12:50:11Z")

</div>

For example, I have three last steps in my pipeline and I would like to have not only the message in slack but also a link to the allure report as well

prepare:  
title: “Prepare report”  
stage: “prepare”  
image: ‘ubuntu’ # The image in which command will be executed  
working\_directory: “${{clone}}” # Running command where code cloned  
commands:  
- “cp -r -f ./allure-results $CF\_VOLUME\_PATH/allure-results”

generate:  
title: Generate test reporting  
stage: “generate”  
image: codefresh/cf-docker-test-reporting  
working\_directory: ‘${{CF\_VOLUME\_PATH}}’  
environment:  
- CLEAR\_TEST\_REPORT=true  
- BUCKET\_NAME=example-allure-reports  
- CF\_STORAGE\_INTEGRATION=allure

slack notify:  
title: Slack notify  
stage: “slack notify”  
type: slack-notifier  
arguments:  
SLACK\_HOOK\_URL: “${{SLACK\_HOOK\_URL}}”  
SLACK\_TEXT: “Test completed”

An output from the “generate” stage is

All 92 report files was successfully uploaded  
You can access report on:  
[Codefresh | console](https://g.codefresh.io/api/testReporting/v2/5ff4681a40143fwfwffds1ec/main/s3/allure/example-allure-reports/6033729asdsadf342a/index.html)  
Start removing test report folder  
Annotation cf\_test\_reporter\_link was created.

How can I get this URL after every single pipeline run and post it to slack?

---

<div class="post-metadata">

**Author:** ![laurent.rochette](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/laurent.rochette/32/329_2.png) [@laurent.rochette](https://community.codefresh.io/u/laurent.rochette)\
**Post date:** [February 25, 2021, 3:54pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/2 "2021-02-25T15:54:20Z")

</div>

What about a pipeline hook?

> **[Hooks](https://codefresh.io/docs/docs/codefresh-yaml/hooks/#pipeline-hooks)**
>
> Execute commands before/after each pipeline or step

---

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [February 25, 2021, 4:56pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/3 "2021-02-25T16:56:59Z")

</div>

Thank you for your answer. The main problem is this annotation “cf\_test\_reporter\_link”. I see it generated in the console log but unfortunately, I can’t get it and transfer it to Slack.

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [February 26, 2021, 2:23pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/4 "2021-02-26T14:23:12Z")

</div>

You should be able to get all annotations with the Codefresh CLI in a pipeline [Annotations · Codefresh | Docs](https://codefresh.io/docs/docs/codefresh-yaml/annotations/#viewingediting-annotations)

I need to double check if the test report is always annotating with the URL, but I believe it does. You can easily use the Codefresh CLI in a pipeline step [Codefresh API · Codefresh | Docs](https://codefresh.io/docs/docs/integrations/codefresh-api/#using-codefresh-from-within-codefresh)

---

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [March 9, 2021, 10:22pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/5 "2021-03-09T22:22:54Z")

</div>

To use Codefresh CLI I have to set ‘image: codefresh/cli’ and yes, from here I can get an annotation but the main problem is the Slack step.

```auto
slack notify:
  title: Slack notify
  stage: “slack notify”
  type: slack-notifier
    arguments:
      SLACK_HOOK_URL: “${{SLACK_HOOK_URL}}”
      SLACK_TEXT: “Test completed”

```

I can’t use image: codefresh/cli here or maybe I just don’t know how to do it. How I can get an annotation for this step?

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [March 10, 2021, 8:18am UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/6 "2021-03-10T08:18:27Z")

</div>

You need to use two steps. One with codefresh cli and [cf\_export](https://codefresh.io/docs/docs/codefresh-yaml/variables/#using-cf_export-command) to create an environment variable with the result. And one with slack that uses the result

Here is the idea (just pseudocode)

```auto
version: '1.0'
steps:
  allure_link_fetch:
    title: Getting Test URL
    image: codefresh/cli
    commands:
      - 'TEST_URL =$(codefresh get annotation ...)
      - cf_export TEST_URL
  slack_notify:
    title: Slack notify
    stage: “slack notify”
    type: slack-notifier
    arguments:
      SLACK_HOOK_URL: “${{SLACK_HOOK_URL}}”
      SLACK_TEXT: “Test completed at $TEST_URL”

```

Does that help?

---

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [March 10, 2021, 9:15pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/7 "2021-03-10T21:15:22Z")

</div>

I have already tried this case and the console log of the previous step (Before Slack) is here

> Executing command: TEST\_URL= $(codefresh get annotation build ${{CF\_BUILD\_ID}})  
> Successfully ran freestyle step: Get report  
> Reading environment variable exporting file contents.

* * *

> Executing command: cf\_export TEST\_URL  
> Exporting TEST\_URL=  
> Reading environment variable exporting file contents.
> 
> ![Screenshot 2021-03-10 at 23.13.32](https://us1.discourse-cdn.com/flex019/uploads/codefreshtest/original/1X/8e3548ed4d6ae7a21852fe6b75f31ad5333eaae3.png)

---

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [March 10, 2021, 9:45pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/8 "2021-03-10T21:45:55Z")

</div>

I can have an output to the console of what I want.  
The next step is to save this URL in the variable and transfer it to the last step which is Slack.

> get report:  
> title: Get report  
> stage: “get report”  
> image: codefresh/cli  
> commands:  
> - ‘codefresh get annotation build ${{CF\_BUILD\_ID}} cf\_test\_reporter\_link’  
> - cf\_export cf\_test\_reporter\_link

> slack notify:  
> title: Slack notify  
> stage: “slack notify”  
> type: slack-notifier  
> arguments:  
> SLACK\_HOOK\_URL: “${{SLACK\_HOOK\_URL}}”  
> SLACK\_TEXT: “Test completed $cf\_test\_reporter\_link”

 ![Screenshot 2021-03-10 at 23.41.06](https://us1.discourse-cdn.com/flex019/uploads/codefreshtest/original/1X/c006f33350caeefe12b77c41bb78c28def0d05ef.png)  
and I don’t know how to do it.

---

<div class="post-metadata">

**Author:** ![mikhail-klimko](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/mikhail-klimko/32/341_2.png) [@mikhail-klimko](https://community.codefresh.io/u/mikhail-klimko)\
**Post date:** [March 11, 2021, 11:27am UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/9 "2021-03-11T11:27:41Z")

</div>

Try this:

> ```
> get report:
> title: Get report
> stage: “get report”
> image: codefresh/cli
> commands:
> - cf_export cf_test_reporter_link=$(codefresh get annotation build ${{CF_BUILD_ID}} cf_test_reporter_link -o json | jq -r '.value')
> 
> ```

---

<div class="post-metadata">

**Author:** ![Ievgenii\_Poberezhnyi](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/ievgenii_poberezhnyi/32/335_2.png) [@Ievgenii\_Poberezhnyi](https://community.codefresh.io/u/Ievgenii_Poberezhnyi)\
**Post date:** [March 11, 2021, 9:12pm UTC](https://community.codefresh.io/t/how-can-i-send-an-allure-report-link-to-slack/510/10 "2021-03-11T21:12:33Z")

</div>

Thank you man a lot!!! You saved my life
