m/p/localregistry: init
Adds the localregistry package, which serves Bazel-built container
images via the Docker/OCI V2 registry API.
This will be used to serve test images instead of preseeding them.
Change-Id: I0c2ceb9a83f807c9c87ab03bc1141ca67cc64268
Reviewed-on: https://review.monogon.dev/c/monogon/+/1926
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/pkg/localregistry/spec/BUILD.bazel b/metropolis/pkg/localregistry/spec/BUILD.bazel
new file mode 100644
index 0000000..3d6b734
--- /dev/null
+++ b/metropolis/pkg/localregistry/spec/BUILD.bazel
@@ -0,0 +1,23 @@
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+proto_library(
+ name = "spec_proto",
+ srcs = ["manifest.proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_library(
+ name = "spec_go_proto",
+ importpath = "source.monogon.dev/metropolis/pkg/localregistry/spec",
+ proto = ":spec_proto",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "spec",
+ embed = [":spec_go_proto"],
+ importpath = "source.monogon.dev/metropolis/pkg/localregistry/spec",
+ visibility = ["//visibility:public"],
+)
diff --git a/metropolis/pkg/localregistry/spec/gomod-generated-placeholder.go b/metropolis/pkg/localregistry/spec/gomod-generated-placeholder.go
new file mode 100644
index 0000000..f09cd57
--- /dev/null
+++ b/metropolis/pkg/localregistry/spec/gomod-generated-placeholder.go
@@ -0,0 +1 @@
+package spec
diff --git a/metropolis/pkg/localregistry/spec/manifest.proto b/metropolis/pkg/localregistry/spec/manifest.proto
new file mode 100644
index 0000000..b4daeab
--- /dev/null
+++ b/metropolis/pkg/localregistry/spec/manifest.proto
@@ -0,0 +1,30 @@
+syntax = "proto3";
+
+package monogon.metropolis.pkg.localregistry;
+
+option go_package = "source.monogon.dev/metropolis/pkg/localregistry/spec";
+
+// BlobDescriptor is metadata for a single registry blob. Analogous to a
+// distribution.Descriptor in Go.
+message BlobDescriptor {
+ // Path to the file in the build directory.
+ string file_path = 1;
+ // Path to a file containing the SHA256 digest of the blob.
+ string digest_path = 2;
+}
+
+// Single image metadata
+message Image {
+ // Name of the image (no domain or tag, just slash-separated path)
+ string name = 1;
+ // Config blob
+ BlobDescriptor config = 2;
+ // Layer blobs in order
+ repeated BlobDescriptor layers = 3;
+}
+
+// Main message
+message Manifest {
+ // List of images for the local registry
+ repeated Image images = 1;
+}
\ No newline at end of file