Skip to content

Commit d2b7513

Browse files
committed
Separate job for slack notification in each workflow
1 parent 39fe519 commit d2b7513

5 files changed

Lines changed: 68 additions & 29 deletions

File tree

.github/workflows/daily-cli-tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,21 @@ jobs:
4848
kosli_reporting_api_token: ${{ secrets.KOSLI_PUBLIC_API_TOKEN }}
4949
kosli_querying_api_token: ${{ secrets.KOSLI_API_TOKEN_PROD }}
5050
sonarqube_token: ${{ secrets.KOSLI_SONARQUBE_TOKEN }}
51+
52+
slack-notification-on-failure:
53+
runs-on: ubuntu-24.04
54+
permissions:
55+
actions: read
56+
contents: read
57+
needs:
58+
[
59+
set-trail-name,
60+
test,
61+
]
62+
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref == 'refs/heads/master' }}
63+
steps:
64+
- name: Slack Notification on Failure
65+
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@main
66+
with:
67+
slack_url: ${{ secrets.MERKELY_SLACK_CI_FAILURES_WEBHOOK }}
68+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,23 @@ jobs:
8888
slack_channel: ci-failures
8989
kosli_api_token: ${{ secrets.KOSLI_PUBLIC_API_TOKEN }}
9090
snyk_token: ${{ secrets.SNYK_TOKEN }}
91+
92+
slack-notification-on-failure:
93+
runs-on: ubuntu-24.04
94+
permissions:
95+
actions: read
96+
contents: read
97+
needs:
98+
[
99+
pre-build,
100+
init-kosli,
101+
test,
102+
docker
103+
]
104+
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref == 'refs/heads/master' }}
105+
steps:
106+
- name: Slack Notification on Failure
107+
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@main
108+
with:
109+
slack_url: ${{ secrets.MERKELY_SLACK_CI_FAILURES_WEBHOOK }}
110+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,31 @@ jobs:
250250
tag: ${{ needs.pre-build.outputs.tag }}
251251
AWS_ACCOUNT_ID: 585008075785
252252
AWS_REGION: eu-central-1
253+
254+
slack-notification-on-failure:
255+
runs-on: ubuntu-24.04
256+
permissions:
257+
actions: read
258+
contents: read
259+
needs:
260+
[
261+
pre-build,
262+
init-kosli,
263+
never-alone-trail,
264+
test,
265+
docker,
266+
goreleaser,
267+
binary-provenance,
268+
homebrew-pr,
269+
docs-gen,
270+
evidence-reporter-upload-package-and-deploy,
271+
environment-reporter-upload-package-and-deploy,
272+
environment-reporter-upload-layer
273+
]
274+
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref == 'refs/heads/master' }}
275+
steps:
276+
- name: Slack Notification on Failure
277+
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@main
278+
with:
279+
slack_url: ${{ secrets.MERKELY_SLACK_CI_FAILURES_WEBHOOK }}
280+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,7 @@ jobs:
9898
--flow ${{ inputs.FLOW_NAME }}
9999
--trail ${{ inputs.TRAIL_NAME }}
100100
--org ${{ inputs.KOSLI_ORG }}
101-
--compliant=${{ steps.lint.outcome == 'success' }}
102-
103-
- name: Slack Notification on Failure
104-
if: ${{ failure() }}
105-
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@debug
106-
with:
107-
slack_url: ${{ secrets.slack_webhook }}
108-
github_token: ${{ secrets.GITHUB_TOKEN }}
101+
--compliant=${{ steps.lint.outcome == 'success' }}
109102

110103
test:
111104
name: Test
@@ -174,13 +167,6 @@ jobs:
174167
if: ${{ inputs.report_results }}
175168
uses: codecov/codecov-action@v4
176169

177-
- name: Slack Notification on Failure
178-
if: ${{ failure() }}
179-
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@debug
180-
with:
181-
slack_url: ${{ secrets.slack_webhook }}
182-
github_token: ${{ secrets.GITHUB_TOKEN }}
183-
184170
snyk-code-test:
185171
if: ${{ inputs.run_snyk }}
186172
name: Snyk Code Test
@@ -218,13 +204,6 @@ jobs:
218204
# --scan-results snyk-code.json
219205
# --org ${{ inputs.KOSLI_ORG }}
220206

221-
# - name: Slack Notification on Failure
222-
# if: ${{ failure() }}
223-
# uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@debug
224-
# with:
225-
# slack_url: ${{ secrets.slack_webhook }}
226-
# github_token: ${{ secrets.GITHUB_TOKEN }}
227-
228207
snyk-dependency-test:
229208
if: ${{ inputs.run_snyk }}
230209
name: Snyk Dependency Test
@@ -262,9 +241,3 @@ jobs:
262241
# --scan-results snyk-dependency.json
263242
# --org ${{ inputs.KOSLI_ORG }}
264243

265-
# - name: Slack Notification on Failure
266-
# if: ${{ failure() }}
267-
# uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@debug
268-
# with:
269-
# slack_url: ${{ secrets.slack_webhook }}
270-
# github_token: ${{ secrets.GITHUB_TOKEN }}

cmd/kosli/assertApproval_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (suite *AssertApprovalCommandTestSuite) SetupTest() {
2929
suite.artifactName = "arti"
3030
suite.artifactPath = "testdata/folder1/hello.txt"
3131
global = &GlobalOpts{
32-
ApiToken: "XXeyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImNkNzg4OTg5In0.e8i_lA_QrEhFncb05Xw6E_tkCHU9QfcY4OLTVUCHffY",
32+
ApiToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImNkNzg4OTg5In0.e8i_lA_QrEhFncb05Xw6E_tkCHU9QfcY4OLTVUCHffY",
3333
Org: "docs-cmd-test-user",
3434
Host: "http://localhost:8001",
3535
}

0 commit comments

Comments
 (0)