-
Notifications
You must be signed in to change notification settings - Fork 252
447 lines (392 loc) · 12.3 KB
/
ci.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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
name: "ci"
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container: quay.io/sssd/ci-client-devel:latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
id: dependencies
uses: ./.github/actions/install-dependencies
- name: Configure sssd
uses: ./.github/actions/configure
- name: make
shell: bash
working-directory: x86_64
run: |
source ../contrib/fedora/bashrc_sssd
make CFLAGS+="$SSS_WARNINGS -Werror -Wno-error=deprecated-declarations"
- name: make check
shell: bash
working-directory: x86_64
run: |
source ../contrib/fedora/bashrc_sssd
make CFLAGS+="$SSS_WARNINGS -Werror -Wno-error=deprecated-declarations" check
- name: make distcheck
shell: bash
working-directory: x86_64
run: |
source ../contrib/fedora/bashrc_sssd
make distcheck
- uses: actions/upload-artifact@v4
if: always()
with:
name: build
path: |
x86_64/config.log
x86_64/config.h
x86_64/test-suite.log
if-no-files-found: ignore
prepare:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Get matrix
id: matrix
run: ./contrib/ci/get-matrix.py --action
intgcheck:
needs: [prepare, build]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.prepare.outputs.matrix).intgcheck }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: sssd
- name: Setup containers
uses: SSSD/sssd-ci-containers/actions/setup@master
with:
path: sssd-ci-containers
tag: ${{ matrix.tag }}
limit: dns client
override: |
services:
client:
image: ${REGISTRY}/ci-client-devel:${TAG}
volumes:
- ../sssd:/sssd:rw
- name: Run integration tests
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
working-directory: /sssd
script: ./contrib/ci/run --moderate
- name: Print logs
uses: next-actions/print-logs@master
if: always()
with:
working-directory: ./sssd/ci-build-debug
files: |
test-suite.log
ci-make-intgcheck.log
ci-make-distcheck.log
- name: Upload main artifacts
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ matrix.tag }}-intgcheck
path: |
./sssd/var/log/sssd/*.log
./sssd/ci-build-debug/ci-*.log
./sssd/ci-build-debug/test-suite.log
./sssd/ci-build-debug/ci-mock-result/*.log
./sssd/ci-build-debug/src/tests/cwrap/test-suite.log
- name: Upload valgrind artifacts
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ matrix.tag }}-intgcheck-valgrind
path: |
./sssd/ci-build-debug/*.valgrind.log
multihost:
needs: [prepare, build]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.prepare.outputs.matrix).multihost }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout sssd repository
uses: actions/checkout@v4
with:
path: sssd
- name: Setup containers
uses: SSSD/sssd-ci-containers/actions/setup@master
with:
path: sssd-ci-containers
tag: ${{ matrix.tag }}
limit: dns client
override: |
services:
client:
image: ${REGISTRY}/ci-client-devel:${TAG}
shm_size: 4G
tmpfs:
- /dev/shm
volumes:
- ../sssd:/sssd:rw
- name: Build SSSD on the client
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
log-file: multihost-build.log
working-directory: /sssd
script: |
#!/bin/bash
set -ex
./contrib/ci/run --deps-only
autoreconf -if
mkdir -p /dev/shm/sssd
pushd /dev/shm/sssd
/sssd/configure --enable-silent-rules
make rpms
- name: Install SSSD on the client
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
log-file: multihost-install.log
user: root
script: |
#!/bin/bash
set -ex
dnf remove -y --noautoremove sssd\*
dnf install -y /dev/shm/sssd/rpmbuild/RPMS/*/*.rpm
rm -fr /dev/shm/sssd
test -x /usr/bin/sss_ssh_knownhosts && \
sed -e 's/GlobalKnownHostsFile/#GlobalKnownHostsFile/' \
-e 's/ProxyCommand \/usr\/bin\/sss_ssh_knownhostsproxy -p %p %h/KnownHostsCommand \/usr\/bin\/sss_ssh_knownhosts %H/' \
-i /etc/ssh/ssh_config.d/04-ipa.conf
- name: Install multihost tests dependencies
shell: bash
run: |
set -ex
sudo apt-get update
# Install certutil and dependencies for python-ldap
sudo apt-get install -y libnss3-tools libsasl2-dev python3-dev libldap2-dev libssl-dev
# Virtualenv
pip3 install virtualenv
python3 -m venv .venv
source .venv/bin/activate
# Install multihost tests requirements
pip3 install -r ./sssd/src/tests/multihost/requirements.txt
- name: Create multihost configuration
uses: DamianReeves/write-file-action@6929a9a6d1807689191dcc8bbe62b54d70a32b42
with:
path: mhc.yml
write-mode: overwrite
contents: |
root_password: 'Secret123'
domains:
- name: tier0.tests
type: sssd
hosts:
- name: client
external_hostname: client.test
role: master
- name: Run basic multihost tests
run: |
set -ex -o pipefail
source .venv/bin/activate
export PYTHONPATH="${PYTHONPATH}:$(realpath ./sssd/src/tests/multihost)"
pytest -s --multihost-config=./mhc.yml ./sssd/src/tests/multihost/basic |& tee multihost-pytest.log
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ matrix.tag }}-multihost
path: |
sssd/ci-install-deps.log
multihost-build.log
multihost-install.log
multihost-pytest.log
system:
needs: [prepare, build]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.prepare.outputs.matrix).multihost }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Checkout sssd repository
uses: actions/checkout@v4
with:
path: sssd
- name: Setup containers
uses: SSSD/sssd-ci-containers/actions/setup@master
with:
path: sssd-ci-containers
tag: ${{ matrix.tag }}
override: |
services:
client:
image: ${REGISTRY}/ci-client-devel:${TAG}
shm_size: 4G
tmpfs:
- /dev/shm
volumes:
- ../sssd:/sssd:rw
ipa:
image: ${REGISTRY}/ci-ipa-devel:${TAG}
shm_size: 4G
tmpfs:
- /dev/shm
volumes:
- ../sssd:/sssd:rw
- name: Build SSSD on the client and IPA
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
log-file: build.log
working-directory: /sssd
where: |
client
ipa
script: |
#!/bin/bash
set -ex
./contrib/ci/run --deps-only
autoreconf -if
mkdir -p /dev/shm/sssd
pushd /dev/shm/sssd
/sssd/configure --enable-silent-rules
make rpms
- name: Install SSSD on the client and IPA
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
log-file: install.log
user: root
where: |
client
ipa
script: |
#!/bin/bash
set -ex
dnf install -y /dev/shm/sssd/rpmbuild/RPMS/*/*.rpm
rm -fr /dev/shm/sssd
# We need to reenable sssd-kcm since it was disabled by removing sssd not not enabled again
systemctl enable --now sssd-kcm.socket
- name: Restart SSSD on IPA server
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
user: root
where: ipa
script: |
#!/bin/bash
set -ex
systemctl restart sssd || systemctl status sssd
- name: Patch the SSH configuration
uses: SSSD/sssd-ci-containers/actions/exec@master
with:
user: root
script: |
#!/bin/bash
test -x /usr/bin/sss_ssh_knownhosts && \
sed -e 's/GlobalKnownHostsFile/#GlobalKnownHostsFile/' \
-e 's/ProxyCommand \/usr\/bin\/sss_ssh_knownhostsproxy -p %p %h/KnownHostsCommand \/usr\/bin\/sss_ssh_knownhosts %H/' \
-i /etc/ssh/ssh_config.d/04-ipa.conf
- name: Install system tests dependencies
shell: bash
working-directory: ./sssd/src/tests/system
run: |
set -ex
sudo apt-get update
# Install dependencies for python-ldap
sudo apt-get install -y libsasl2-dev python3-dev libldap2-dev libssl-dev
# Virtualenv
pip3 install virtualenv
python3 -m venv .venv
source .venv/bin/activate
# Install system tests requirements
pip3 install -r ./requirements.txt
# Install yq to parse yaml files
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod a+x /usr/local/bin/yq
- name: Remove ad from mhc.yaml
shell: bash
working-directory: ./sssd/src/tests/system
run: |
yq -i 'del(.domains[0].hosts.[] | select(.role == "ad"))' mhc.yaml
- name: Check polarion metadata
shell: bash
working-directory: ./sssd/src/tests/system
run: |
# Run pytest in collect only mode to quickly catch issues in Polarion metadata.
set -ex -o pipefail
mkdir -p $GITHUB_WORKSPACE/artifacts
source .venv/bin/activate
pytest \
--color=yes \
--mh-config=./mhc.yaml \
--mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \
--polarion-config=../polarion.yaml \
--output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \
--collect-only . |& tee $GITHUB_WORKSPACE/pytest-collect.log
- name: Run tests
shell: bash
working-directory: ./sssd/src/tests/system
run: |
set -ex -o pipefail
mkdir -p $GITHUB_WORKSPACE/artifacts
source .venv/bin/activate
pytest \
--color=yes \
--show-capture=no \
--mh-config=./mhc.yaml \
--mh-artifacts-dir=$GITHUB_WORKSPACE/artifacts \
--polarion-config=../polarion.yaml \
--output-polarion-testcase=$GITHUB_WORKSPACE/artifacts/testcase.xml \
--output-polarion-testrun=$GITHUB_WORKSPACE/artifacts/testrun.xml \
-vvv . |& tee $GITHUB_WORKSPACE/pytest.log
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ matrix.tag }}-system
path: |
sssd/ci-install-deps.log
artifacts
build.log
install.log
pytest.log
pytest-collect.log
result:
name: All tests are successful
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [build, intgcheck, multihost, system]
steps:
- name: Fail on failure
if: |
needs.build.result != 'success'
|| needs.intgcheck.result != 'success'
|| needs.multihost.result != 'success'
|| needs.system.result != 'success'
run: exit 1