-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
312 lines (277 loc) · 8.83 KB
/
.gitlab-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
---
.script-git-submodule: &script-git-submodule
- |
git submodule sync --recursive
git submodule update --init --recursive
.script-linters: &script-linters
- |
flake8
yamllint .
ansible-lint
.script-bootstrap-python: &script-bootstrap-python
- |
if ! [[ -x "$(command -v pipx)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo -E apt-get update
sudo -E apt-get install -y bzip2 ca-certificates curl flake8 gcc gnupg gzip iproute2 pipx procps python3 python3-apt python3-cryptography python3-flake8 python3-jmespath python3-lxml python3-netaddr python3-pip python3-setuptools python3-venv python3-virtualenv python3-wheel sudo tar unzip xz-utils yamllint zip
fi
sh -x -c "python3 --version"
sh -x -c "pipx --version"
sh -x -c "flake8 --version"
sh -x -c "yamllint --version"
.script-bootstrap-ansible: &script-bootstrap-ansible
- |
if ! [[ -x "$(command -v ansible)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo -E apt-get update
sudo -E apt-get install -y ansible ansible-lint python3-docker python3-netaddr python3-vagrant
fi
sh -x -c "ansible --version"
sh -x -c "ansible-lint --version"
.script-bootstrap-molecule: &script-bootstrap-molecule
- |
if ! [[ -x "$(command -v molecule)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo -E apt-get update
sudo -E apt-get install -y python3-molecule python3-molecule-plugins
fi
sh -x -c "molecule --version"
.script-bootstrap-libvirt: &script-bootstrap-libvirt
- |
if ! [[ -x "$(command -v qemu-system-x86_64)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo -E apt-get update
sudo -E apt-get install -y binutils bridge-utils dnsmasq-base ebtables gcc libarchive-tools libguestfs-tools libvirt-clients libvirt-daemon-system libvirt-dev make qemu-system qemu-utils ruby-dev virt-manager
fi
sudo systemctl start libvirtd.service
sh -x -c "sudo systemctl status --no-pager libvirtd.service"
sh -x -c "qemu-system-x86_64 --version"
sh -x -c "virsh --version"
.script-bootstrap-vagrant: &script-bootstrap-vagrant
- |
if ! [[ -x "$(command -v vagrant)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://downloadcontent.opensuse.org/repositories/home:/alvistack/xUbuntu_24.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://downloadcontent.opensuse.org/repositories/home:alvistack/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_alvistack.gpg > /dev/null
sudo -E apt-get update
sudo -E apt-get install -y vagrant
vagrant plugin install vagrant-libvirt
fi
sh -x -c "vagrant --version"
sh -x -c "vagrant plugin list"
.script-symlink-ansible-role: &script-symlink-ansible-role
- |
export _ROLE="$(echo $CI_PROJECT_NAME | sed 's/^ansible-role-//g')"
mkdir -p $HOME/.ansible/roles
ln -s $CI_PROJECT_DIR $HOME/.ansible/roles/alvistack.$_ROLE
.script-molecule-test: &script-molecule-test
- |
export _MOLECULE_INSTANCE_NAME="$(pwgen -1AB 12)"
sudo -E molecule test -s $_BOX-$_PROVIDER
.script-ansible-galaxy-role-import: &script-ansible-galaxy-role-import
- |
if [[ -n "$CI_COMMIT_TAG" ]] && [[ "$CI_COMMIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
export _USER="$CI_PROJECT_NAMESPACE"
export _REPO="$CI_PROJECT_NAME"
elif [[ -n "$CI_COMMIT_BRANCH" ]] && [[ "$CI_COMMIT_BRANCH" =~ master ]]; then
export _USER="$CI_PROJECT_NAMESPACE"
export _REPO="$CI_PROJECT_NAME"
else
exit 0
fi
ansible-galaxy role import --token $ANSIBLE_GALAXY_TOKEN $_USER $_REPO
.job-molecule-test: &job-molecule-test
script:
- *script-bootstrap-python
- *script-bootstrap-ansible
- *script-bootstrap-molecule
- *script-bootstrap-libvirt
- *script-bootstrap-vagrant
- *script-symlink-ansible-role
- *script-molecule-test
.job-ansible-galaxy-role-import: &job-ansible-galaxy-role-import
script:
- *script-bootstrap-python
- *script-bootstrap-ansible
- *script-ansible-galaxy-role-import
default:
before_script:
- *script-git-submodule
- *script-linters
retry: 2
build:ubuntu-24.10-libvirt:
<<: *job-molecule-test
stage: build
variables:
_BOX: ubuntu-24.10
_PROVIDER: libvirt
build:ubuntu-24.04-libvirt:
<<: *job-molecule-test
stage: build
variables:
_BOX: ubuntu-24.04
_PROVIDER: libvirt
build:ubuntu-22.04-libvirt:
<<: *job-molecule-test
stage: build
variables:
_BOX: ubuntu-22.04
_PROVIDER: libvirt
build:ubuntu-20.04-libvirt:
<<: *job-molecule-test
stage: build
variables:
_BOX: ubuntu-20.04
_PROVIDER: libvirt
test:almalinux-9-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: almalinux-9
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:almalinux-8-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: almalinux-8
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:opensuse-tumbleweed-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: opensuse-tumbleweed
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:opensuse-leap-15.6-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: opensuse-leap-15.6
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:opensuse-leap-15.5-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: opensuse-leap-15.5
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:debian-testing-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: debian-testing
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:debian-12-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: debian-12
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:debian-11-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: debian-11
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:fedora-rawhide-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: fedora-rawhide
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:fedora-40-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: fedora-40
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:fedora-39-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: fedora-39
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:centos-9-stream-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: centos-9-stream
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:centos-8-stream-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: centos-8-stream
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:centos-7-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: centos-7
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:rhel-9-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: rhel-9
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:rhel-8-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: rhel-8
_PROVIDER: libvirt
allow_failure: true
retry: 0
test:rhel-7-libvirt:
<<: *job-molecule-test
stage: test
variables:
_BOX: rhel-7
_PROVIDER: libvirt
allow_failure: true
retry: 0
deploy:ansible-galaxy:
<<: *job-ansible-galaxy-role-import
stage: deploy
needs:
- build:ubuntu-24.10-libvirt
- build:ubuntu-24.04-libvirt
- build:ubuntu-22.04-libvirt
- build:ubuntu-20.04-libvirt