From 8e70c6bcb584a15a8fd061ea489b933c0ff344ca Mon Sep 17 00:00:00 2001 From: Bin Xin Date: Thu, 27 Apr 2023 13:06:36 -0700 Subject: [PATCH] The OCI distribution spec only allows lower case letter in container repository (#2252) name (https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifests), this doesn't bode well with Bazel package path using upper case. To be clear: docker itself is ok with upper case: https://ktomk.github.io/pipelines/doc/DOCKER-NAME-TAG.html. Picking the common denominator here, and force lower case on pkg path. --- container/image.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/container/image.bzl b/container/image.bzl index 790409a7e..bb27848d1 100644 --- a/container/image.bzl +++ b/container/image.bzl @@ -237,12 +237,12 @@ def _repository_name(ctx): """Compute the repository name for the current rule.""" if ctx.attr.legacy_repository_naming: # Legacy behavior, off by default. - return _join_path(ctx.attr.repository, ctx.label.package.replace("/", "_")) + return _join_path(ctx.attr.repository, ctx.label.package.lower().replace("/", "_")) # Newer Docker clients support multi-level names, which are a part of # the v2 registry specification. - return _join_path(ctx.attr.repository, ctx.label.package) + return _join_path(ctx.attr.repository, ctx.label.package.lower()) def _assemble_image_digest(ctx, name, image, image_tarball, output_digest): img_args, inputs = _gen_img_args(ctx, image)