Skip to content

Commit 6c14482

Browse files
committed
chore: split vagrant provisioning
Signed-off-by: CrazyMax <[email protected]>
1 parent 67e1e6d commit 6c14482

File tree

3 files changed

+75
-45
lines changed

3 files changed

+75
-45
lines changed

.github/workflows/test-os.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,19 @@ jobs:
104104
${{ runner.os }}-vagrant-
105105
-
106106
name: Set up vagrant
107-
run: vagrant up
107+
run: |
108+
vagrant up --no-tty
108109
-
109-
name: Integration smoke test
110+
name: Smoke test
110111
run: |
111-
vagrant ssh -- "cp /vagrant/hack/dockerfiles/freebsd-smoke.Dockerfile /vagrant/cmd/buildctl/Dockerfile"
112-
vagrant ssh -- "cd /vagrant/cmd/buildctl; go run . build --frontend dockerfile.v0 --local context=. --local dockerfile=."
112+
vagrant up --provision-with=test-smoke
113113
-
114-
name: Print BuildKit logs
114+
name: BuildKit logs
115115
if: always()
116-
run: vagrant ssh -- "sudo cat /vagrant/run-logs/buildkitd"
116+
run: |
117+
vagrant ssh -- "sudo cat /vagrant/.tmp/logs/buildkitd"
118+
-
119+
name: Containerd logs
120+
if: always()
121+
run: |
122+
vagrant ssh -- "sudo cat /vagrant/.tmp/logs/containerd"

hack/Vagrantfile.freebsd13

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,74 @@
1-
# This code is taken from the Vagrantfile from libjail-rs
2-
# https://github.com/fubarnetes/libjail-rs/blob/727353bd6565c5e7a9be2664258d0197a1c8bb35/Vagrantfile
3-
# licensed under BSD-3 Clause License:
4-
# BSD 3-Clause License
5-
6-
# Copyright (c) 2018, Fabian Freyer <[email protected]> All rights reserved.
7-
8-
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9-
10-
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11-
12-
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
13-
14-
# * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
15-
16-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
173

184
Vagrant.configure("2") do |config|
19-
# Stable version
20-
#
215
config.vm.define "fbsd_13_2" do |fbsd_13_2|
226
fbsd_13_2.vm.box = "freebsd/FreeBSD-13.2-RELEASE"
237
end
248

25-
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__auto: true
9+
config.vm.synced_folder ".", "/vagrant", type: "rsync"
10+
11+
config.vm.provision "init", type: "shell", run: "once" do |sh|
12+
sh.inline = <<~SHELL
13+
#!/usr/bin/env bash
14+
set -eux -o pipefail
15+
kldload nullfs
16+
pkg install -y go git containerd runj
17+
mkdir -p /vagrant/coverage /vagrant/.tmp/logs
18+
SHELL
19+
end
20+
21+
config.vm.provision "install-buildkitd", type: "shell", run: "once" do |sh|
22+
sh.inline = <<~SHELL
23+
#!/usr/bin/env bash
24+
set -eux -o pipefail
25+
cd /vagrant
26+
go build -o /usr/bin/buildkitd ./cmd/buildkitd
27+
type /usr/bin/buildkitd
28+
buildkitd --version
29+
SHELL
30+
end
2631

27-
config.vm.provision "shell", inline: <<-SHELL
28-
kldload nullfs
29-
echo 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/FreeBSD.conf
32+
config.vm.provision "install-buildctl", type: "shell", run: "once" do |sh|
33+
sh.inline = <<~SHELL
34+
#!/usr/bin/env bash
35+
set -eux -o pipefail
36+
cd /vagrant
37+
go build -o /usr/bin/buildctl ./cmd/buildctl
38+
type /usr/bin/buildctl
39+
SHELL
40+
end
3041

31-
pkg bootstrap
32-
pkg install -y go git containerd runj wait_on
42+
config.vm.provision "run-containerd", type: "shell", run: "once" do |sh|
43+
sh.inline = <<~SHELL
44+
#!/usr/bin/env bash
45+
set -eux -o pipefail
46+
containerd --version
47+
daemon -o /vagrant/.tmp/logs/containerd containerd
48+
SHELL
49+
end
3350

34-
mkdir -p /vagrant/coverage
35-
mkdir -p /vagrant/run-logs
36-
daemon -o /vagrant/run-logs/containerd containerd
51+
config.vm.provision "run-buildkitd", type: "shell", run: "once" do |sh|
52+
sh.inline = <<~SHELL
53+
#!/usr/bin/env bash
54+
set -eux -o pipefail
55+
mkdir -p /run/buildkit
56+
daemon -o /vagrant/.tmp/logs/buildkitd /usr/bin/buildkitd --addr=unix:///run/buildkit/buildkitd.sock
57+
sleep 3
58+
SHELL
59+
end
3760

38-
mkdir -p /run/buildkit
39-
cd /vagrant/cmd/buildkitd
40-
go build -buildvcs=false .
41-
echo "launching buildkitd..."
42-
mkdir -p /run/buildkit
43-
daemon -o /vagrant/run-logs/buildkitd ./buildkitd
44-
wait_on -t 5 /run/buildkit
45-
echo "launched buildkitd"
46-
SHELL
61+
config.vm.provision "test-smoke", type: "shell", run: "never" do |sh|
62+
sh.inline = <<~SHELL
63+
#!/usr/bin/env bash
64+
set -eux -o pipefail
65+
mkdir -p /vagrant/.tmp/freebsd-smoke
66+
cd /vagrant/.tmp/freebsd-smoke
67+
cat > Dockerfile <<EOF
68+
FROM dougrabson/freebsd-minimal:13
69+
RUN echo "Hello, buildkit!"
70+
EOF
71+
buildctl build --frontend dockerfile.v0 --local context=. --local dockerfile=.
72+
SHELL
73+
end
4774
end

hack/dockerfiles/freebsd-smoke.Dockerfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)