-
Notifications
You must be signed in to change notification settings - Fork 1.7k
191 lines (172 loc) · 6.34 KB
/
ci-integration-review.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Integration CI Review Trigger
#
# This workflow runs one or more integration tests triggered by a comment in a PR.
# The comment must include '/ci-run-integration'.
# More than one can be specified.
#
# Examples:
#
# 1. Run a single integration test:
#
# /ci-run-integration-amqp
#
# 2. Run two integration tests:
#
# /ci-run-integration-datadog-logs
# /ci-run-integration-splunk
#
# 3. Run all integration tests:
#
# /ci-run-integration-all
#
# 4. Run all CI (including all integration tests)
#
# /ci-run-all
#
# NOTE: This workflow runs on Pull Request Review Comments rather than normal comments to be able to
# capture the SHA that the comment is associated with.
name: CI Integration Review Trigger
on:
pull_request_review:
types: [submitted]
permissions:
statuses: write
env:
AWS_ACCESS_KEY_ID: "dummy"
AWS_SECRET_ACCESS_KEY: "dummy"
AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
TEST_APPSIGNAL_PUSH_API_KEY: ${{ secrets.TEST_APPSIGNAL_PUSH_API_KEY }}
TEST_DATADOG_API_KEY: ${{ secrets.CI_TEST_DATADOG_API_KEY }}
CONTAINER_TOOL: "docker"
DD_ENV: "ci"
DD_API_KEY: ${{ secrets.DD_API_KEY }}
RUST_BACKTRACE: full
TEST_LOG: vector=debug
VERBOSE: true
CI: true
PROFILE: debug
jobs:
prep-pr:
name: (PR review) Signal pending to PR
runs-on: ubuntu-24.04
timeout-minutes: 5
if: startsWith(github.event.review.body, '/ci-run-integration') || startsWith(github.event.review.body, '/ci-run-e2e') || contains(github.event.review.body, '/ci-run-all')
steps:
- name: Generate authentication token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }}
private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }}
- name: Get PR review author
id: comment
uses: tspascoal/get-user-teams-membership@v3
with:
username: ${{ github.actor }}
team: 'Vector'
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Validate author membership
if: steps.comment.outputs.isTeamMember == 'false'
run: exit 1
- name: (PR review) Set latest commit status as pending
uses: myrotvorets/[email protected]
with:
sha: ${{ github.event.review.commit_id }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
integration-tests:
needs: prep-pr
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
matrix:
service: [
"amqp", "appsignal", "aws", "axiom", "azure", "clickhouse", "databend", "datadog-agent",
"datadog-logs", "datadog-metrics", "datadog-traces", "dnstap", "docker-logs", "elasticsearch",
"eventstoredb", "fluent", "gcp", "greptimedb", "http-client", "influxdb", "kafka", "logstash",
"loki", "mongodb", "nats", "nginx", "opentelemetry", "postgres", "prometheus", "pulsar",
"redis", "splunk", "webhdfs"
]
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ github.event.review.commit_id }}
- run: sudo npm -g install @datadog/datadog-ci
- run: docker image prune -af ; docker container prune -f
- name: Integration Tests - ${{ matrix.service }}
if: ${{ startsWith(github.event.review.body, '/ci-run-integration-all')
|| startsWith(github.event.review.body, '/ci-run-all')
|| startsWith(github.event.review.body, format('/ci-run-integration-{0}', matrix.service)) }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
command: bash scripts/ci-int-e2e-test.sh int ${{ matrix.service }}
e2e-tests:
needs: prep-pr
runs-on: ubuntu-24.04-8core
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
ref: ${{ github.event.review.commit_id }}
- run: sudo npm -g install @datadog/datadog-ci
- run: docker image prune -af ; docker container prune -f
- name: e2e-datadog-logs
if: ${{ startsWith(github.event.review.body, '/ci-run-e2e-datadog-logs')
|| startsWith(github.event.review.body, '/ci-run-integration-all')
|| startsWith(github.event.review.body, '/ci-run-all') }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 35
max_attempts: 3
command: bash scripts/ci-int-e2e-test.sh e2e datadog-logs
- name: datadog-e2e-metrics
if: ${{ startsWith(github.event.review.body, '/ci-run-e2e-datadog-metrics')
|| startsWith(github.event.review.body, '/ci-run-e2e-all')
|| startsWith(github.event.review.body, '/ci-run-all') }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 35
max_attempts: 3
command: bash scripts/ci-int-e2e-test.sh e2e datadog-metrics
update-pr-status:
name: Signal result to PR
runs-on: ubuntu-24.04
timeout-minutes: 5
needs:
- integration-tests
- e2e-tests
if: always() && (startsWith(github.event.review.body, '/ci-run-integration') || contains(github.event.review.body, '/ci-run-all'))
env:
FAILED: ${{ contains(needs.*.result, 'failure') }}
steps:
- name: Generate authentication token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }}
private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }}
- name: Validate issue comment
if: github.event_name == 'pull_request_review'
uses: tspascoal/get-user-teams-membership@v3
with:
username: ${{ github.actor }}
team: 'Vector'
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: (PR review) Submit PR result as success
if: github.event_name == 'pull_request_review' && env.FAILED != 'true'
uses: myrotvorets/[email protected]
with:
sha: ${{ github.event.review.commit_id }}
token: ${{ secrets.GITHUB_TOKEN }}
status: 'success'
- run: |
echo "failed=${{ env.FAILED }}"
if [[ "$FAILED" == "true" ]] ; then
exit 1
else
exit 0
fi