From 490fe8f543c0663406e6c5cbea7b7370bc938fcc Mon Sep 17 00:00:00 2001 From: Kevin Fox Date: Thu, 9 Mar 2023 14:39:14 -0800 Subject: [PATCH] Enhance the test workflow scripts This makes it so that tests can now: 1. Add additional values files to the test 2. That the post-install.sh script knows if the test passed or failed for better output 3. That the main test can be skipped in favor of a test provided one Signed-off-by: Kevin Fox --- .github/workflows/helm-chart-ci.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/helm-chart-ci.yaml b/.github/workflows/helm-chart-ci.yaml index 52da02d..c2f2d53 100644 --- a/.github/workflows/helm-chart-ci.yaml +++ b/.github/workflows/helm-chart-ci.yaml @@ -153,17 +153,23 @@ jobs: - name: Run chart-testing (install) run: | export scenario="$(basename "${TEST_DIR}")" + export EXTRA_HELM_ARGS="" [ "${scenario}" != "default" ] && kubectl create namespace "${scenario}" post-install() { - [ -x "${TEST_DIR}/post-install.sh" ] && "${TEST_DIR}/post-install.sh" + [ -x "${TEST_DIR}/post-install.sh" ] && "${TEST_DIR}/post-install.sh" $1 exit $1 } trap 'post-install $? $LINENO' EXIT [ -x "${TEST_DIR}/pre-install.sh" ] && "${TEST_DIR}/pre-install.sh" - ct install --debug \ - --namespace "${scenario}" \ - --target-branch ${{ github.base_ref }} \ - --exclude-deprecated \ - ${{ (matrix.values != 'default' && '--helm-extra-set-args "--values=${TEST_DIR}/values.yaml"') || '' }} + [ -f "${TEST_DIR}/.env" ] && source "${TEST_DIR}/.env" + if [ -x {${TEST_DIR}/install.sh ]; then + ./${TEST_DIR}/install.sh + else + ct install --debug \ + --namespace "${scenario}" \ + --target-branch ${{ github.base_ref }} \ + --exclude-deprecated \ + ${{ (matrix.values != 'default' && '--helm-extra-set-args "--values=${TEST_DIR}/values.yaml ${EXTRA_HELM_ARGS}"') || '' }} + fi env: TEST_DIR: .github/tests/${{ matrix.values }}