-
Notifications
You must be signed in to change notification settings - Fork 22
/
release.sh
executable file
·61 lines (50 loc) · 1.88 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
set -e
function print_usage_and_exit() {
echo "Failure: $1"
echo "Usage: $0 <HELM_CHART_NAME>"
echo "Example: $0 wavefront"
exit 1
}
CHART_NAME=$1
if [[ -z $CHART_NAME ]] ; then
print_usage_and_exit "Chart name is required"
fi
echo "Chart name: $CHART_NAME"
if [[ ! -d "./${CHART_NAME}" ]] ; then
echo "Failure: helm release folder not found"
exit 1
fi
echo "Helm release folder: ./${CHART_NAME}"
helm_path=$(which helm || echo "")
if [[ -z $helm_path ]] ; then
echo "Failure: helm not found"
exit 1
fi
# update helm dependencies
echo "Updating charts/ based on the contents of Chart.yaml"
pushd $CHART_NAME >/dev/null
helm dependency update
popd >/dev/null
# initialize build variables
BUILD_DIR="./_build"
INDEX_FILE=${BUILD_DIR}/index.yaml
rm -rf ${BUILD_DIR}
echo "Using build directory: ${BUILD_DIR}"
mkdir ${BUILD_DIR}
# create new tgz
echo "Creating new \"${CHART_NAME}\" helm package"
if ! helm package -d ${BUILD_DIR} "./${CHART_NAME}"; then
echo "Failure: error creating helm package"
exit 1
fi
# download current index.yaml
echo "Downloading latest index.yaml to: ${INDEX_FILE}"
curl -sSL https://raw.githubusercontent.com/wavefrontHQ/helm/gh-pages/index.yaml > ${INDEX_FILE}
echo "Generating updated index.yaml"
helm repo index --merge "${INDEX_FILE}" ${BUILD_DIR}
echo "Complete. New index and package files can be found under: ${BUILD_DIR}"
echo "Next Human Steps :: Run 'git checkout gh-pages && cp ${BUILD_DIR}/* . && git add .' and commit to update the helm chart"
echo "Next Human Steps :: Run 'git checkout -b gh-pages-${CHART_NAME}-<NEW_VERSION_NUMBER>' to create a new branch"
echo "Next Human Steps :: Run 'git commit -m \"Release ${CHART_NAME} chart version <NEW_CHART_VERSION>\"' to commit and update the helm chart"
echo "Next Human Steps :: Push your changes to GitHub and create a PR against the 'gh-pages' branch"