Skip to content

Commit 133ff88

Browse files
fix: use values.yaml for previous version during minor version upgrade
1 parent 61414c9 commit 133ff88

File tree

7 files changed

+42
-11
lines changed

7 files changed

+42
-11
lines changed

.github/workflows/test-chart-version-template.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
description: Pull Request number. Required due to a github bug that is not giving the concurrency group the pull_request number from the github event
1717
required: true
1818
type: string
19+
previous-helm-dir:
20+
description: base directory of the previous helm version to upgrade from for references to test values.yamls
21+
required: false
22+
type: string
1923

2024
concurrency:
2125
group: ${{ github.workflow }}-${{ inputs.pr_number }}-${{ inputs.chart-version }}
@@ -79,5 +83,6 @@ jobs:
7983
camunda-helm-dir: "camunda-platform-${{ inputs.chart-version }}"
8084
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
8185
camunda-helm-upgrade-version: "${{ inputs.previous-helm-version }}"
86+
camunda-upgrade-helm-dir: "${{ inputs.previous-helm-dir }}"
8287
caller-git-ref: "${{ github.event.pull_request.head.sha }}"
8388

.github/workflows/test-chart-version.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ jobs:
5050
chart-version: "${{ matrix.version }}"
5151
previous-helm-version: "${{ matrix.previousHelmVersion }}"
5252
pr_number: "${{ github.event.pull_request.number }}" # Required as there is a github bug that prevent the concurrency group on the sub workflow getting the pull_request number from the github event
53+
previous-helm-dir: "${{ matrix.previousHelmDir }}"

.github/workflows/test-integration-template.yaml

+16-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ on:
1717
required: false
1818
default: camunda-platform-8.8
1919
type: string
20+
# directory to get values.yaml from during minor upgrade flow
21+
camunda-upgrade-helm-dir:
22+
required: false
23+
description: During upgrade, the path towards the chart base dir that contains values.yamls
24+
default: ""
25+
type: string
2026
camunda-helm-git-ref:
2127
required: false
2228
default: main
@@ -240,12 +246,14 @@ jobs:
240246
id: test-type-vars
241247
uses: ./.github/actions/test-type-vars
242248
with:
243-
chart-dir: "${{ inputs.camunda-helm-dir }}"
249+
chart-dir: "${{ inputs.camunda-upgrade-helm-dir || inputs.camunda-helm-dir }}"
244250
- name: Add Helm repos and dependencies
245251
run: |
246-
export chartPath="charts/${{ inputs.camunda-helm-dir }}"
252+
export chartPath="charts/$CHART_PATH"
247253
make helm.repos-add
248254
make helm.dependency-update
255+
env:
256+
CHART_PATH: ${{ inputs.camunda-upgrade-helm-dir || inputs.camunda-helm-dir }}
249257
- name: Create test namespace
250258
run: |
251259
echo $TEST_NAMESPACE
@@ -332,14 +340,19 @@ jobs:
332340
if: matrix.scenario.flow == 'upgrade'
333341
run: |
334342
task -d ${CI_TASKS_BASE_DIR}/chart-full-setup upgrade.pre
343+
- name: Set test type vars
344+
id: test-type-vars-2
345+
uses: ./.github/actions/test-type-vars
346+
with:
347+
chart-dir: "${{ inputs.camunda-helm-dir }}"
335348
- name: 🌟 Upgrade Camunda chart 🌟
336349
if: matrix.scenario.flow == 'upgrade'
337350
env:
338351
TEST_OPENSHIFT_POST_RENDER: ${{ inputs.camunda-helm-post-render }}
339352
TEST_HELM_EXTRA_ARGS: >-
340353
${{ env.TEST_HELM_EXTRA_ARGS_UPGRADE }}
341354
--set global.ingress.host=${{ steps.vars.outputs.ingress-host }}
342-
--values ${{ steps.test-type-vars.outputs.valuesBaseDir }}/infra/values-infra-${{ inputs.infra-type }}.yaml
355+
--values ${{ steps.test-type-vars-2.outputs.valuesBaseDir }}/infra/values-infra-${{ inputs.infra-type }}.yaml
343356
--values /tmp/extra-values-file.yaml
344357
run: |
345358
task -d ${CI_TASKS_BASE_DIR}/chart-full-setup upgrade.exec

scripts/generate-gha-matrix/process.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ func processInputs(input Input) ([]Output, error) {
1313
}
1414

1515
version := getCamundaVersion(chart)
16-
previousVersionMajor, err := getPreviousHelmChartVersion(chart, version)
16+
previousVersion, err := getPreviousHelmChartVersion(chart, version)
1717
if err != nil {
1818
return nil, ProcessErrorf("failed to get previous helm chart metadata for version %s : %s", version, err)
1919
}
2020

2121
matrixRunVector := Output{
2222
CamundaVersion: version,
2323
HelmChartVersion: chart.Metadata.Version,
24-
PreviousHelmChartVersion: previousVersionMajor,
24+
PreviousHelmChartVersion: previousVersion.Version,
25+
PreviousHelmChartDir: previousVersion.Dir,
2526
}
2627

2728
output = append(output, matrixRunVector)

scripts/generate-gha-matrix/types.go

+6
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ type Output struct {
88
CamundaVersion string `json:"version"`
99
HelmChartVersion string `json:"chartVersion"`
1010
PreviousHelmChartVersion string `json:"previousHelmVersion"`
11+
PreviousHelmChartDir string `json:"previousHelmDir"`
12+
}
13+
14+
type ChartVersion struct {
15+
Version string
16+
Dir string
1117
}

scripts/generate-gha-matrix/versions.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@ func getCamundaVersion(chart *chart.Chart) string {
2020
return camundaVersionParsed
2121
}
2222

23-
func getPreviousHelmChartVersion(chart *chart.Chart, version string) (string, error) {
23+
func getPreviousHelmChartVersion(chart *chart.Chart, version string) (*ChartVersion, error) {
2424
camundaVersionFloat, err := strconv.ParseFloat(version, 64)
2525
if err != nil {
26-
return "", VersionParsingErrorf("failed to parse version from input: %s", err)
26+
return nil, VersionParsingErrorf("failed to parse version from input: %s", err)
2727
}
2828
previousVersionFloat := (camundaVersionFloat*10 - 1) / 10
2929
previousCamundaVersion := strconv.FormatFloat(previousVersionFloat, 'f', -1, 64)
30-
previousChart, err := loader.Load("../../charts/camunda-platform-" + previousCamundaVersion)
30+
previousChartDir := "camunda-platform-" + previousCamundaVersion
31+
previousChart, err := loader.Load("../../charts/" + previousChartDir)
3132
if err != nil {
32-
return "", VersionParsingErrorf("failed to load the previous chart: %s", err)
33+
return nil, VersionParsingErrorf("failed to load the previous chart: %s", err)
3334
}
3435
previousChartVersionSemver := "v" + previousChart.Metadata.Version
3536
previousVersionMajor := semver.Major(previousChartVersionSemver)
3637
previousVersionMajor = strings.TrimPrefix(previousVersionMajor, "v")
37-
return previousVersionMajor, nil
38+
return &ChartVersion{
39+
Version: previousVersionMajor,
40+
Dir: previousChartDir,
41+
}, nil
3842
}

scripts/generate-gha-matrix/versions_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func TestGetPreviousChart(t *testing.T) {
3636
version := getCamundaVersion(chart)
3737
previousVersion, err := getPreviousHelmChartVersion(chart, version)
3838
require.NoError(t, err)
39-
require.Equal(t, "12", previousVersion)
39+
require.Equal(t, "12", previousVersion.Version)
40+
require.Equal(t, "camunda-platform-8.7", previousVersion.Dir)
4041
}
4142

4243
func TestGetPreviousChartInvalidVersion(t *testing.T) {

0 commit comments

Comments
 (0)