CircleCI-Public / slack-orb

Create custom Slack notifications for CircleCI job statuses
https://circleci.com/developer/orbs/orb/circleci/slack
MIT License
214 stars 206 forks source link

Doesn't run the notification step when circleci exits with status code > 0 #365

Closed khteh closed 1 year ago

khteh commented 2 years ago

Orb version: 4.10.1

What happened:

I have the following workflow:

workflows:
  main:
    jobs:
      - build_deploy_buyer_vercel:
          name: BuildDeployBuyerVercel
          filters:
            branches:
              only:
                - staging
                - master
      - build_deploy_seller_vercel:
          name: BuildDeploySellerVercel
          filters:
            branches:
              only:
                - staging
                - master
      - buyer_notification:
          name: BuyerPlatformCICD
          requires:
            - BuildDeployBuyerVercel
      - seller_notification:
          name: SellerPlatformCICD
          requires:
            - BuildDeploySellerVercel

The notifications don't run at all when the requires step fails.

Expected behavior:

Notify slack channel of the real status.

Additional Information:

KyleTryon commented 1 year ago

Hello @khteh,

This is expected of the orb. The orb can only run within the context of the job. If you are creating an alert in the job buyer_notification, and this job never runs because it requires build_deploy_buyer_vercel, and build_deploy_buyer_vercel fails, then you will not get any notification defined in buyer_notification.

Orbs run as a script within a job, each job can only report on its own status.