This repository has been archived by the owner on Feb 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
234 lines (205 loc) · 7.41 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
---
.script-git-submodule: &script-git-submodule
- |
git submodule sync --recursive
git submodule update --init --recursive
.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/$_ROLE
.script-bootstrap-python: &script-bootstrap-python
- |
if ! [[ -x "$(command -v pipx)" ]]; then
export DEBIAN_FRONTEND="noninteractive"
echo "deb http://download.opensuse.org/repositories/home:/alvistack/xUbuntu_20.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://download.opensuse.org/repositories/home:alvistack/xUbuntu_20.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 procps python3 python3-apt python3-cryptography python3-flake8 python3-jmespath python3-lxml python3-netaddr python3-pip python3-pipx python3-setuptools python3-venv python3-virtualenv python3-wheel python3-yamllint sudo tar unzip xz-utils 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://download.opensuse.org/repositories/home:/alvistack/xUbuntu_20.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://download.opensuse.org/repositories/home:alvistack/xUbuntu_20.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 python3-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://download.opensuse.org/repositories/home:/alvistack/xUbuntu_20.04/ /" | sudo tee /etc/apt/sources.list.d/home:alvistack.list
curl -fsSL https://download.opensuse.org/repositories/home:alvistack/xUbuntu_20.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-docker python3-molecule-vagrant
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://ppa.launchpad.net/savoury1/virtualisation/ubuntu focal main" | sudo tee /etc/apt/sources.list.d/savoury1.list
curl -fsSL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE996735927E427A733BB653E374C7797FB006459" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/savoury1.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 [arch=amd64] https://apt.releases.hashicorp.com focal main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/hashicorp.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-molecule-test: &script-molecule-test
- |
export MOLECULE_INSTANCE_NAME="$(pwgen -1AB 12)"
molecule test -s $_MOLECULE_SCENARIO_NAME
.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: &job-molecule
script:
- *script-bootstrap-python
- *script-bootstrap-ansible
- *script-bootstrap-molecule
- *script-bootstrap-libvirt
- *script-bootstrap-vagrant
- *script-molecule-test
.job-ansible-galaxy: &job-ansible-galaxy
script:
- *script-bootstrap-python
- *script-bootstrap-ansible
- *script-ansible-galaxy-role-import
default:
before_script:
- *script-git-submodule
- *script-symlink-ansible-role
build:ubuntu-20.04:
<<: *job-molecule
stage: build
retry: 2
variables:
_MOLECULE_SCENARIO_NAME: "ubuntu-20.04"
build:ubuntu-18.04:
<<: *job-molecule
stage: build
retry: 2
variables:
_MOLECULE_SCENARIO_NAME: "ubuntu-18.04"
test:ubuntu-21.10:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "ubuntu-21.10"
allow_failure: true
test:ubuntu-21.04:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "ubuntu-21.04"
allow_failure: true
test:centos-8-stream:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "centos-8-stream"
allow_failure: true
test:centos-7:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "centos-7"
allow_failure: true
test:opensuse-tumbleweed:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "opensuse-tumbleweed"
allow_failure: true
test:opensuse-leap-15.3:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "opensuse-leap-15.3"
allow_failure: true
test:debian-testing:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "debian-testing"
allow_failure: true
test:debian-11:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "debian-11"
allow_failure: true
test:debian-10:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "debian-10"
allow_failure: true
test:fedora-rawhide:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "fedora-rawhide"
allow_failure: true
test:fedora-35:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "fedora-35"
allow_failure: true
test:fedora-34:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "fedora-34"
allow_failure: true
test:rhel-8:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "rhel-8"
allow_failure: true
test:rhel-7:
<<: *job-molecule
stage: test
variables:
_MOLECULE_SCENARIO_NAME: "rhel-7"
allow_failure: true
deploy:ansible-galaxy:
<<: *job-ansible-galaxy
stage: deploy
retry: 2
needs:
- build:ubuntu-20.04
- build:ubuntu-18.04