treewide: add product info to OCI OS images
Add the product info to the OCI OS image config.
Change-Id: I70c572f2698c8d8bb0edc0ba969d8c6b37ae4c00
Reviewed-on: https://review.monogon.dev/c/monogon/+/4193
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/oci/osimage/BUILD.bazel b/osbase/oci/osimage/BUILD.bazel
index f54cdfb..62a1401 100644
--- a/osbase/oci/osimage/BUILD.bazel
+++ b/osbase/oci/osimage/BUILD.bazel
@@ -23,6 +23,7 @@
# the chunking, but also not too large.
"test": "//third_party/linux",
},
+ product_info = ":test_product_info.json",
visibility = ["//osbase/oci:__subpackages__"],
)
@@ -32,6 +33,7 @@
"test": "//third_party/linux",
},
compression_level = 0,
+ product_info = ":test_product_info.json",
visibility = ["//osbase/oci:__subpackages__"],
)
diff --git a/osbase/oci/osimage/test_product_info.json b/osbase/oci/osimage/test_product_info.json
new file mode 100644
index 0000000..ba6096f
--- /dev/null
+++ b/osbase/oci/osimage/test_product_info.json
@@ -0,0 +1,10 @@
+{
+ "id": "testos",
+ "name": "Test OS",
+ "version": "0.0.0",
+ "variant": "x86_64",
+ "architecture": "x86_64",
+ "commit_hash": "",
+ "commit_date": "",
+ "build_tree_dirty": false
+}
diff --git a/osbase/oci/osimage/types.go b/osbase/oci/osimage/types.go
index d251a74..c94ae35 100644
--- a/osbase/oci/osimage/types.go
+++ b/osbase/oci/osimage/types.go
@@ -21,6 +21,8 @@
// FormatVersion should be incremented when making breaking changes to the
// image format. Readers must stop when they see an unknown version.
FormatVersion string `json:"format_version"`
+ // ProductInfo contains information about the content of the image.
+ ProductInfo ProductInfo `json:"product_info"`
// Payloads describes the payloads contained in the image. It has the same
// length and order as the layers list in the image manifest.
Payloads []PayloadInfo `json:"payloads"`