Skip to content

Commit

Permalink
try helm diff with less clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Jan 16, 2021
1 parent 52877eb commit 2cf91ac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/test-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
run: |
. ./ci/common
UPGRADE_FROM_VERSION=$(curl -sS https://jupyterhub.github.io/helm-chart/info.json | jq -er '.jupyterhub.${{ matrix.upgrade-from }}')
echo "UPGRADE_FROM_VERSION=$UPGRADE_FROM_VERSION" >> $GITHUB_ENV
echo ""
echo "Installing already released jupyterhub version $UPGRADE_FROM_VERSION"
Expand All @@ -157,14 +158,26 @@ jobs:
echo "Installing Helm diff plugin while k8s resources are initializing"
helm plugin install https://github.com/databus23/helm-diff
# ref: https://github.com/jacobtomlinson/gha-read-helm-chart
- name: Load local Chart.yaml
id: chart
uses: jacobtomlinson/[email protected]
with:
path: jupyterhub

- name: "Helm diff ${{ matrix.upgrade-from }} chart with current chart"
if: matrix.test == 'upgrade'
run: |
# FIXME: consider if there is a way we can avoid being cluttered with
# changes to the "chart" label defined in _helpers.tpl
# "jupyterhub.commonLabels" named template.
export STRING_REPLACER_A=${{ steps.chart.outputs.version }}
export STRING_REPLACER_B=$UPGRADE_FROM_VERSION
echo "NOTE: For the helm diff only, we have replaced the new chart"
echo " version with the old chart version to reduce clutter."
echo
helm diff upgrade --install jupyterhub ./jupyterhub --values dev-config.yaml \
--context 3
--context=3 \
--post-renderer=ci/string-replacer.sh
- name: "Await ${{ matrix.upgrade-from }} chart"
if: matrix.test == 'upgrade'
Expand Down
12 changes: 12 additions & 0 deletions ci/string-replacer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#
# In .github/workflows/test-chart.yaml, we test upgrading one chart version to
# another. After having installed the first version we run "helm diff" with the
# new version.
#
# This script created to be referenced by helm's --post-renderer flag to replace
# strings in the rendered templates into something that doesn't change.
#

set -eu
sed -e "s|$STRING_REPLACER_A|$STRING_REPLACER_B|" < /dev/stdin

0 comments on commit 2cf91ac

Please sign in to comment.