rules_helm icon indicating copy to clipboard operation
rules_helm copied to clipboard

remote_tag can be used as image ref

Open dormidon opened this issue 4 months ago • 0 comments

I would like to suggest some enhancements regarding oci_push image referencing and replacements in chart files.

Sometimes it's more convenient to see meaningful Docker image tag in k8s specs instead of sha256 (otherwise we didn't add these tags to Docker images). In our case these tags are available from oci_push target (along with repository file). So we can try to use them in chart files replacements.

Besides that a lot of existing charts have separated settings for image repository and image tag.

image:
   repository: docker.io/busybox
   tag: v1.2.3

So it would be useful to add separate replacements for these parameters so that people don't need to change structure of theirs charts in order to make them correctly packaged by rules_helm. Moreover, there are charts exist that use image.tag as a value for labels and annotations.

The proposed solution works as follows:

  • if there is remote tags file in oci_push target, these information is included into ImageInfo
  • in a replacement group corresponding to oci_push target added next replacements:
    • [@@]@<target name>.digest
    • [@@]@<target name>.repository
    • [@@]@<target name>.tag
  • besides that in case of single oci_push target "well-known" substitution added
    • bazel.image.url
    • bazel.image.repository
    • bazel.image.digest
    • bazel.image.tag

So that it's up to a user what substitution to use.

Please, have a look at PR and thanks in advance!

dormidon avatar Oct 02 '24 09:10 dormidon