Skip to content

Commit 17e5883

Browse files
fix(repo): pickup the node versions for CI jobs from the workspace package.json to resolve CI failures #6806 (#6805)
* fix(repo): pickup the node versions for CI jobs from the workspace package.json Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * chore: drop EOL Node 18 version from workspaces, added 22 to these workspaces that has configured just 20 with this change Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(blackduck): update Node versions to 22 and 24 to resolve CI issues (it is updated to Backstage 1.46 already) Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(topology): remove isolated-vm resolution that was added to bypass CI issues (this workspace is still on Backstage 1.45 and will be updated asap) Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(tekton): remove isolated-vm resolution that was added to bypass CI issues (this workspace is still on Backstage 1.45 and will be updated asap) Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(acr): update Node versions to 22 and 24 to resolve CI issues (it is updated to Backstage 1.46 already) Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(quay): update Node versions to 22 and 24 to resolve CI issues (it is updated to Backstage 1.46 already) Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> * fix(doc): update faq Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com> --------- Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
1 parent 7cd6608 commit 17e5883

File tree

49 files changed

+115
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+115
-69
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
outputs:
1515
workspaces: ${{ steps.find-changed-workspaces.outputs.workspaces }}
16+
workspaceNodeMatrix: ${{ steps.find-changed-workspaces.outputs.workspace_node_matrix }}
1617
steps:
1718
- name: Calculate number of commits in PR
1819
id: calculate-commits
@@ -45,17 +46,16 @@ jobs:
4546
BASE_REF: origin/${{ github.event.pull_request.base.ref }}
4647

4748
ci:
48-
name: Workspace ${{ matrix.workspace }}, CI step for node ${{ matrix.node-version }}
49+
name: Workspace ${{ matrix.workspaceNodeMatrix.workspace }}, CI step for node ${{ matrix.workspaceNodeMatrix.nodeVersion }}
4950
runs-on: ubuntu-latest
5051
needs: find-changed-workspaces
5152
strategy:
5253
matrix:
53-
workspace: ${{ fromJSON(needs.find-changed-workspaces.outputs.workspaces) }}
54-
node-version: [22.x, 24.x]
54+
workspaceNodeMatrix: ${{ fromJSON(needs.find-changed-workspaces.outputs.workspaceNodeMatrix) }}
5555
fail-fast: false
5656
defaults:
5757
run:
58-
working-directory: ./workspaces/${{ matrix.workspace }}
58+
working-directory: ./workspaces/${{ matrix.workspaceNodeMatrix.workspace }}
5959

6060
env:
6161
CI: true
@@ -71,10 +71,10 @@ jobs:
7171
with:
7272
ref: ${{ github.event.workflow_run.head_branch }}
7373

74-
- name: Set up Node ${{ matrix.node-version }}
74+
- name: Set up Node ${{ matrix.workspaceNodeMatrix.nodeVersion }}
7575
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
7676
with:
77-
node-version: ${{ matrix.node-version }}
77+
node-version: ${{ matrix.workspaceNodeMatrix.nodeVersion }}
7878
registry-url: https://registry.npmjs.org/ # Needed for auth
7979

8080
- name: yarn install
@@ -84,7 +84,7 @@ jobs:
8484
run: yarn fix --check
8585

8686
- name: validate config
87-
if: ${{ hashFiles(format('workspaces/{0}/app-config.yaml', matrix.workspace)) != '' }}
87+
if: ${{ hashFiles(format('workspaces/{0}/app-config.yaml', matrix.workspaceNodeMatrix.workspace)) != '' }}
8888
run: yarn backstage-cli config:check --lax
8989

9090
- name: type checking and declarations
@@ -96,7 +96,7 @@ jobs:
9696
- name: read knipReports flag from bcp.json
9797
id: bcpKnipReports
9898
run: |
99-
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspace }}"
99+
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspaceNodeMatrix.workspace }}"
100100
if [ -f bcp.json ]; then
101101
echo "Reading knipReports flag..."
102102
KNIP_REPORTS=$(jq -r '.["knipReports"]' bcp.json)
@@ -114,7 +114,7 @@ jobs:
114114
- name: read listDeprecations flag from bcp.json
115115
id: bcpListDeprecations
116116
run: |
117-
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspace }}"
117+
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspaceNodeMatrix.workspace }}"
118118
if [ -f bcp.json ]; then
119119
echo "Reading listDeprecations flag..."
120120
LIST_DEPRECATIONS=$(jq -r '.["listDeprecations"]' bcp.json)
@@ -147,7 +147,7 @@ jobs:
147147
- name: read playwrightTests flag from bcp.json
148148
id: bcpPlaywrightTests
149149
run: |
150-
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspace }}"
150+
echo "Checking for bcp.json in workspace: workspaces/${{ matrix.workspaceNodeMatrix.workspace }}"
151151
if [ -f bcp.json ]; then
152152
echo "Reading playwrightTests flag..."
153153
PLAYWRIGHT_TESTS=$(jq -r '.["playwrightTests"]' bcp.json)

docs/plugin-maintainers-guide.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- [A GitHub check is stuck "waiting for status to be reported".](#a-github-check-is-stuck-waiting-for-status-to-be-reported)
2525
- [The "API Report" check is failing.](#the-api-report-check-is-failing)
2626
- [My build is failing with errors about `package.json` metadata.](#my-build-is-failing-with-errors-about-packagejson-metadata)
27+
- [My CI workflow is failing with some Node.js versions.](#my-ci-workflow-is-failing-with-some-nodejs-versions)
2728
- [My CI workflow is failing due to linting errors.](#my-ci-workflow-is-failing-due-to-linting-errors)
2829
- [How do I create a new plugin?](#how-do-i-create-a-new-plugin)
2930

@@ -289,6 +290,18 @@ The `package.json` for your plugin might be missing required fields or have inco
289290
2. Run `yarn backstage-cli repo fix --publish`
290291
3. This will check for and automatically fix common `package.json` issues. Commit any changes.
291292
293+
### My CI workflow is failing with some Node.js versions.
294+
295+
The CI workflow runs your tests automatically with all versions configured in your workspace root `package.json`, configured under `engines.node`, like:
296+
297+
```json
298+
"engines": {
299+
"node": "22 || 24"
300+
},
301+
```
302+
303+
This versions should match the [Node.js versions supported by Backstage](https://backstage.io/docs/overview/versioning-policy/#nodejs-releases).
304+
292305
### My CI workflow is failing due to linting errors.
293306
294307
This means your code doesn't match the project's automatic formatting rules.

scripts/ci/list-workspaces-with-changes.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ async function main() {
4949
if (!process.env.GITHUB_OUTPUT) {
5050
throw new Error('GITHUB_OUTPUT environment variable not set');
5151
}
52-
5352
const repoRoot = resolvePath(__dirname, '..', '..');
5453
process.chdir(repoRoot);
5554

@@ -81,10 +80,46 @@ async function main() {
8180

8281
console.log('workspaces that exist:', Array.from(workspaces));
8382

83+
// Automatically detect the supported Node versions from package.json
84+
const workspaceNodeMatrix = [];
85+
for (const workspace of workspaces) {
86+
const packageJson = JSON.parse(
87+
await fs.readFile(`workspaces/${workspace}/package.json`),
88+
);
89+
const nodeString = packageJson.engines.node;
90+
if (!nodeString) {
91+
throw new Error(
92+
`No node engine specified in workspaces/${workspace}/package.json`,
93+
);
94+
}
95+
const nodeVersions = nodeString.split('||').map(v => v.trim());
96+
console.log(
97+
`Detected node versions for workspace ${workspace}:`,
98+
nodeVersions,
99+
);
100+
// Convert versions like "18" to "18.x" for GitHub matrix usage
101+
nodeVersions.forEach(nodeVersion => {
102+
if (nodeVersion.match(/^\d\d$/)) {
103+
workspaceNodeMatrix.push({
104+
workspace,
105+
nodeVersion: `${nodeVersion}.x`,
106+
});
107+
} else {
108+
workspaceNodeMatrix.push({ workspace, nodeVersion });
109+
}
110+
});
111+
}
112+
84113
await fs.appendFile(
85114
process.env.GITHUB_OUTPUT,
86115
`workspaces=${JSON.stringify(Array.from(workspaces))}${EOL}`,
87116
);
117+
await fs.appendFile(
118+
process.env.GITHUB_OUTPUT,
119+
`workspace_node_matrix=${JSON.stringify(
120+
Array.from(workspaceNodeMatrix),
121+
)}${EOL}`,
122+
);
88123
}
89124

90125
main().catch(error => {

workspaces/3scale/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20 || 22"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"start": "backstage-cli repo start",

workspaces/acr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"private": true,
66
"engines": {
7-
"node": "18 || 20 || 22"
7+
"node": "22 || 24"
88
},
99
"scripts": {
1010
"start": "backstage-cli repo start",

workspaces/acs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "20.x"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"dev": "yarn workspaces foreach -A --include backend --include app --parallel -v -i run start",

workspaces/adr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20 || 22"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"dev": "yarn workspaces foreach -A --include @backstage-community/plugin-adr --include @backstage-community/plugin-adr-backend --parallel -v -i run start",

workspaces/amplication/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20 || 22"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"start": "backstage-cli repo start",

workspaces/analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20 || 22"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"tsc": "tsc",

workspaces/azure-resources/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"private": true,
55
"engines": {
6-
"node": "18 || 20 || 22"
6+
"node": "20 || 22"
77
},
88
"scripts": {
99
"start": "backstage-cli repo start",

0 commit comments

Comments
 (0)