Skip to content

Commit 74b6d89

Browse files
Reduce ci code duplication (#245)
* Add gh action to send slack message * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent cc4db55 commit 74b6d89

File tree

3 files changed

+105
-173
lines changed

3 files changed

+105
-173
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Send Notification
2+
description: "Send a notification to Slack"
3+
inputs:
4+
bench_name:
5+
description: "name of the failed job (i.e runBenchmark)"
6+
required: true
7+
job_status:
8+
description: "status of the job (i.e failed)"
9+
required: true
10+
failed_outputs:
11+
description: "details of the failed job"
12+
required: false
13+
default: "{}"
14+
qdrant_version:
15+
description: "version of Qdrant used in the benchmark"
16+
required: false
17+
default: "unknown"
18+
engine_name:
19+
description: "name of the engine used in the benchmark"
20+
required: false
21+
default: "unknown"
22+
dataset:
23+
description: "name of the dataset used in the benchmark"
24+
required: false
25+
default: "unknown"
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- uses: slackapi/[email protected]
31+
with:
32+
payload: |
33+
{
34+
"text": "CI benchmarks (${{ inputs.bench_name }}) run status: ${{ inputs.status }}",
35+
"blocks": [
36+
{
37+
"type": "section",
38+
"text": {
39+
"type": "mrkdwn",
40+
"text": "CI benchmarks (${{ inputs.bench_name }}) failed because of *${{ inputs.failed_outputs }}*."
41+
}
42+
},
43+
{
44+
"type": "section",
45+
"text": {
46+
"type": "mrkdwn",
47+
"text": "Qdrant version: *${{ inputs.qdrant_version }}*."
48+
}
49+
},
50+
{
51+
"type": "section",
52+
"text": {
53+
"type": "mrkdwn",
54+
"text": "Engine: *${{ inputs.engine_name }}*."
55+
}
56+
},
57+
{
58+
"type": "section",
59+
"text": {
60+
"type": "mrkdwn",
61+
"text": "Dataset: *${{ inputs.dataset }}*."
62+
}
63+
},
64+
{
65+
"type": "section",
66+
"text": {
67+
"type": "mrkdwn",
68+
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
69+
}
70+
}
71+
]
72+
}

.github/workflows/continuous-benchmark-2.yaml

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,51 +71,16 @@ jobs:
7171
- name: Fail job if any of the benches failed
7272
if: steps.benches.outputs.failed == 'error' || steps.benches.outputs.failed == 'timeout'
7373
run: exit 1
74-
- name: Send Notification
74+
- name: Send slack message
75+
uses: ./.github/workflows/actions/send-slack-msg
7576
if: failure() || cancelled()
76-
uses: slackapi/[email protected]
7777
with:
78-
payload: |
79-
{
80-
"text": "CI benchmarks (runLoadTimeBenchmark) run status: ${{ job.status }}",
81-
"blocks": [
82-
{
83-
"type": "section",
84-
"text": {
85-
"type": "mrkdwn",
86-
"text": "CI benchmarks (runLoadTimeBenchmark) failed because of *${{ steps.benches.outputs.failed }}*."
87-
}
88-
},
89-
{
90-
"type": "section",
91-
"text": {
92-
"type": "mrkdwn",
93-
"text": "Qdrant version: *${{ steps.benches.outputs.qdrant_version }}*."
94-
}
95-
},
96-
{
97-
"type": "section",
98-
"text": {
99-
"type": "mrkdwn",
100-
"text": "Engine: *${{ steps.benches.outputs.engine_name }}*."
101-
}
102-
},
103-
{
104-
"type": "section",
105-
"text": {
106-
"type": "mrkdwn",
107-
"text": "Dataset: *${{ steps.benches.outputs.dataset }}*."
108-
}
109-
},
110-
{
111-
"type": "section",
112-
"text": {
113-
"type": "mrkdwn",
114-
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
115-
}
116-
}
117-
]
118-
}
78+
bench_name: "runLoadTimeBenchmark"
79+
job_status: ${{ job.status }}
80+
failed_outputs: ${{ steps.benches.outputs.failed }}
81+
qdrant_version: ${{ steps.benches.outputs.qdrant_version }}
82+
engine_name: ${{ steps.benches.outputs.engine_name }}
83+
dataset: ${{ steps.benches.outputs.dataset }}
11984
env:
12085
SLACK_WEBHOOK_URL: ${{ secrets.CI_ALERTS_CHANNEL_WEBHOOK_URL }}
12186
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

.github/workflows/continuous-benchmark.yaml

Lines changed: 25 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,16 @@ jobs:
6363
- name: Fail job if any of the benches failed
6464
if: steps.benches.outputs.failed == 'error' || steps.benches.outputs.failed == 'timeout'
6565
run: exit 1
66-
- name: Send Notification
66+
- name: Send slack message
67+
uses: ./.github/workflows/actions/send-slack-msg
6768
if: failure() || cancelled()
68-
uses: slackapi/[email protected]
6969
with:
70-
payload: |
71-
{
72-
"text": "CI benchmarks (runBenchmark) run status: ${{ job.status }}",
73-
"blocks": [
74-
{
75-
"type": "section",
76-
"text": {
77-
"type": "mrkdwn",
78-
"text": "CI benchmarks (runBenchmark) failed because of *${{ steps.benches.outputs.failed }}*."
79-
}
80-
},
81-
{
82-
"type": "section",
83-
"text": {
84-
"type": "mrkdwn",
85-
"text": "Qdrant version: *${{ steps.benches.outputs.qdrant_version }}*."
86-
}
87-
},
88-
{
89-
"type": "section",
90-
"text": {
91-
"type": "mrkdwn",
92-
"text": "Engine: *${{ steps.benches.outputs.engine_name }}*."
93-
}
94-
},
95-
{
96-
"type": "section",
97-
"text": {
98-
"type": "mrkdwn",
99-
"text": "Dataset: *${{ steps.benches.outputs.dataset }}*."
100-
}
101-
},
102-
{
103-
"type": "section",
104-
"text": {
105-
"type": "mrkdwn",
106-
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
107-
}
108-
}
109-
]
110-
}
70+
bench_name: "runBenchmark"
71+
job_status: ${{ job.status }}
72+
failed_outputs: ${{ steps.benches.outputs.failed }}
73+
qdrant_version: ${{ steps.benches.outputs.qdrant_version }}
74+
engine_name: ${{ steps.benches.outputs.engine_name }}
75+
dataset: ${{ steps.benches.outputs.dataset }}
11176
env:
11277
SLACK_WEBHOOK_URL: ${{ secrets.CI_ALERTS_CHANNEL_WEBHOOK_URL }}
11378
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
@@ -154,51 +119,16 @@ jobs:
154119
- name: Fail job if any of the benches failed
155120
if: steps.benches.outputs.failed == 'error' || steps.benches.outputs.failed == 'timeout'
156121
run: exit 1
157-
- name: Send Notification
122+
- name: Send slack message
123+
uses: ./.github/workflows/actions/send-slack-msg
158124
if: failure() || cancelled()
159-
uses: slackapi/[email protected]
160125
with:
161-
payload: |
162-
{
163-
"text": "CI benchmarks (runTenantsBenchmark) run status: ${{ job.status }}",
164-
"blocks": [
165-
{
166-
"type": "section",
167-
"text": {
168-
"type": "mrkdwn",
169-
"text": "CI benchmarks (runTenantsBenchmark) failed because of *${{ steps.benches.outputs.failed }}*."
170-
}
171-
},
172-
{
173-
"type": "section",
174-
"text": {
175-
"type": "mrkdwn",
176-
"text": "Qdrant version: *${{ steps.benches.outputs.qdrant_version }}*."
177-
}
178-
},
179-
{
180-
"type": "section",
181-
"text": {
182-
"type": "mrkdwn",
183-
"text": "Engine: *${{ steps.benches.outputs.engine_name }}*."
184-
}
185-
},
186-
{
187-
"type": "section",
188-
"text": {
189-
"type": "mrkdwn",
190-
"text": "Dataset: *${{ steps.benches.outputs.dataset }}*."
191-
}
192-
},
193-
{
194-
"type": "section",
195-
"text": {
196-
"type": "mrkdwn",
197-
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
198-
}
199-
}
200-
]
201-
}
126+
source_name: "runTenantsBenchmark"
127+
job_status: ${{ job.status }}
128+
failed_outputs: ${{ steps.benches.outputs.failed }}
129+
qdrant_version: ${{ steps.benches.outputs.qdrant_version }}
130+
engine_name: ${{ steps.benches.outputs.engine_name }}
131+
dataset: ${{ steps.benches.outputs.dataset }}
202132
env:
203133
SLACK_WEBHOOK_URL: ${{ secrets.CI_ALERTS_CHANNEL_WEBHOOK_URL }}
204134
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
@@ -245,51 +175,16 @@ jobs:
245175
- name: Fail job if any of the benches failed
246176
if: steps.benches.outputs.failed == 'error' || steps.benches.outputs.failed == 'timeout'
247177
run: exit 1
248-
- name: Send Notification
178+
- name: Send slack message
179+
uses: ./.github/workflows/actions/send-slack-msg
249180
if: failure() || cancelled()
250-
uses: slackapi/[email protected]
251181
with:
252-
payload: |
253-
{
254-
"text": "CI benchmarks (runParallelBenchmark) run status: ${{ job.status }}",
255-
"blocks": [
256-
{
257-
"type": "section",
258-
"text": {
259-
"type": "mrkdwn",
260-
"text": "CI benchmarks (runParallelBenchmark) failed because of *${{ steps.benches.outputs.failed }}*."
261-
}
262-
},
263-
{
264-
"type": "section",
265-
"text": {
266-
"type": "mrkdwn",
267-
"text": "Qdrant version: *${{ steps.benches.outputs.qdrant_version }}*."
268-
}
269-
},
270-
{
271-
"type": "section",
272-
"text": {
273-
"type": "mrkdwn",
274-
"text": "Engine: *${{ steps.benches.outputs.engine_name }}*."
275-
}
276-
},
277-
{
278-
"type": "section",
279-
"text": {
280-
"type": "mrkdwn",
281-
"text": "Dataset: *${{ steps.benches.outputs.dataset }}*."
282-
}
283-
},
284-
{
285-
"type": "section",
286-
"text": {
287-
"type": "mrkdwn",
288-
"text": "View the results <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
289-
}
290-
}
291-
]
292-
}
182+
source_name: "runParallelBenchmark"
183+
job_status: ${{ job.status }}
184+
failed_outputs: ${{ steps.benches.outputs.failed }}
185+
qdrant_version: ${{ steps.benches.outputs.qdrant_version }}
186+
engine_name: ${{ steps.benches.outputs.engine_name }}
187+
dataset: ${{ steps.benches.outputs.dataset }}
293188
env:
294189
SLACK_WEBHOOK_URL: ${{ secrets.CI_ALERTS_CHANNEL_WEBHOOK_URL }}
295-
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
190+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

0 commit comments

Comments
 (0)