41 lines
941 B
Bash
Executable File
41 lines
941 B
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# ci/scripts/build-chart
|
|
#
|
|
# Script for build Helm chart package
|
|
#
|
|
# author: Dr Nic Williams <drnicwilliams@gmail.com>
|
|
# created: 2018-11-17
|
|
|
|
set -eu
|
|
|
|
: ${CHART_ROOT:?required}
|
|
: ${REPO_ROOT:?required}
|
|
: ${CHART_OUT:?required}
|
|
|
|
header() {
|
|
echo
|
|
echo "###############################################"
|
|
echo
|
|
echo $*
|
|
echo
|
|
}
|
|
|
|
CHART_NAME=$(bosh int ${REPO_ROOT}/${CHART_ROOT}/Chart.yaml --path /name)
|
|
header "Copy chart into folder with chart name ${CHART_NAME}..."
|
|
|
|
mkdir -p build-chart/${CHART_NAME}
|
|
cp -r ${REPO_ROOT}/${CHART_ROOT}/* build-chart/${CHART_NAME}
|
|
|
|
header "Use latest docker image"
|
|
tmpfile=$(mktemp /tmp/chart-yaml.XXXX)
|
|
sed -e "s/^ tag:.*$/ tag: latest/g" build-chart/${CHART_NAME}/values.yaml > $tmpfile
|
|
cp $tmpfile build-chart/${CHART_NAME}/values.yaml
|
|
|
|
header "Updated values.yaml"
|
|
cat build-chart/${CHART_NAME}/values.yaml
|
|
|
|
header "Build helm chart"
|
|
helm package build-chart/${CHART_NAME} -d ${CHART_OUT}
|