How do I post a custom slack notification message in travis-ci?

Viewed 591

My travis configuration is not interpolating variable in slack message before posting the notification to the channel.

For example, I am using a datetime stamp to generate a file name and save the file to S3. This works well. Once this is complete I am trying to use the same variable in the slack notification message however the value is not being interoperated.

before_script:
  - export TIMESTAMP=$(stat -t %Y%m%d%H%M%S -f %Sm -- $i)

notifications:
  slack:
    template:
      - "%{repository_slug} (%{commit}) : %{message}"
      - "Build details: %{build_url}"
      - "Report:  report-${TIMESTAMP}.pdf"


Expected: "Report: report-20180903230213.pdf"

Actual: "Report:  report-${TIMESTAMP}.pdf"
0 Answers
Related