From ff2d908e449a2837838e6a104ad2bc5b122d95f9 Mon Sep 17 00:00:00 2001 From: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com> Date: Mon, 10 Jun 2024 23:54:54 +0200 Subject: [PATCH] chore: get latest released chart by app version Signed-off-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com> --- .github/actions/workflow-vars/action.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/actions/workflow-vars/action.yml b/.github/actions/workflow-vars/action.yml index e8ff761743..2201373341 100644 --- a/.github/actions/workflow-vars/action.yml +++ b/.github/actions/workflow-vars/action.yml @@ -82,11 +82,24 @@ runs: # The var is needed in some non-shell steps. echo "ingress-host=${TEST_INGRESS_HOST}" | tee -a $GITHUB_OUTPUT + - name: Set workflow vars - Chart version + shell: bash + run: | # Chart version. # Used to install previous supported versions of Camunda Helm charts. # This is only needed in the upgrade flow not the setup. + + get_latest_released_chart_by_app_version() { + app_version="${1}" + helm repo add camunda https://helm.camunda.io > /dev/null + helm search repo camunda/camunda-platform --versions --output json | + jq -r --arg app_version "$app_version" \ + '[.[] | select (.app_version == $app_version)] | first | .version' + } + if [[ "${{ inputs.setup-flow }}" == 'upgrade' ]]; then - TEST_CHART_VERSION="$(yq '.version' charts/${{ inputs.chart-dir }}/Chart.yaml)" + app_version="$(yq '.appVersion' charts/${{ inputs.chart-dir }}/Chart.yaml)" + TEST_CHART_VERSION="$(get_latest_released_chart_by_app_version ${app_version})" echo "TEST_CHART_VERSION=${TEST_CHART_VERSION}" | tee -a $GITHUB_ENV fi