From 4b788e7330534ec32ea85d95b6781efaa78d4402 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Thu, 14 Jul 2022 17:50:26 -0700 Subject: [PATCH] Add some artifacthub.io annotations to Helm charts (#4003) See https://artifacthub.io/docs/topics/annotations/helm/ We may add support for more annotations in the future, but this seems like a good place to start (all annotations are optional). For #3979 Signed-off-by: Antonin Bas --- .github/workflows/golicense.yml | 3 +-- .github/workflows/process_release.yml | 4 ++-- build/charts/antrea/Chart.yaml | 4 ++++ build/charts/flow-aggregator/Chart.yaml | 4 ++++ hack/generate-helm-release.sh | 9 +++++++++ hack/release/prepare-assets.sh | 9 +++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golicense.yml b/.github/workflows/golicense.yml index 2d8ab81ff09..114c9df64b0 100644 --- a/.github/workflows/golicense.yml +++ b/.github/workflows/golicense.yml @@ -11,8 +11,7 @@ on: - release-* - feature/* release: - types: - - created + types: [published] jobs: check-changes: diff --git a/.github/workflows/process_release.yml b/.github/workflows/process_release.yml index 3a218fba0f0..47f95d5e631 100644 --- a/.github/workflows/process_release.yml +++ b/.github/workflows/process_release.yml @@ -2,8 +2,7 @@ name: Process new release on: release: - types: - - created + types: [published] jobs: upload-release-assets: @@ -17,6 +16,7 @@ jobs: - name: Build assets env: TAG: ${{ github.ref }} + PRERELEASE: ${{ github.event.release.prerelease }} run: | mkdir assets VERSION="${TAG:10}" ./hack/release/prepare-assets.sh ./assets diff --git a/build/charts/antrea/Chart.yaml b/build/charts/antrea/Chart.yaml index 6ef1129b4e4..e97123aa7a2 100644 --- a/build/charts/antrea/Chart.yaml +++ b/build/charts/antrea/Chart.yaml @@ -18,3 +18,7 @@ keywords: - OVS sources: - https://github.com/antrea-io/antrea +annotations: + artifacthub.io/license: Apache-2.0 + artifacthub.io/operator: "false" + artifacthub.io/prerelease: "false" diff --git a/build/charts/flow-aggregator/Chart.yaml b/build/charts/flow-aggregator/Chart.yaml index 66d5d7ad019..1584635e21c 100644 --- a/build/charts/flow-aggregator/Chart.yaml +++ b/build/charts/flow-aggregator/Chart.yaml @@ -22,3 +22,7 @@ keywords: - Flow Aggregator sources: - https://github.com/antrea-io/antrea +annotations: + artifacthub.io/license: Apache-2.0 + artifacthub.io/operator: "false" + artifacthub.io/prerelease: "false" diff --git a/hack/generate-helm-release.sh b/hack/generate-helm-release.sh index 9eae0780080..10a632564e1 100755 --- a/hack/generate-helm-release.sh +++ b/hack/generate-helm-release.sh @@ -89,9 +89,18 @@ elif ! $HELM version > /dev/null 2>&1; then fi ANTREA_CHART="$THIS_DIR/../build/charts/antrea" +# create a backup file before making changes. +# note that the backup file will not be included in the release: .bak files are +# ignored as per the .helmignore file. +cp "$ANTREA_CHART/Chart.yaml" "$ANTREA_CHART/Chart.yaml.bak" +yq -i '.annotations."artifacthub.io/prerelease" = strenv(PRERELEASE)' "$ANTREA_CHART/Chart.yaml" $HELM package --app-version $VERSION --version $VERSION $ANTREA_CHART mv "antrea-$VERSION.tgz" "$OUT/antrea-chart.tgz" +mv "$ANTREA_CHART/Chart.yaml.bak" "$ANTREA_CHART/Chart.yaml" FLOW_AGGREGATOR_CHART="$THIS_DIR/../build/charts/flow-aggregator" +cp "$FLOW_AGGREGATOR_CHART/Chart.yaml" "$FLOW_AGGREGATOR_CHART/Chart.yaml.bak" +yq -i '.annotations."artifacthub.io/prerelease" = strenv(PRERELEASE)' "$FLOW_AGGREGATOR_CHART/Chart.yaml" $HELM package --app-version $VERSION --version $VERSION $FLOW_AGGREGATOR_CHART mv "flow-aggregator-$VERSION.tgz" "$OUT/flow-aggregator-chart.tgz" +mv "$FLOW_AGGREGATOR_CHART/Chart.yaml.bak" "$FLOW_AGGREGATOR_CHART/Chart.yaml" diff --git a/hack/release/prepare-assets.sh b/hack/release/prepare-assets.sh index c18c1710b3b..9ccdf75f335 100755 --- a/hack/release/prepare-assets.sh +++ b/hack/release/prepare-assets.sh @@ -17,6 +17,9 @@ # This script generates all the assets required for an Antrea Github release to # the provided directory. # Usage: VERSION=v1.0.0 ./prepare-assets.sh +# In addition to the VERSION environment variable (which is required), the +# PRERELEASE environment variable can also be set to true or false (it will +# default to false). set -eo pipefail @@ -33,6 +36,12 @@ if [ -z "$1" ]; then echoerr "Argument required: output directory for assets" fi +: "${PRERELEASE:=false}" +if [ "$PRERELEASE" != "true" ] && [ "$PRERELEASE" != "false" ]; then + echoerr "Environment variable PRERELEASE should only be set to 'true' or 'false'" +fi +export PRERELEASE + THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" pushd $THIS_DIR/../.. > /dev/null