I am trying to ensure that if our build fails we get notified by slack BUT only for our main branch.
Here is our code for the slack notification:
hooks:
on_fail:
steps:
notify:
image: codefresh/slacknotifier
environment:
- SLACK_HOOK_URL=<webhook url>
- SLACK_ATTACHMENTS=<slack message>
when:
branch:
only:
- /^(main)/i
At the minute it is still slacking for feature branches. Any assistance would be greatly appreciated.
You can treat the actual the codefresh hooks steps the same way as normal steps, so you can try to invoke or set a conditional on the pipeline or with the branch set another step that read the
branchproperties.generic
branch based:
this last one should apply for all
FEATURE-*regex, good luck lmlreference : https://codefresh.io/docs/docs/ci-cd-guides/pull-request-branches/