CircleCI-Public / slack-orb

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

fix: re-running pipelines #448

Closed atanass closed 3 months ago

atanass commented 3 months ago

Description:

This is a fix for the latest thread message posting capability.

Motivation:

There is a misbehaviour when there is a Slack message posted but the pipeline fails. In these occasions, if a user initiates a "Rerun from failed" and the failed job actually passes and the pipeline gets to the slack job, intended to post a message in a thread, the message will be posted as a new one. This is because of the way the cache key is formed ({{ .Environment.CIRCLE_WORKFLOW_ID }}) which is different when rerunning the pipeline. This PR adds another cache key to be relied on in such scenarios. It will now be falling back to using the git revision, which will be the same with every rerun of the pipeline.

Checklist: [x] All new jobs, commands, executors, parameters have descriptions. [ ] Usage Example version numbers have been updated. [ ] Changelog has been updated.

atanass commented 3 months ago
  1. First Slack job passes & a message is posted in Slack
  2. A subsequent deployment or build job fails
  3. Rerun from Failed is triggered on the pipeline
  4. The failed job now passes
  5. Second Slack job passes and:
    • Before: A new regular message is posted in Slack
    • After: A reply message to the initial message from step 1 is posted in a thread
atanass commented 3 months ago

@otremblay @aaronstillwell

orb-publisher commented 3 months ago

Your orb has been published to the CircleCI Orb Registry. You can view your published orb on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/slack?version=4.13.2