treewide: replace rules_docker with rules_oci
rules_docker is not maintained anymore and recommends migration to
rules_oci
Change-Id: I089f3cf44888b3c3c0baa2c84a319b04b1a7dec4
Reviewed-on: https://review.monogon.dev/c/monogon/+/2712
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/cloud/BUILD.bazel b/cloud/BUILD.bazel
index 0e44a88..965c100 100644
--- a/cloud/BUILD.bazel
+++ b/cloud/BUILD.bazel
@@ -1,19 +1,58 @@
-load("@io_bazel_rules_docker//container:bundle.bzl", "container_bundle")
-load("@io_bazel_rules_docker//contrib:push-all.bzl", "container_push")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
-container_bundle(
- name = "cloud_containers",
- images = {
- "gcr.io/monogon-infra/cloud/apigw:{STABLE_MONOGON_cloud_version}": "//cloud/apigw:apigw_container",
- "gcr.io/monogon-infra/cloud/shepherd/equinix:{STABLE_MONOGON_cloud_version}": "//cloud/shepherd/provider/equinix:equinix_container",
- "gcr.io/monogon-infra/cloud/bmsrv:{STABLE_MONOGON_cloud_version}": "//cloud/bmaas/server/cmd:cmd_container",
- "gcr.io/monogon-infra/cloud/scruffy:{STABLE_MONOGON_cloud_version}": "//cloud/bmaas/scruffy/cmd:cmd_container",
- "gcr.io/monogon-infra/cloud/shepherd/mini:{STABLE_MONOGON_cloud_version}": "//cloud/shepherd/mini:mini_container",
- },
+write_file(
+ name = "tags_tmpl",
+ out = "tags.txt.tmpl",
+ content = [
+ "BUILD_VERSION",
+ ],
)
-container_push(
- name = "push",
- bundle = ":cloud_containers",
- format = "Docker",
+load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
+
+# Use the value of --embed_label under --stamp, otherwise use a deterministic constant
+# value to ensure cache hits for actions that depend on this.
+expand_template(
+ name = "stamped",
+ out = "_stamped.tags.txt",
+ stamp_substitutions = {"BUILD_VERSION": "{{STABLE_MONOGON_cloud_version}}"},
+ substitutions = {"BUILD_VERSION": "0.0.0"},
+ template = "tags_tmpl",
+)
+
+load("@rules_oci//oci:defs.bzl", "oci_push")
+
+oci_push(
+ name = "apigw_image",
+ image = "//cloud/apigw:apigw_image",
+ remote_tags = ":stamped",
+ repository = "gcr.io/monogon-infra/cloud/apigw",
+)
+
+oci_push(
+ name = "shepherd_equinix",
+ image = "//cloud/shepherd/provider/equinix:equinix_image",
+ remote_tags = ":stamped",
+ repository = "gcr.io/monogon-infra/cloud/shepherd/equinix",
+)
+
+oci_push(
+ name = "bmsrv",
+ image = "//cloud/bmaas/server/cmd:cmd_image",
+ remote_tags = ":stamped",
+ repository = "gcr.io/monogon-infra/cloud/bmsrv",
+)
+
+oci_push(
+ name = "scruffy",
+ image = "//cloud/bmaas/scruffy/cmd:cmd_image",
+ remote_tags = ":stamped",
+ repository = "gcr.io/monogon-infra/cloud/scruffy",
+)
+
+oci_push(
+ name = "shepherd_mini",
+ image = "//cloud/shepherd/mini:mini_image",
+ remote_tags = ":stamped",
+ repository = "gcr.io/monogon-infra/cloud/shepherd/mini",
)