Skip to content

Commit

Permalink
The OCI distribution spec only allows lower case letter in container …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
sfc-gh-bxin authored Apr 27, 2023
1 parent 6db7c12 commit 8e70c6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions container/image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8e70c6b

Please sign in to comment.