${} searching as part of a template. plugins/slack


#1

Hey thanks for checking out my issue.

Trying to output a test report link from s3 into slack.

We are successfully sending the output to slack but for security send part of the domain as a secret.

I have tried this as $${REPORT_VIEWER_DOMAIN} which outputs https://${REPORT_VIEWER_DOMAIN}/s3/target/site/serenity/index.html

and

${REPORT_VIEWER_DOMAIN} which outputs
https:///s3/target/site/serenity/index.html

We are on drone 0.8

YAML

  slack-notification:
    image: plugins/slack
    secrets: [ slack_webhook, report_viewer_domain ]
    webhook: ${SLACK_WEBHOOK}
    channel: channel
    template: >
      {{#success build.status}}
        @here build {{build.number}} ${DRONE_BUILD_NUMBER} succeeded and tests have executed successfully, please find results here https://${REPORT_VIEWER_DOMAIN}/s3/target/site/serenity/index.html
      {{else}}
        @here build {{build.number}} ${DRONE_BUILD_NUMBER} unfortunately has some test failures, please see the results here https://${REPORT_VIEWER_DOMAIN}/s3/target/site/serenity/index.html
      {{/success}}
    when:
      branch: master
      event: push
      status:
        - success
        - failure

So I think the secret is not being sent to report_viewer_domain somehow but I’m not certain. Thanks if you’re able to help!


#2

I had a similar problem. When you pass the slack_webhook to the plugin you do not need to set the webhook value. My understanding is that secrets are not substituted like this.

  slack-notification:
    image: plugins/slack
    secrets: [ slack_webhook, report_viewer_domain ]
-   webhook: ${SLACK_WEBHOOK}