Skip to content

Commit 76efe8a

Browse files
committed
virt-v2v: Build our own fixed appliance on el8
Similar to #226 but on el8 (the appliance used with el8 libguestfs does not support qcow2 images so the image is still compressed within the container image and extract by the 'entrypoint' script). Signed-off-by: Arik Hadas <ahadas@redhat.com>
1 parent 13f9dd5 commit 76efe8a

File tree

6 files changed

+47
-20
lines changed

6 files changed

+47
-20
lines changed

cmd/forklift-controller/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ load(
1515

1616
container_image(
1717
name = "forklift-controller-image",
18-
#architecture = select({
19-
# "@io_bazel_rules_go//go/platform:linux_arm64": "arm64",
20-
# "//conditions:default": "amd64",
21-
#}),
22-
#base = "@centos-stream8//image",
2318
base = "@ubi9-minimal//image",
2419
directory = "/usr/local/bin/",
2520
entrypoint = ["/usr/local/bin/forklift-controller"],

virt-v2v/cold/WORKSPACE

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,6 @@ load(
159159

160160
container_repositories()
161161

162-
container_pull(
163-
name = "ubi8-minimal",
164-
# 'tag' is also supported, but digest is encouraged for reproducibility.
165-
digest = "sha256:d1f8eff6032334a81d7cbfd73dacee680e8138db57ecbc91548b97bb45e698e5",
166-
registry = "registry.access.redhat.com",
167-
repository = "ubi8/ubi-minimal",
168-
)
169-
170162
http_archive(
171163
name = "bazeldnf",
172164
sha256 = "404fc34e6bd3b568a7ca6fbcde70267d43830d0171d3192e3ecd83c14c320cfc",

virt-v2v/warm/.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Appliance build
2+
# container_run_and_extract() does not work inside Podman and Docker
3+
# sandboxes. Use slightly less secure but working processwrapper sandbox.
4+
# NOTE: Same configuration is in .bazelrc in repository root.
5+
build --strategy_regexp="Action appliance/libguestfs-appliance.tar"=processwrapper-sandbox
6+

virt-v2v/warm/BUILD.bazel

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ load(
44
"container_image",
55
"container_push",
66
)
7+
load(
8+
"@io_bazel_rules_docker//docker/util:run.bzl",
9+
"container_run_and_extract",
10+
)
711

812
container_push(
913
name = "push-forklift-virt-v2v-warm",
@@ -14,9 +18,40 @@ container_push(
1418
tag = "$${REGISTRY_TAG:-devel}",
1519
)
1620

21+
# Appliance build
22+
# NOTE: We deliberately do not use (and cannot use) rpmtree to build a base
23+
# layer with packages. Supermin queries the RPM database to track package files
24+
# and dependencies. Tar constructed by rpmtree is just a bunch of files and it
25+
# does not preserve the RPM database info. Therefore we imitate a Dockerfile
26+
# build here.
27+
container_run_and_extract(
28+
name = "appliance",
29+
commands = [
30+
"set -x",
31+
"dnf -y update",
32+
"dnf -y install libguestfs-devel libguestfs-appliance libguestfs-xfs libguestfs-winsupport supermin",
33+
"depmod \\$(ls /lib/modules/ |tail -n1)",
34+
"export LIBGUESTFS_BACKEND=direct",
35+
"export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1",
36+
"mkdir -p /usr/lib64/guestfs/appliance",
37+
"cd /usr/lib64/guestfs/appliance",
38+
"libguestfs-make-fixed-appliance --xz",
39+
"cp /usr/lib64/guestfs/appliance/appliance-*.tar.xz /libguestfs-appliance.tar.xz",
40+
],
41+
extract_file = "/libguestfs-appliance.tar.xz",
42+
image = "@centos-stream-8//image",
43+
)
44+
45+
container_image(
46+
name = "appliance-image",
47+
base = "@ubi8-minimal//image",
48+
directory = "/usr/lib64/guestfs",
49+
files = [":appliance/libguestfs-appliance.tar.xz"],
50+
)
51+
1752
container_image(
1853
name = "virt-v2v-image",
19-
base = "@libguestfs-appliance//image",
54+
base = "appliance-image",
2055
directory = "/",
2156
tars = [":virt-v2v"],
2257
)

virt-v2v/warm/WORKSPACE

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,16 @@ container_repositories()
143143

144144
container_pull(
145145
name = "ubi8-minimal",
146-
# 'tag' is also supported, but digest is encouraged for reproducibility.
147-
digest = "sha256:d1f8eff6032334a81d7cbfd73dacee680e8138db57ecbc91548b97bb45e698e5",
148146
registry = "registry.access.redhat.com",
149147
repository = "ubi8/ubi-minimal",
148+
tag = "latest",
150149
)
151150

152151
container_pull(
153-
name = "libguestfs-appliance",
154-
digest = "sha256:6abc2a68f4a42dbf3a7db1042a73862e763b6c864c1e04659dc6bd981e430ae5",
152+
name = "centos-stream-8",
155153
registry = "quay.io",
156-
repository = "kubev2v/libguestfs-appliance",
154+
repository = "centos/centos",
155+
tag = "stream8",
157156
)
158157

159158
http_archive(

virt-v2v/warm/entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
shopt -s nullglob
33

44
export LIBGUESTFS_PATH=/usr/lib64/guestfs
5-
set -- "$LIBGUESTFS_PATH"/appliance-*.tar.xz
5+
set -- "$LIBGUESTFS_PATH"/libguestfs-appliance.tar.xz
66
if [ -f "$1" ] ; then
77
echo "Extracting libguestfs appliance..."
88
APPLIANCE="/var/tmp/libguestfs-appliance"

0 commit comments

Comments
 (0)