From 1f3c3df09080d6f9e6a6fd71d74b9e2ee2afcd6c Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 27 May 2021 13:32:56 +0100 Subject: [PATCH] Add ArtifactHUB pre-release annotations to the Helm chart Signed-off-by: Richard Wall --- deploy/charts/cert-manager/BUILD.bazel | 22 +++++++++++++++++++ .../{Chart.yaml => Chart.template.yaml} | 2 ++ 2 files changed, 24 insertions(+) rename deploy/charts/cert-manager/{Chart.yaml => Chart.template.yaml} (89%) diff --git a/deploy/charts/cert-manager/BUILD.bazel b/deploy/charts/cert-manager/BUILD.bazel index be9a5dab6..c75efbf27 100644 --- a/deploy/charts/cert-manager/BUILD.bazel +++ b/deploy/charts/cert-manager/BUILD.bazel @@ -38,6 +38,28 @@ genrule( visibility = ["//visibility:public"], ) +# We don't want alpha and beta releases to show on ArtifactHUB as releases. +# To prevent pre-releases from appearing, we use the ArtifactHUB-specific: +# +# annotation: +# artifacthub.io/prerelease: "true" +# +# See https://artifacthub.io/docs/topics/annotations/helm/ +genrule( + name = "chart-yaml", + srcs = [ + "Chart.template.yaml", + "//:version", + ], + outs = ["Chart.yaml"], + cmd = """ + IS_PRERELEASE=$$(grep -q '^v[0-9]\\+.[0-9]\\+.[0-9]\\+$$' $(location //:version) && echo "false" || echo "true") + sed -e "s:{{IS_PRERELEASE}}:$${IS_PRERELEASE}:g" < $(location Chart.template.yaml) > $@ + """, + stamp = 1, + visibility = ["//visibility:public"], +) + filegroup( name = "chart-srcs", srcs = ["//deploy/charts/cert-manager/templates:chart-srcs"] + glob( diff --git a/deploy/charts/cert-manager/Chart.yaml b/deploy/charts/cert-manager/Chart.template.yaml similarity index 89% rename from deploy/charts/cert-manager/Chart.yaml rename to deploy/charts/cert-manager/Chart.template.yaml index 846ed3ecb..8bfd8accd 100644 --- a/deploy/charts/cert-manager/Chart.yaml +++ b/deploy/charts/cert-manager/Chart.template.yaml @@ -16,3 +16,5 @@ sources: maintainers: - name: cert-manager-maintainers email: cert-manager-maintainers@googlegroups.com +annotations: + artifacthub.io/prerelease: "{{IS_PRERELEASE}}"