-
Notifications
You must be signed in to change notification settings - Fork 208
Description
Orb version:
circleci/slack@5.0.0
What happened:
Unable to have slack/notify
adding a message to a previously created thread when event
is set to fail
.
After a 1st successful slack/notify
call with event: always
and thread_id: my-workflow
, When calling slack/notify
with event: fail
a thread_id: my-workflow
, it fails to .
Expected behavior:
The fail event is expected to be pushed in the specified thread.
Additional Information:
Here is the pseudo CI configuration to reproduce the issue:
jobs:
start-slack-thread:
steps:
- slack/notify:
event: always
thread_id: my-thread
a-job-that-fails:
steps:
- run: exit 1
- slack/notify:
event: fail
thread_id: my-thread
- slack/notify:
event: pass
thread_id: my-thread
a-job-that-passes:
steps:
- run: exit 0
- slack/notify:
event: fail
thread_id: my-thread
- slack/notify:
event: pass
thread_id: my-thread
...
workflows:
version: 2
my-workflow:
jobs:
- start-slack-thread:
- a-job-that-fails:
requires:
- start-slack-thread
- a-job-that-passes:
requires:
- start-slack-thread
In the CircleCI, I've noticed that the cached /tmp/SLACK_THREAD_INFO/<channel_name>
is correctly restored in the a-job-that-passes
job. However in the a-job-that-fails
job, the cache restore does not happen.
As a workaround, I forces the cache restore. So IMO, it's either an expected behavior to ignore the thread ID is case of failure and this behavior should be explained somewhere, or a bug.
a-job-that-fails-and-notifies:
steps:
- restore_cache:
keys:
- cache-my-thread-<< pipeline.id >>
- run: exit 1
- slack/notify:
event: fail
thread_id: my-thread
- slack/notify:
event: pass
thread_id: my-thread
I hope it helps, thanks!