-
Notifications
You must be signed in to change notification settings - Fork 6
422 lines (414 loc) · 20 KB
/
integration.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
name: Integration testing
env:
PROJECT_ROOT: /root/go/src/github.com/infrawatch/sg-core
OPENSTACK_REPO: https://trunk.rdoproject.org/centos9-caracal/delorean-deps.repo
QDR_IMAGE: quay.io/interconnectedcloud/qdrouterd:1.17.0
QDR_VOLUME: "--volume=${{ github.workspace }}/ci/service_configs/qdr:/etc/qpid-dispatch:ro"
QDR_PORT: "-p 5666:5666"
BRIDGE_IMAGE: quay.io/infrawatch/sg-bridge:latest
BRIDGE_VOLUME: "--volume=${{ github.workspace }}/tmp:/tmp/sg-bridge:z"
TEST_IMAGE: registry.access.redhat.com/ubi9
TEST_PORT: "-p 3000:3000"
on: [push, pull_request]
jobs:
collectd-metrics-bridge:
name: "[metrics] transport: socket(sg-bridge); handler: collectd-metrics; application: prometheus"
runs-on: ubuntu-22.04
env:
QDR_CHANNEL: collectd/metrics
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Prepare environment
run: |
mkdir -p /opt/stack/
sudo setfacl -Rdm u::7,g::0,o:0 /opt/stack
- name: Prepare environment for mysql-server installation # https://stackoverflow.com/a/66026366
run: |
sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"
sudo apt-get purge mysql\*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg -l | grep -i mysql
sudo apt-get clean
- name: Prepare environment for postgres-server installation
run: |
sudo apt remove postgresql-client-common
sudo apt install postgresql-client-common=238
sudo apt install postgresql-common
sudo python -m pip install --upgrade pip
sudo python -m pip install --upgrade virtualenv
- name: Install devstack
run: |
SOURCE=$(pwd)
git clone http://github.com/openstack/devstack /opt/stack/devstack
pushd /opt/stack/devstack
cp $SOURCE/ci/integration/metrics/local.conf .
sudo apt-get update
./stack.sh
popd
# start message bus services
- name: Start QDR service
run: |
docker run --name=qdr $QDR_VOLUME $QDR_PORT -d $QDR_IMAGE
- name: Check if sg-bridge repository has same topic branch
id: bridge_branch
continue-on-error: true
run: |
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
- name: Start sg-bridge from container image
if: steps.bridge_branch.outcome != 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d \
$BRIDGE_IMAGE --amqp_url amqp://localhost:5666/$QDR_CHANNEL \
--gw_unix=$BRIDGE_SOCKET
- name: Start sg-bridge from same branch
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPENSTACK_REPO \
--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
- name: Install collectd
run: |
sudo apt-get install collectd
sudo systemctl stop collectd && sudo systemctl disable collectd
sudo cp ci/integration/metrics/collectd/collectd.conf /etc/collectd/collectd.conf
sudo touch /var/log/collectd.log && sudo chmod a+rw /var/log/collectd.log
sudo collectd -C ci/integration/metrics/collectd/collectd.conf
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/collectd/run_sg.sh
- name: Run Prometheus to store metrics
run: |
docker run --name=prometheus -d --network host \
--volume ${{ github.workspace }}/ci/integration/metrics/prometheus.yml:/etc/prometheus/prometheus.yml:ro \
$PROMETHEUS_IMAGE
- name: Debug output
run: |
sleep 360
echo "=========================== qdr =========================" && \
docker exec qdr qdstat -b 127.0.0.1:5666 -a
docker logs qdr
echo "========================= sg-core =======================" && \
docker logs sgcore
echo "========================= sg-bridge =======================" && \
docker logs sgbridge
echo "======================== prometheus =====================" && \
docker logs prometheus
- name: Validate metrics processing
run: |
docker run --name=validate -uroot --network host \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/collectd/run_validation.sh
#-------------------------------------------------------------------------------
ceilometer-metrics-bridge:
name: "[metrics] transport: socket(sg-bridge); handler: ceilometer-metrics; application: prometheus"
runs-on: ubuntu-22.04
env:
QDR_CHANNEL: anycast/ceilometer/metering.sample
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Prepare environment
run: |
mkdir -p /opt/stack/
sudo setfacl -Rdm u::7,g::0,o:0 /opt/stack
- name: Prepare environment for mysql-server installation # https://stackoverflow.com/a/66026366
run: |
sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"
sudo apt-get purge mysql\*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg -l | grep -i mysql
sudo apt-get clean
- name: Prepare environment for postgres-server installation
run: |
sudo apt remove postgresql-client-common
sudo apt install postgresql-client-common=238
sudo apt install postgresql-common
sudo python -m pip install --upgrade pip
sudo python -m pip install --upgrade virtualenv
- name: Install devstack
run: |
SOURCE=$(pwd)
git clone http://github.com/openstack/devstack /opt/stack/devstack
pushd /opt/stack/devstack
cp $SOURCE/ci/integration/metrics/local.conf .
sudo apt-get update
./stack.sh
popd
# start message bus services
- name: Start QDR service
run: |
docker run --name=qdr $QDR_VOLUME $QDR_PORT -d $QDR_IMAGE
- name: Check if sg-bridge repository has same topic branch
id: bridge_branch
continue-on-error: true
run: |
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
- name: Start sg-bridge from container image
if: steps.bridge_branch.outcome != 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d \
$BRIDGE_IMAGE --amqp_url amqp://localhost:5666/$QDR_CHANNEL \
--gw_unix=$BRIDGE_SOCKET
- name: Start sg-bridge from same branch
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPENSTACK_REPO \
--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
- name: Set Ceilometer pipelines to QDR output and restart notification agent
run: |
sudo apt-get install -y crudini
echo addressing_mode="dynamic" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo pseudo_vhost=true | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo rpc_address_prefix="" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo notify_address_prefix="" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
cp ci/integration/metrics/ceilometer/bridge/*pipeline.yaml /etc/ceilometer/.
cat /etc/ceilometer/*
sudo pip install pyngus
sudo systemctl restart [email protected]
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/bridge/run_sg.sh
- name: Run Prometheus to store metrics
run: |
docker run --name=prometheus -d --network host \
--volume ${{ github.workspace }}/ci/integration/metrics/prometheus.yml:/etc/prometheus/prometheus.yml:ro \
$PROMETHEUS_IMAGE
- name: Debug output
run: |
sleep 360
echo "=========================== qdr =========================" && \
docker exec qdr qdstat -b 127.0.0.1:5666 -a
docker logs qdr
echo "========================= sg-core =======================" && \
docker logs sgcore
echo "========================= sg-bridge =======================" && \
docker logs sgbridge
echo "========================= ceilometer ====================" && \
sudo journalctl -xu [email protected]
echo "======================== prometheus =====================" && \
docker logs prometheus
- name: Validate metrics processing
run: |
docker run --name=validate -uroot --network host \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/run_validation.sh
#-------------------------------------------------------------------------------
ceilometer-metrics-tcp:
name: "[metrics] transport: socket(tcp); handler: ceilometer-metrics; application: prometheus"
runs-on: ubuntu-22.04
env:
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Prepare environment
run: |
mkdir -p /opt/stack/
sudo setfacl -Rdm u::7,g::0,o:0 /opt/stack
- name: Prepare environment for mysql-server installation # https://stackoverflow.com/a/66026366
run: |
sudo apt-get -f install -o Dpkg::Options::="--force-overwrite"
sudo apt-get purge mysql\*
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo dpkg -l | grep -i mysql
sudo apt-get clean
- name: Prepare environment for postgres-server installation
run: |
sudo apt remove postgresql-client-common
sudo apt install postgresql-client-common=238
sudo apt install postgresql-common
sudo python -m pip install --upgrade pip
sudo python -m pip install --upgrade virtualenv
- name: Install devstack
run: |
SOURCE=$(pwd)
git clone http://github.com/openstack/devstack /opt/stack/devstack
pushd /opt/stack/devstack
cp $SOURCE/ci/integration/metrics/local.conf .
sudo apt-get update
./stack.sh
popd
- name: Set Ceilometer pipelines to TCP output and restart notification agent
run: |
sudo apt-get install -y crudini
echo addressing_mode="dynamic" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo pseudo_vhost=true | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo rpc_address_prefix="" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
echo notify_address_prefix="" | crudini --merge /etc/ceilometer/ceilometer.conf oslo_messaging_amqp
cp ci/integration/metrics/ceilometer/tcp/*pipeline.yaml /etc/ceilometer/.
cat /etc/ceilometer/*
sudo pip install pyngus
sudo systemctl restart [email protected]
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/tcp/run_sg.sh
- name: Run Prometheus to store metrics
run: |
docker run --name=prometheus -d --network host \
--volume ${{ github.workspace }}/ci/integration/metrics/prometheus.yml:/etc/prometheus/prometheus.yml:ro \
$PROMETHEUS_IMAGE
- name: Debug output
run: |
sleep 360
echo "========================= sg-core =======================" && \
docker logs sgcore
echo "========================= ceilometer ====================" && \
sudo journalctl -xu [email protected]
echo "======================== prometheus =====================" && \
docker logs prometheus
- name: Validate metrics processing
run: |
docker run --name=validate -uroot --network host \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/run_validation.sh
#-------------------------------------------------------------------------------
logging:
# Disable Logging CI job, because it's failing. This functionality was never
# used in the downstream product. We can re-enable and fix the job if we
# determine the functionality is useful.
if: false
name: "[logging] handler: logs; application: elasticsearch, loki"
runs-on: ubuntu-22.04
env:
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
LOKI_IMAGE: quay.io/infrawatch/loki:2.4.2
LOKI_VOLUME: "--volume=${{ github.workspace }}/ci/service_configs/loki:/etc/loki:ro"
LOKI_PORT: "-p 3100:3100"
ELASTIC_IMAGE: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
ELASTIC_PORT: "-p 9200:9200 -p 9300:9300"
RSYSLOG_IMAGE: quay.io/centos/centos:stream8
RSYSLOG_VOLUME: "--volume ${{ github.workspace }}/ci/service_configs/rsyslog/rsyslog_config.conf:/etc/rsyslog.d/integration.conf:z"
steps:
- name: Checkout code
uses: actions/[email protected]
# start data store services
- name: Start Elasticsearch service
run: |
docker run --name elastic -e "discovery.type=single-node" $ELASTIC_PORT -d $ELASTIC_IMAGE
- name: Start Loki service
run: |
docker run --name=loki $LOKI_VOLUME $LOKI_PORT -d $LOKI_IMAGE
# start message bus services
- name: Start QDR service
run: |
docker run --name=qdr $QDR_VOLUME $QDR_PORT -d $QDR_IMAGE
- name: Check if sg-bridge repository has same topic branch
id: bridge_branch
continue-on-error: true
run: |
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
- name: Start sg-bridge from container image
if: steps.bridge_branch.outcome != 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d \
$BRIDGE_IMAGE --amqp_url amqp://localhost:5666/rsyslog/logs --gw_unix=$BRIDGE_SOCKET
- name: Start sg-bridge with same branch
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge $BRIDGE_VOLUME -d -uroot --network host -e OPENSTACK_REPO \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_bridge.sh
- name: Run rsyslog to produce log messages
run: |
docker run --name=rsyslog -d -uroot --network host $RSYSLOG_VOLUME \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$RSYSLOG_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_rsyslog.sh
- name: Wait for services to start successfuly
run: |
timeout=240
echo "======================= rsyslog ======================="
rsyslog_wait=0
while [[ $(docker exec qdr qdstat -b 127.0.0.1:5666 -a | grep rsyslog/logs | awk '{print $8}') -le 0 ]]
do
sleep 1
rsyslog_wait=$(($rsyslog_wait+1))
if [[ $rsyslog_wait -gt $timeout ]]; then
echo "ERROR: timeout for rsyslog startup"
break
fi
done
echo "INFO: rsyslog startup took ${rsyslog_wait}s"
echo "===================== elasticsearch ====================="
elastic_wait=0
while ! curl -sX GET "http://127.0.0.1:9200/_cluster/health"
do
sleep 1
elastic_wait=$(($elastic_wait+1))
if [[ $elastic_wait -gt $timeout ]]; then
echo "\nERROR: timeout for elasticsearch startup"
break
fi
done
echo "INFO: elasticsearch startup took ${elastic_wait}s"
echo "========================== loki ========================="
loki_wait=0
while ! curl -sX GET "http://127.0.0.1:3100/ready" | grep -q "^ready$"
do
sleep 1
loki_wait=$(($loki_wait+1))
if [[ $loki_wait -gt $timeout ]]; then
echo "ERROR: timeout for loki startup"
break
fi
done
echo "INFO: loki startup took ${loki_wait}s"
- name: Print container logs
run: |
echo "========================= rsyslog =======================" && \
docker logs rsyslog
echo "===================== elasticsearch =====================" && \
docker logs elastic
echo "========================== loki =========================" && \
docker logs loki
echo "========================== qdr ==========================" && \
docker logs qdr
echo "======================= sg-bridge =======================" && \
docker logs sgbridge
# run integration tests
- name: Run sg-core to process log messages
run: |
docker run --name=sgcore -d -uroot --network host $TEST_PORT $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_sg.sh
- name: sg-core debug output
run: |
timeout=360
sg_wait=0
while [[ $(curl -sX GET "http://127.0.0.1:3000/metrics" | grep 'sg_total_logs_received{source="SG"}' | awk '{print $2}') -le 0 ]]
do
sleep 1
sg_wait=$(($sg_wait+1))
if [[ $sg_wait -gt $timeout ]]; then
echo "ERROR: timeout for sg-core startup"
break
fi
done
echo "INFO: sg-core startup took ${sg_wait}s"
docker logs sgcore
docker exec qdr qdstat -b 127.0.0.1:5666 -c
docker exec qdr qdstat -b 127.0.0.1:5666 -a
- name: Validate log message processing
run: |
docker run --name=validate -uroot --network host \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_validation.sh