deploy/ci/tasks/dev-releases/create-chart.yml
---
platform: linux
inputs:
- name: stratos
- name: image-tag
- name: helm-repo
outputs:
- name: helm-chart
image_resource:
type: docker-image
source:
# Generated using scripts/Dockerfile.stratos-ci
repository: ghcr.io/cf-stratos/stratos-ci-concourse
run:
path: sh
args:
- -exc
- |
# Initialize Helm for client-side use
helm init --client-only
ROOT_DIR=$PWD
STRATOS=${ROOT_DIR}/stratos
source "${STRATOS}/deploy/ci/tasks/dev-releases/vars-helper.sh"
source ${STRATOS}/deploy/ci/tasks/dev-releases/create-chart-helper.sh
HELM_REPO=${ROOT_DIR}/helm-repo/${HELM_REPO_PATH}
GIT_TAG=${LATEST_TAG}
RELEASE_VERSION=${RELEASE_TAG}
COMMIT=${COMMIT_HASH}
# Required for setupAndPushChange commit message
IMAGE_TAG=${GIT_TAG}
cd ${STRATOS}/deploy/kubernetes/
patchHelmChart ${GIT_TAG} ${DOCKER_ORG} ${DOCKER_REGISTRY} ./console ${RELEASE_VERSION} ${VERSION}
patchHelmChartAppVersion ./console ${STRATOS}
# Generate Helm package
updateHelmDependency
# Run customization script if there is one
if [ -f "${STRATOS}/deploy/kubernetes/custom/customize-helm.sh" ]; then
echo "Applying Helm Chart customizations"
${STRATOS}/deploy/kubernetes/custom/customize-helm.sh "${STRATOS}/deploy/kubernetes/console"
fi
# Generate imagelist
./imagelist-gen.sh ${STRATOS}/deploy/kubernetes/console
# Package console Helm Chart
helm package console
cp console*.tgz ${ROOT_DIR}/helm-chart/console-helm-chart-${RELEASE_VERSION}-${COMMIT}.tgz
cd ${ROOT_DIR}/helm-chart/
if [ -f ${HELM_REPO}/index.yaml ]; then
cp ${HELM_REPO}/index.yaml ${ROOT_DIR}/helm-chart/
MERGE_INDEX="--merge index.yaml"
fi
# Update Helm Repository
helm repo index ./ ${MERGE_INDEX} --url https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${RELEASE_VERSION}/
cp index.yaml ${HELM_REPO}
cd ${HELM_REPO}
setupAndPushChange