2

I'd like to send Slack notifications to a channel when a deployment starts. The current available notifications are for deployment success, failure or stopped but nothing for the start of a deployment.

Is there a workaround to get the notification when the deployment begins?

Thanks.

Kelly b
  • 171
  • 2
  • 14

1 Answers1

0

You can just use Atlassian's Slack notification pipe https://bitbucket.org/product/features/pipelines/integrations?p=atlassian/slack-notify

definitions:
  yaml-anchors:

    - &slack-notify-variables
        WEBHOOK_URL: $SLACK_WEBHOOK
        # ...

    - &deploy-step
        script:
          - pipe: atlassian/slack-notify:2.0.0
            variables:
              <<: *slack-notify-variables
              MESSAGE: "Deployment to $BITBUCKET_DEPLOYMENT_ENVIRONMENT started"
          - bash deploy.sh $BITBUCKET_DEPLOYMENT_ENVIRONMENT

pipelines:
  branches:
    main:
      - step:
          <<: *deploy-step
          deployment: my-staging-environment

      - step:
          <<: *deploy-step
          deployment: my-production-environment

N1ngu
  • 2,862
  • 17
  • 35