metropolis: use new OS image format for install
This switches the USB and SSH installation methods to the new OS image
format based on OCI artifacts.
When stored on disk, the new format consists of a directory containing
an OCI layout, instead of a single file. This means that all steps which
copy or upload an image now need to handle a tree of files.
Change-Id: I526d32f5c50bd74f513f785118768a56b2655fa0
Reviewed-on: https://review.monogon.dev/c/monogon/+/4090
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/installer/test/BUILD.bazel b/metropolis/installer/test/BUILD.bazel
index 7b7828d..903f46e 100644
--- a/metropolis/installer/test/BUILD.bazel
+++ b/metropolis/installer/test/BUILD.bazel
@@ -7,7 +7,7 @@
srcs = ["run_test.go"],
data = [
":kernel",
- "//metropolis/installer/test/testos:testos_bundle",
+ "//metropolis/installer/test/testos:testos_image",
"//third_party/edk2:OVMF_CODE.fd",
"//third_party/edk2:OVMF_VARS.fd",
],
@@ -17,13 +17,14 @@
"xOvmfVarsPath": "$(rlocationpath //third_party/edk2:OVMF_VARS.fd )",
"xOvmfCodePath": "$(rlocationpath //third_party/edk2:OVMF_CODE.fd )",
"xInstallerPath": "$(rlocationpath :kernel )",
- "xBundlePath": "$(rlocationpath //metropolis/installer/test/testos:testos_bundle )",
+ "xImagePath": "$(rlocationpath //metropolis/installer/test/testos:testos_image )",
},
deps = [
"//metropolis/cli/metroctl/core",
"//metropolis/proto/api",
"//osbase/build/mkimage/osimage",
"//osbase/cmd",
+ "//osbase/oci",
"//osbase/structfs",
"@com_github_diskfs_go_diskfs//:go-diskfs",
"@com_github_diskfs_go_diskfs//disk",
diff --git a/metropolis/installer/test/run_test.go b/metropolis/installer/test/run_test.go
index cd87852..925e758 100644
--- a/metropolis/installer/test/run_test.go
+++ b/metropolis/installer/test/run_test.go
@@ -26,6 +26,7 @@
mctl "source.monogon.dev/metropolis/cli/metroctl/core"
"source.monogon.dev/osbase/build/mkimage/osimage"
"source.monogon.dev/osbase/cmd"
+ "source.monogon.dev/osbase/oci"
"source.monogon.dev/osbase/structfs"
)
@@ -36,14 +37,14 @@
xOvmfCodePath string
xOvmfVarsPath string
xInstallerPath string
- xBundlePath string
+ xImagePath string
)
func init() {
var err error
for _, path := range []*string{
&xOvmfCodePath, &xOvmfVarsPath,
- &xInstallerPath, &xBundlePath,
+ &xInstallerPath, &xImagePath,
} {
*path, err = runfiles.Rlocation(*path)
if err != nil {
@@ -139,7 +140,7 @@
log.Fatal(err)
}
- bundle, err := structfs.OSPathBlob(xBundlePath)
+ image, err := oci.ReadLayout(xImagePath)
if err != nil {
log.Fatal(err)
}
@@ -148,7 +149,7 @@
Installer: installer,
TargetPath: installerImage,
NodeParams: &api.NodeParameters{},
- Bundle: bundle,
+ Image: image,
}
if err := mctl.MakeInstallerImage(iargs); err != nil {
log.Fatalf("Couldn't create the installer image at %q: %v", installerImage, err)
diff --git a/metropolis/installer/test/testos/BUILD.bazel b/metropolis/installer/test/testos/BUILD.bazel
index c8f1c3f..e8d8700 100644
--- a/metropolis/installer/test/testos/BUILD.bazel
+++ b/metropolis/installer/test/testos/BUILD.bazel
@@ -1,6 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_pkg//:pkg.bzl", "pkg_zip")
load("//osbase/build/mkerofs:def.bzl", "erofs_image")
+load("//osbase/build/mkoci:def.bzl", "oci_os_image")
load("//osbase/build/mkpayload:def.bzl", "efi_unified_kernel_image")
load("//osbase/build/mkverity:def.bzl", "verity_image")
@@ -35,6 +36,15 @@
visibility = ["//visibility:public"],
)
+oci_os_image(
+ name = "testos_image",
+ srcs = {
+ "system": ":verity_rootfs",
+ "kernel.efi": ":kernel_efi",
+ },
+ visibility = ["//visibility:public"],
+)
+
go_library(
name = "testos_lib",
srcs = ["main.go"],