Merge pull request #1905 from Poor12/add-script

Add package helm chart scripts
This commit is contained in:
karmada-bot 2022-05-28 19:07:46 +08:00 committed by GitHub
commit cc74a42322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View File

@ -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/...

28
hack/release-helm-chart.sh Executable file
View File

@ -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"

View File

@ -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