Skip to content

Latest commit

 

History

History
347 lines (323 loc) · 12.5 KB

File metadata and controls

347 lines (323 loc) · 12.5 KB
 
May 21, 2020
May 21, 2020
1
# -*- mode: ruby -*-
2
# vi: set ft=ruby :
3
4
# Copyright The containerd Authors.
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License");
7
# you may not use this file except in compliance with the License.
8
# You may obtain a copy of the License at
9
10
# http://www.apache.org/licenses/LICENSE-2.0
11
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
17
Mar 30, 2022
Mar 30, 2022
18
# Vagrantfile for Fedora and EL
May 21, 2020
May 21, 2020
19
Vagrant.configure("2") do |config|
Oct 31, 2025
Oct 31, 2025
20
config.vm.box = ENV["BOX"] ? ENV["BOX"].split("@")[0] : "fedora/43-cloud-base"
Dec 8, 2022
Dec 8, 2022
21
# BOX_VERSION is deprecated. Use "BOX=<BOX>@<BOX_VERSION>".
22
config.vm.box_version = ENV["BOX_VERSION"] || (ENV["BOX"].split("@")[1] if ENV["BOX"])
Apr 26, 2022
Apr 26, 2022
23
Aug 12, 2020
Aug 12, 2020
24
memory = 4096
25
cpus = 2
Apr 26, 2022
Apr 26, 2022
26
disk_size = 60
Jan 3, 2023
Jan 3, 2023
27
config.vm.provider :virtualbox do |v, o|
Aug 12, 2020
Aug 12, 2020
28
v.memory = memory
29
v.cpus = cpus
Jan 3, 2023
Jan 3, 2023
30
# Needs env var VAGRANT_EXPERIMENTAL="disks"
31
o.vm.disk :disk, size: "#{disk_size}GB", primary: true
Aug 8, 2023
Aug 8, 2023
32
v.customize ["modifyvm", :id, "--firmware", "efi"]
May 21, 2020
May 21, 2020
33
end
34
config.vm.provider :libvirt do |v|
Aug 12, 2020
Aug 12, 2020
35
v.memory = memory
36
v.cpus = cpus
Apr 26, 2022
Apr 26, 2022
37
v.machine_virtual_size = disk_size
Oct 11, 2024
Oct 11, 2024
38
# https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1725#issuecomment-1454058646
39
# Needs `sudo cp /usr/share/OVMF/OVMF_VARS_4M.fd /var/lib/libvirt/qemu/nvram/`
40
v.loader = '/usr/share/OVMF/OVMF_CODE_4M.fd'
41
v.nvram = '/var/lib/libvirt/qemu/nvram/OVMF_VARS_4M.fd'
May 21, 2020
May 21, 2020
42
end
43
Oct 16, 2022
Oct 16, 2022
44
config.vm.synced_folder ".", "/vagrant", type: "rsync"
45
Apr 26, 2022
Apr 26, 2022
46
config.vm.provision 'shell', path: 'script/resize-vagrant-root.sh'
47
Aug 10, 2020
Aug 10, 2020
48
# Disabled by default. To run:
49
# vagrant up --provision-with=upgrade-packages
50
# To upgrade only specific packages:
51
# UPGRADE_PACKAGES=selinux vagrant up --provision-with=upgrade-packages
52
#
53
config.vm.provision "upgrade-packages", type: "shell", run: "never" do |sh|
54
sh.upload_path = "/tmp/vagrant-upgrade-packages"
55
sh.env = {
56
'UPGRADE_PACKAGES': ENV['UPGRADE_PACKAGES'],
57
}
58
sh.inline = <<~SHELL
59
#!/usr/bin/env bash
60
set -eux -o pipefail
61
dnf -y upgrade ${UPGRADE_PACKAGES}
62
SHELL
63
end
May 21, 2020
May 21, 2020
64
Aug 10, 2020
Aug 10, 2020
65
# To re-run, installing CNI from RPM:
66
# INSTALL_PACKAGES="containernetworking-plugins" vagrant up --provision-with=install-packages
67
#
68
config.vm.provision "install-packages", type: "shell", run: "once" do |sh|
69
sh.upload_path = "/tmp/vagrant-install-packages"
70
sh.env = {
71
'INSTALL_PACKAGES': ENV['INSTALL_PACKAGES'],
72
}
73
sh.inline = <<~SHELL
74
#!/usr/bin/env bash
75
set -eux -o pipefail
76
dnf -y install \
77
container-selinux \
78
curl \
79
gcc \
80
git \
81
iptables \
82
libseccomp-devel \
83
libselinux-devel \
84
lsof \
85
make \
Aug 11, 2023
Aug 11, 2023
86
strace \
Feb 28, 2026
Feb 28, 2026
87
kernel-modules-extra-$(uname -r) \
Aug 10, 2020
Aug 10, 2020
88
${INSTALL_PACKAGES}
Feb 28, 2026
Feb 28, 2026
89
modprobe xt_comment
Aug 10, 2020
Aug 10, 2020
90
SHELL
91
end
May 21, 2020
May 21, 2020
92
Mar 30, 2022
Mar 30, 2022
93
# EL does not have /usr/local/{bin,sbin} in the PATH by default
94
config.vm.provision "setup-etc-environment", type: "shell", run: "once" do |sh|
95
sh.upload_path = "/tmp/vagrant-setup-etc-environment"
96
sh.inline = <<~SHELL
97
#!/usr/bin/env bash
98
set -eux -o pipefail
99
cat >> /etc/environment <<EOF
100
PATH=/usr/local/go/bin:/usr/local/bin:/usr/local/sbin:$PATH
101
EOF
102
source /etc/environment
103
SHELL
104
end
105
Aug 10, 2020
Aug 10, 2020
106
# To re-run this provisioner, installing a different version of go:
107
# GO_VERSION="1.14.6" vagrant up --provision-with=install-golang
108
#
109
config.vm.provision "install-golang", type: "shell", run: "once" do |sh|
110
sh.upload_path = "/tmp/vagrant-install-golang"
111
sh.env = {
Apr 7, 2026
Apr 7, 2026
112
'GO_VERSION': ENV['GO_VERSION'] || "1.26.2",
Aug 10, 2020
Aug 10, 2020
113
}
114
sh.inline = <<~SHELL
115
#!/usr/bin/env bash
116
set -eux -o pipefail
117
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local
118
cat >> /etc/profile.d/sh.local <<EOF
Jul 16, 2020
Jul 16, 2020
119
GOPATH=\\$HOME/go
120
PATH=\\$GOPATH/bin:\\$PATH
121
export GOPATH PATH
May 9, 2022
May 9, 2022
122
git config --global --add safe.directory /vagrant
May 21, 2020
May 21, 2020
123
EOF
124
source /etc/profile.d/sh.local
Aug 10, 2020
Aug 10, 2020
125
SHELL
126
end
May 21, 2020
May 21, 2020
127
Aug 10, 2020
Aug 10, 2020
128
config.vm.provision "setup-gopath", type: "shell", run: "once" do |sh|
129
sh.upload_path = "/tmp/vagrant-setup-gopath"
130
sh.inline = <<~SHELL
131
#!/usr/bin/env bash
132
source /etc/environment
133
source /etc/profile.d/sh.local
134
set -eux -o pipefail
135
mkdir -p ${GOPATH}/src/github.com/containerd
136
ln -fnsv /vagrant ${GOPATH}/src/github.com/containerd/containerd
137
SHELL
138
end
139
140
config.vm.provision "install-runc", type: "shell", run: "once" do |sh|
141
sh.upload_path = "/tmp/vagrant-install-runc"
142
sh.env = {
143
'RUNC_FLAVOR': ENV['RUNC_FLAVOR'] || "runc",
144
}
145
sh.inline = <<~SHELL
146
#!/usr/bin/env bash
147
source /etc/environment
148
source /etc/profile.d/sh.local
149
set -eux -o pipefail
150
${GOPATH}/src/github.com/containerd/containerd/script/setup/install-runc
151
type runc
152
runc --version
153
chcon -v -t container_runtime_exec_t $(type -ap runc)
154
SHELL
155
end
156
157
config.vm.provision "install-cni", type: "shell", run: "once" do |sh|
158
sh.upload_path = "/tmp/vagrant-install-cni"
159
sh.env = {
160
'CNI_BINARIES': 'bridge dhcp flannel host-device host-local ipvlan loopback macvlan portmap ptp tuning vlan',
161
}
162
sh.inline = <<~SHELL
163
#!/usr/bin/env bash
164
source /etc/environment
165
source /etc/profile.d/sh.local
166
set -eux -o pipefail
Oct 10, 2022
Oct 10, 2022
167
cd ${GOPATH}/src/github.com/containerd/containerd
168
script/setup/install-cni
Aug 10, 2020
Aug 10, 2020
169
PATH=/opt/cni/bin:$PATH type ${CNI_BINARIES} || true
170
SHELL
171
end
172
173
config.vm.provision "install-cri-tools", type: "shell", run: "once" do |sh|
174
sh.upload_path = "/tmp/vagrant-install-cri-tools"
175
sh.env = {
176
'CRI_TOOLS_VERSION': ENV['CRI_TOOLS_VERSION'] || '16911795a3c33833fa0ec83dac1ade3172f6989e',
177
'GOBIN': '/usr/local/bin',
178
}
179
sh.inline = <<~SHELL
180
#!/usr/bin/env bash
181
source /etc/environment
182
source /etc/profile.d/sh.local
183
set -eux -o pipefail
184
${GOPATH}/src/github.com/containerd/containerd/script/setup/install-critools
185
type crictl critest
186
critest --version
187
SHELL
188
end
189
190
config.vm.provision "install-containerd", type: "shell", run: "once" do |sh|
191
sh.upload_path = "/tmp/vagrant-install-containerd"
192
sh.inline = <<~SHELL
193
#!/usr/bin/env bash
194
source /etc/environment
195
source /etc/profile.d/sh.local
196
set -eux -o pipefail
197
cd ${GOPATH}/src/github.com/containerd/containerd
Mar 14, 2023
Mar 14, 2023
198
make BUILDTAGS="seccomp selinux no_btrfs no_devmapper no_zfs" binaries install
Aug 10, 2020
Aug 10, 2020
199
type containerd
200
containerd --version
201
chcon -v -t container_runtime_exec_t /usr/local/bin/{containerd,containerd-shim*}
202
./script/setup/config-containerd
203
SHELL
204
end
205
Mar 31, 2021
Mar 31, 2021
206
config.vm.provision "install-gotestsum", type: "shell", run: "once" do |sh|
207
sh.upload_path = "/tmp/vagrant-install-gotestsum"
208
sh.inline = <<~SHELL
209
#!/usr/bin/env bash
210
source /etc/environment
211
source /etc/profile.d/sh.local
212
set -eux -o pipefail
213
${GOPATH}/src/github.com/containerd/containerd/script/setup/install-gotestsum
214
sudo cp ${GOPATH}/bin/gotestsum /usr/local/bin/
215
SHELL
216
end
217
Jan 3, 2023
Jan 3, 2023
218
config.vm.provision "install-failpoint-binaries", type: "shell", run: "once" do |sh|
219
sh.upload_path = "/tmp/vagrant-install-failpoint-binaries"
220
sh.inline = <<~SHELL
221
#!/usr/bin/env bash
222
source /etc/environment
223
source /etc/profile.d/sh.local
224
set -eux -o pipefail
225
${GOPATH}/src/github.com/containerd/containerd/script/setup/install-failpoint-binaries
226
chcon -v -t container_runtime_exec_t $(type -ap containerd-shim-runc-fp-v1)
227
containerd-shim-runc-fp-v1 -v
228
SHELL
229
end
230
Aug 10, 2020
Aug 10, 2020
231
# SELinux is Enforcing by default.
232
# To set SELinux as Disabled on a VM that has already been provisioned:
233
# SELINUX=Disabled vagrant up --provision-with=selinux
234
# To set SELinux as Permissive on a VM that has already been provsioned
235
# SELINUX=Permissive vagrant up --provision-with=selinux
236
config.vm.provision "selinux", type: "shell", run: "never" do |sh|
237
sh.upload_path = "/tmp/vagrant-selinux"
238
sh.env = {
239
'SELINUX': ENV['SELINUX'] || "Enforcing"
240
}
241
sh.inline = <<~SHELL
242
/vagrant/script/setup/config-selinux
243
/vagrant/script/setup/config-containerd
244
SHELL
245
end
246
Jan 3, 2023
Jan 3, 2023
247
# SELinux is Enforcing by default (via provisioning) in this VM. To re-run with SELinux disabled:
248
# SELINUX=Disabled vagrant up --provision-with=selinux,test-integration
Aug 10, 2020
Aug 10, 2020
249
#
250
config.vm.provision "test-integration", type: "shell", run: "never" do |sh|
251
sh.upload_path = "/tmp/test-integration"
252
sh.env = {
253
'RUNC_FLAVOR': ENV['RUNC_FLAVOR'] || "runc",
Mar 31, 2021
Mar 31, 2021
254
'GOTEST': ENV['GOTEST'] || "go test",
255
'GOTESTSUM_JUNITFILE': ENV['GOTESTSUM_JUNITFILE'],
Sep 14, 2022
Sep 14, 2022
256
'GOTESTSUM_JSONFILE': ENV['GOTESTSUM_JSONFILE'],
Aug 10, 2020
Aug 10, 2020
257
}
258
sh.inline = <<~SHELL
259
#!/usr/bin/env bash
260
source /etc/environment
261
source /etc/profile.d/sh.local
262
set -eux -o pipefail
263
rm -rf /var/lib/containerd-test /run/containerd-test
264
cd ${GOPATH}/src/github.com/containerd/containerd
Jan 17, 2024
Jan 17, 2024
265
go test -v -count=1 -race ./core/metrics/cgroups
Mar 25, 2021
Mar 25, 2021
266
make integration EXTRA_TESTFLAGS="-timeout 15m -no-criu -test.v" TEST_RUNTIME=io.containerd.runc.v2 RUNC_FLAVOR=$RUNC_FLAVOR
Aug 10, 2020
Aug 10, 2020
267
SHELL
268
end
269
Jan 3, 2023
Jan 3, 2023
270
# SELinux is Enforcing by default (via provisioning) in this VM. To re-run with SELinux disabled:
271
# SELINUX=Disabled vagrant up --provision-with=selinux,test-cri-integration
272
#
273
config.vm.provision "test-cri-integration", type: "shell", run: "never" do |sh|
274
sh.upload_path = "/tmp/test-cri-integration"
275
sh.env = {
276
'GOTEST': ENV['GOTEST'] || "go test",
277
'GOTESTSUM_JUNITFILE': ENV['GOTESTSUM_JUNITFILE'],
278
'GOTESTSUM_JSONFILE': ENV['GOTESTSUM_JSONFILE'],
279
'GITHUB_WORKSPACE': '',
Oct 2, 2024
Oct 2, 2024
280
'CGROUP_DRIVER': ENV['CGROUP_DRIVER'],
Mar 23, 2026
Mar 23, 2026
281
'RUNC_FLAVOR': ENV['RUNC_FLAVOR'] || "runc",
Jan 3, 2023
Jan 3, 2023
282
}
283
sh.inline = <<~SHELL
284
#!/usr/bin/env bash
285
source /etc/environment
286
source /etc/profile.d/sh.local
287
set -eux -o pipefail
288
cleanup() {
289
rm -rf /var/lib/containerd* /run/containerd* /tmp/containerd* /tmp/test* /tmp/failpoint* /tmp/nri*
290
}
291
cleanup
292
cd ${GOPATH}/src/github.com/containerd/containerd
293
# cri-integration.sh executes containerd from ./bin, not from $PATH .
Mar 14, 2023
Mar 14, 2023
294
make BUILDTAGS="seccomp selinux no_btrfs no_devmapper no_zfs" binaries bin/cri-integration.test
Jan 3, 2023
Jan 3, 2023
295
chcon -v -t container_runtime_exec_t ./bin/{containerd,containerd-shim*}
296
CONTAINERD_RUNTIME=io.containerd.runc.v2 ./script/test/cri-integration.sh
297
cleanup
298
SHELL
299
end
300
Jan 3, 2023
Jan 3, 2023
301
# SELinux is Enforcing by default (via provisioning) in this VM. To re-run with SELinux disabled:
302
# SELINUX=Disabled vagrant up --provision-with=selinux,test-cri
Aug 10, 2020
Aug 10, 2020
303
#
304
config.vm.provision "test-cri", type: "shell", run: "never" do |sh|
305
sh.upload_path = "/tmp/test-cri"
Mar 31, 2021
Mar 31, 2021
306
sh.env = {
307
'GOTEST': ENV['GOTEST'] || "go test",
308
'REPORT_DIR': ENV['REPORT_DIR'],
Oct 2, 2024
Oct 2, 2024
309
'CGROUP_DRIVER': ENV['CGROUP_DRIVER'],
Mar 23, 2026
Mar 23, 2026
310
'RUNC_FLAVOR': ENV['RUNC_FLAVOR'] || "runc",
Mar 31, 2021
Mar 31, 2021
311
}
Aug 10, 2020
Aug 10, 2020
312
sh.inline = <<~SHELL
313
#!/usr/bin/env bash
314
source /etc/environment
315
source /etc/profile.d/sh.local
316
set -eux -o pipefail
317
systemctl disable --now containerd || true
318
rm -rf /var/lib/containerd /run/containerd
319
function cleanup()
320
{
321
journalctl -u containerd > /tmp/containerd.log
Aug 7, 2022
Aug 7, 2022
322
cat /tmp/containerd.log
Aug 10, 2020
Aug 10, 2020
323
systemctl stop containerd
324
}
325
selinux=$(getenforce)
326
if [[ $selinux == Enforcing ]]; then
327
setenforce 0
328
fi
329
systemctl enable --now ${GOPATH}/src/github.com/containerd/containerd/containerd.service
330
if [[ $selinux == Enforcing ]]; then
331
setenforce 1
332
fi
333
trap cleanup EXIT
334
ctr version
Jan 7, 2026
Jan 7, 2026
335
336
skip_tests=(
337
'HostIpc is true'
338
)
339
if [[ $CGROUP_DRIVER == "systemd" ]]; then
340
skip_tests+=("should terminate with exitCode 137 and reason OOMKilled")
341
fi
342
skip_test_args=$(IFS='|'; echo "${skip_tests[*]}")
343
critest --parallel=$[$(nproc)+2] --ginkgo.skip="${skip_test_args}" --report-dir="${REPORT_DIR}"
Aug 10, 2020
Aug 10, 2020
344
SHELL
345
end
May 21, 2020
May 21, 2020
346
347
end