From 54d850a36b9c1ddec05f2279674fc21d9251bde1 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 12 Jul 2022 10:17:41 +0200 Subject: [PATCH] Add test for chart values Quick check for values in the built chart so we dont break it again, especially on release Signed-off-by: Itxaka --- .github/workflows/chart.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/chart.yaml b/.github/workflows/chart.yaml index a9fcf3d19..b184eeefe 100644 --- a/.github/workflows/chart.yaml +++ b/.github/workflows/chart.yaml @@ -14,6 +14,8 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Install yq + uses: mikefarah/yq@v4.25.3 - name: Build chart for CI if: ${{ !startsWith(github.ref, 'refs/tags/') }} run: | @@ -34,6 +36,36 @@ jobs: uses: azure/setup-helm@v1 with: version: v3.7.1 + - name: Set chart output + id: chart + run: | + CHART=$(find . -type f -name "elemental-operator*.tgz" -print) + echo "::set-output name=chart_name::$CHART" + - name: Test chart values + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: | + REPO=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.repository) + TAG=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.tag) + if [ "$REPO" != "quay.io/costoolkit/elemental-operator-ci" ];then + echo "REPO on the built chart is not the expected value" + echo "Expected quay.io/costoolkit/elemental-operator but got $REPO" + exit 1 + fi + - name: Test release chart values + if: startsWith(github.ref, 'refs/tags/') + run: | + REPO=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.repository) + TAG=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.tag) + if [ "$REPO" != "quay.io/costoolkit/elemental-operator" ];then + echo "REPO on the built chart is not the expected value" + echo "Expected quay.io/costoolkit/elemental-operator but got $REPO" + exit 1 + fi + if [ "$TAG" != "${GITHUB_REF##*/}" ];then + echo "TAG on the built chart is not the expected value" + echo "Expected ${GITHUB_REF##*/} but got $TAG" + exit 1 + fi - name: Build and push index if: startsWith(github.ref, 'refs/tags/') run: |