Skip to content

Commit

Permalink
add package helm chart scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Poor12 <[email protected]>
  • Loading branch information
Poor12 committed May 28, 2022
1 parent 58bc776 commit fafaa77
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ update:
verify:
hack/verify-all.sh

.PHONY: release-chart
release-chart:
hack/release-helm-chart.sh $(VERSION)

.PHONY: test
test:
go test --race --v ./pkg/...
Expand Down
28 changes: 28 additions & 0 deletions hack/release-helm-chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${REPO_ROOT}"/hack/util.sh

version=$1

release_dir="${REPO_ROOT}/_output/release"
tar_file="karmada-chart-${version}.tgz"
mkdir -p "${release_dir}"

# install helm
echo -n "Preparing: 'helm' existence check - "
if util::cmd_exist helm; then
echo "passed"
else
echo "installing helm"
util::install_helm
fi

echo "Starting to package into a Karmada chart archive"
helm package ./charts --version "${version}" -d "${release_dir}"
cd "${release_dir}"
mv "karmada-${version}.tgz" ${tar_file}
sha256sum "${tar_file}" > "${tar_file}.sha256"
5 changes: 5 additions & 0 deletions hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ function util::install_kubectl {
fi
}

# util::install_helm will install the helm command
function util::install_helm {
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
}

# util::create_signing_certkey creates a CA, args are sudo, dest-dir, ca-id, purpose
function util::create_signing_certkey {
local sudo=$1
Expand Down

0 comments on commit fafaa77

Please sign in to comment.