Skip to content

Commit 4e4dc71

Browse files
authored
ci(backstage): skip plugin downloads in PR checks and use chart defaults (#480)
1 parent 0f7aed6 commit 4e4dc71

16 files changed

Lines changed: 122 additions & 20 deletions

.github/actions/test-charts/action.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ inputs:
1717
description: 'Specific chart to test (e.g., charts/backstage). When set, only this chart is tested.'
1818
required: false
1919
default: ''
20+
helm_extra_args:
21+
description: 'Extra arguments to pass to helm via ct install --helm-extra-args (e.g., --values file.yaml)'
22+
required: false
23+
default: ''
24+
helm_template_values_file:
25+
description: 'Extra values file for a helm-template sanity check (renders each CI scenario with these values layered on top, but does not install)'
26+
required: false
27+
default: ''
2028
monitoring_heartbeat:
2129
description: 'Enable background cluster monitoring (pod status + events every 30s) during chart tests'
2230
required: false
@@ -85,6 +93,22 @@ runs:
8593
helm repo add bitnami https://charts.bitnami.com/bitnami
8694
helm repo update
8795
96+
- name: Helm template sanity check (full-plugins override)
97+
if: steps.list-changed.outputs.changed == 'true' && inputs.helm_template_values_file != ''
98+
shell: bash
99+
env:
100+
INPUT_CHART: ${{ inputs.chart }}
101+
VALUES_FILE: ${{ inputs.helm_template_values_file }}
102+
run: |
103+
helm dependency build "$INPUT_CHART"
104+
for ci_values in "$INPUT_CHART"/ci/*-values.yaml; do
105+
[[ -f "$ci_values" ]] || continue
106+
echo "==> helm template: $(basename "$ci_values") + $(basename "$VALUES_FILE")"
107+
output=$(helm template test-release "$INPUT_CHART" \
108+
--values "$ci_values" \
109+
--values "$VALUES_FILE" 2>&1) || { echo "$output"; exit 1; }
110+
done
111+
88112
- name: Generate KinD Config
89113
if: steps.list-changed.outputs.changed == 'true'
90114
shell: bash
@@ -148,7 +172,7 @@ runs:
148172
env:
149173
OLM_VERSION: "v0.31.0"
150174
run: |
151-
curl -L "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh" -o install-olm.sh
175+
curl --proto =https -L "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh" -o install-olm.sh
152176
chmod +x install-olm.sh
153177
./install-olm.sh "${OLM_VERSION}"
154178
@@ -174,6 +198,7 @@ runs:
174198
env:
175199
INPUT_CHART: ${{ inputs.chart }}
176200
INPUT_EXTRA_HELM_ARGS: ${{ inputs.extra_helm_args }}
201+
INPUT_HELM_EXTRA_ARGS: ${{ inputs.helm_extra_args }}
177202
INPUT_TARGET_BRANCH: ${{ inputs.target_branch }}
178203
INPUT_ALL_CHARTS: ${{ inputs.all_charts }}
179204
INPUT_MONITORING_HEARTBEAT: ${{ inputs.monitoring_heartbeat }}
@@ -207,12 +232,31 @@ runs:
207232
EXTRA_ARGS+=("${ADDITIONAL_ARGS[@]}")
208233
fi
209234
CT_ARGS=(
210-
--debug
211235
--config ct-install.yaml
212-
--upgrade
213236
--target-branch "$INPUT_TARGET_BRANCH"
214237
--helm-extra-set-args="${EXTRA_ARGS[*]}"
215238
)
239+
if [[ -n "$INPUT_CHART" ]]; then
240+
old_version=$(git show "origin/$INPUT_TARGET_BRANCH:$INPUT_CHART/Chart.yaml" 2>/dev/null | yq '.version' 2>/dev/null || echo "0.0.0")
241+
new_version=$(yq '.version' "$INPUT_CHART/Chart.yaml")
242+
old_major=${old_version%%.*}
243+
new_major=${new_version%%.*}
244+
if [[ "$old_version" == "$new_version" ]]; then
245+
echo "Skipping --upgrade: chart version unchanged ($old_version)"
246+
elif [[ "$old_major" != "$new_major" ]]; then
247+
echo "Skipping --upgrade: major version bump detected ($old_version -> $new_version)"
248+
else
249+
CT_ARGS+=(--upgrade)
250+
fi
251+
else
252+
CT_ARGS+=(--upgrade)
253+
fi
254+
if [[ "$RUNNER_DEBUG" == "1" ]]; then
255+
CT_ARGS+=(--debug)
256+
fi
257+
if [[ -n "$INPUT_HELM_EXTRA_ARGS" ]]; then
258+
CT_ARGS+=(--helm-extra-args="$INPUT_HELM_EXTRA_ARGS")
259+
fi
216260
if [[ -n "$INPUT_CHART" ]]; then
217261
CT_ARGS+=(--charts "$INPUT_CHART")
218262
elif [[ "$INPUT_ALL_CHARTS" == "true" ]]; then

.github/workflows/nightly.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ jobs:
108108
fi
109109
done
110110
111+
- name: Generate nightly values override for backstage chart
112+
if: steps.check.outputs.exists == 'true' && matrix.chart == 'backstage'
113+
run: |
114+
yq e '{"global": {"dynamic": {"includes": .global.dynamic.includes}, "lightspeed": {"plugins": .global.lightspeed.plugins}}, "orchestrator": {"plugins": .orchestrator.plugins}}' \
115+
charts/backstage/values.yaml > /tmp/backstage-nightly-values.yaml
116+
111117
- name: Test charts
112118
if: steps.check.outputs.exists == 'true'
113119
uses: ./.github/actions/test-charts
@@ -117,3 +123,4 @@ jobs:
117123
all_charts: 'true'
118124
monitoring_heartbeat: ${{ vars.TEST_MONITORING_HEARTBEAT_ENABLED || 'false' }}
119125
extra_helm_args: ${{ matrix.chart == 'backstage' && format('--set upstream.backstage.image.repository={0} --set upstream.backstage.image.tag={1} --set upstream.backstage.image.pullPolicy=Always', steps.image.outputs.repo, steps.image.outputs.tag) || '' }}
126+
helm_extra_args: ${{ matrix.chart == 'backstage' && '--values /tmp/backstage-nightly-values.yaml' || '' }}

.github/workflows/test.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,25 @@ jobs:
6969
fail-fast: false
7070
matrix:
7171
chart: ${{ fromJson(needs.discover-charts.outputs.charts) }}
72-
env:
73-
RHDH_IMAGE_REPOSITORY: ${{ vars.RHDH_IMAGE_REPOSITORY || 'rhdh/rhdh-hub-rhel9' }}
74-
RHDH_IMAGE_TAG: ${{ vars.RHDH_IMAGE_TAG || 'latest' }}
75-
7672
steps:
7773
- name: Checkout
7874
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
7975
with:
8076
fetch-depth: 0
8177

78+
- name: Generate full-plugins values for template sanity check
79+
if: matrix.chart == 'backstage'
80+
run: |
81+
yq e '{"global": {"dynamic": {"includes": .global.dynamic.includes}, "lightspeed": {"plugins": .global.lightspeed.plugins}}, "orchestrator": {"plugins": .orchestrator.plugins}}' \
82+
charts/backstage/values.yaml > /tmp/backstage-full-plugins-values.yaml
83+
8284
- name: Test charts
8385
uses: ./.github/actions/test-charts
8486
with:
8587
target_branch: ${{ github.event.pull_request.base.ref }}
8688
chart: charts/${{ matrix.chart }}
8789
monitoring_heartbeat: ${{ vars.TEST_MONITORING_HEARTBEAT_ENABLED || 'false' }}
88-
# The RHDH image tag is already pinned to a specific version for the 'release-1.y' branches.
89-
extra_helm_args: ${{ matrix.chart == 'backstage' && github.event.pull_request.base.ref == 'main' && format('--set upstream.backstage.image.repository={0} --set upstream.backstage.image.tag={1}', env.RHDH_IMAGE_REPOSITORY, env.RHDH_IMAGE_TAG) || '' }}
90+
helm_template_values_file: ${{ matrix.chart == 'backstage' && '/tmp/backstage-full-plugins-values.yaml' || '' }}
9091

9192
# Aligning job name with the OpenShift CI config: https://github.com/openshift/release/blob/master/core-services/prow/02_config/redhat-developer/rhdh-chart/_prowconfig.yaml#L18
9293
status:

charts/backstage/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ sources: []
4747
# Versions are expected to follow Semantic Versioning (https://semver.org/)
4848
# Note that when this chart is published to https://github.com/openshift-helm-charts/charts
4949
# it will follow the RHDH versioning 1.y.z
50-
version: 6.2.2
50+
version: 7.0.0

charts/backstage/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# RHDH Backstage Helm Chart for OpenShift
33

4-
![Version: 6.2.2](https://img.shields.io/badge/Version-6.2.2-informational?style=flat-square)
4+
![Version: 7.0.0](https://img.shields.io/badge/Version-7.0.0-informational?style=flat-square)
55
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
66

77
A Helm chart for deploying Red Hat Developer Hub, which is a Red Hat supported version of Backstage.
@@ -29,7 +29,7 @@ For the **Generally Available** version of this chart, see:
2929
helm repo add bitnami https://charts.bitnami.com/bitnami
3030
helm repo add redhat-developer https://redhat-developer.github.io/rhdh-chart
3131

32-
helm install my-backstage redhat-developer/backstage --version 6.2.2
32+
helm install my-backstage redhat-developer/backstage --version 7.0.0
3333
```
3434

3535
## Introduction
@@ -168,7 +168,7 @@ Kubernetes: `>= 1.27.0-0`
168168
| global.auth.backend.enabled | Enable backend service to service authentication, unless configured otherwise it generates a secret value | bool | `true` |
169169
| global.auth.backend.existingSecret | Instead of generating a secret value, refer to existing secret | string | `""` |
170170
| global.auth.backend.value | Instead of generating a secret value, use the following value | string | `""` |
171-
| global.catalogIndex | Catalog index configuration for automatic plugin discovery. The `install-dynamic-plugins.py` script pulls this image if the `CATALOG_INDEX_IMAGE` environment variable is set. The `dynamic-plugins.default.yaml` file will be extracted and written to `dynamic-plugins-root` volume mount. | object | `{"extraImages":[],"image":{"registry":"quay.io","repository":"rhdh/plugin-catalog-index","tag":"1.10"}}` |
171+
| global.catalogIndex | Catalog index configuration for automatic plugin discovery. The `install-dynamic-plugins.py` script pulls this image if the `CATALOG_INDEX_IMAGE` environment variable is set. The `dynamic-plugins.default.yaml` file will be extracted and written to `dynamic-plugins-root` volume mount. | object | `{"extraImages":[],"image":{"registry":"quay.io","repository":"rhdh/plugin-catalog-index","tag":"next"}}` |
172172
| global.catalogIndex.extraImages | Extra catalog index images for additional plugin discovery in the Extensions UI. Each item must include `registry`, `repository`, and `tag` fields; `name` is optional. Only catalog entities are extracted from extra images (no `dynamic-plugins.default.yaml` handling). | list | `[]` |
173173
| global.clusterRouterBase | Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled. | string | `"apps.example.com"` |
174174
| global.dynamic.includes | Array of YAML files listing dynamic plugins to include with those listed in the `plugins` field. Relative paths are resolved from the working directory of the initContainer that will install the plugins (`/opt/app-root/src`). | list | `["dynamic-plugins.default.yaml"]` |

charts/backstage/ci/default-values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
route:
33
enabled: false
44

5+
# CI: skip dynamic plugin downloads to speed up tests.
6+
# The chart features under test (deployment, config, probes, etc.) don't depend on actual plugins.
7+
global:
8+
dynamic:
9+
includes: []
10+
lightspeed:
11+
plugins: []
12+
513
upstream:
614
postgresql:
715
primary:

charts/backstage/ci/with-custom-dynamic-pvc-claim-spec-values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
route:
33
enabled: false
44

5+
# CI: skip dynamic plugin downloads to speed up tests.
6+
global:
7+
dynamic:
8+
includes: []
9+
lightspeed:
10+
plugins: []
11+
512
upstream:
613
postgresql:
714
primary:

charts/backstage/ci/with-custom-image-for-test-pod-values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Workaround for kind cluster in CI which has no Routes and no PVCs
22
route:
33
enabled: false
4+
5+
# CI: skip dynamic plugin downloads to speed up tests.
6+
global:
7+
dynamic:
8+
includes: []
9+
lightspeed:
10+
plugins: []
11+
412
upstream:
513
postgresql:
614
primary:

charts/backstage/ci/with-lightspeed-disabled-values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ route:
33
enabled: false
44

55
global:
6+
# CI: skip dynamic plugin downloads to speed up tests.
7+
dynamic:
8+
includes: []
69
lightspeed:
710
enabled: false
11+
plugins: []
812

913
upstream:
1014
postgresql:

charts/backstage/ci/with-lightspeed-service-host.yaml renamed to charts/backstage/ci/with-lightspeed-service-host-values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ route:
33
enabled: false
44

55
global:
6+
# CI: skip dynamic plugin downloads to speed up tests.
7+
dynamic:
8+
includes: []
9+
# FIXME(RHIDP-15458): remove plugins override once next catalog index is stable with correct lightspeed refs in the DPDY
610
lightspeed:
11+
plugins: []
712
sidecar:
813
env:
914
- name: SERVICE_HOST

0 commit comments

Comments
 (0)