Skip to content

Commit cc74a42

Browse files
authored
Merge pull request #1905 from Poor12/add-script
Add package helm chart scripts
2 parents ed31479 + fafaa77 commit cc74a42

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ update:
104104
verify:
105105
hack/verify-all.sh
106106

107+
.PHONY: release-chart
108+
release-chart:
109+
hack/release-helm-chart.sh $(VERSION)
110+
107111
.PHONY: test
108112
test:
109113
go test --race --v ./pkg/...

hack/release-helm-chart.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
7+
source "${REPO_ROOT}"/hack/util.sh
8+
9+
version=$1
10+
11+
release_dir="${REPO_ROOT}/_output/release"
12+
tar_file="karmada-chart-${version}.tgz"
13+
mkdir -p "${release_dir}"
14+
15+
# install helm
16+
echo -n "Preparing: 'helm' existence check - "
17+
if util::cmd_exist helm; then
18+
echo "passed"
19+
else
20+
echo "installing helm"
21+
util::install_helm
22+
fi
23+
24+
echo "Starting to package into a Karmada chart archive"
25+
helm package ./charts --version "${version}" -d "${release_dir}"
26+
cd "${release_dir}"
27+
mv "karmada-${version}.tgz" ${tar_file}
28+
sha256sum "${tar_file}" > "${tar_file}.sha256"

hack/util.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ function util::install_kubectl {
161161
fi
162162
}
163163

164+
# util::install_helm will install the helm command
165+
function util::install_helm {
166+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
167+
}
168+
164169
# util::create_signing_certkey creates a CA, args are sudo, dest-dir, ca-id, purpose
165170
function util::create_signing_certkey {
166171
local sudo=$1

0 commit comments

Comments
 (0)