Skip to content

Commit f850aa0

Browse files
authored
feat: support react image in e2e matrix (#192)
* Add support for Grafana React image with org-based default * add bundle * allow internal repos to opt out * fix logic for internal repos * test node24 * use hardcoded image * use new name * rename input * use boolean * improve boolean input handling * remove default value * use getinput instead of env var
1 parent b33da83 commit f850aa0

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

e2e-version/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ inputs:
77
required: false
88
description: 'Optionally, you can skip the Grafana dev image'
99
type: boolean
10+
skip-grafana-react-19-preview-image:
11+
required: false
12+
description: 'Skip the Grafana React 19 preview image (e.g., grafana/grafana:dev-preview-react19). Defaults to false (include) for Grafana org repositories, true (skip) for others. Can be explicitly overridden.'
13+
type: boolean
1014
version-resolver-type:
1115
required: true
1216
type: choice
@@ -32,5 +36,5 @@ output:
3236
description: 'Versions to test against'
3337

3438
runs:
35-
using: node20
39+
using: node24
3640
main: ./dist/index.js

e2e-version/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e-version/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const fs = require('fs/promises');
55
const path = require('path');
66

77
const SkipGrafanaDevImageInput = 'skip-grafana-dev-image';
8+
const SkipGrafanaReact19PreviewImageInput = 'skip-grafana-react-19-preview-image';
89
const VersionResolverTypeInput = 'version-resolver-type';
910
const GrafanaDependencyInput = 'grafana-dependency';
1011
const LimitInput = 'limit';
@@ -18,6 +19,30 @@ const VersionResolverTypes = {
1819
async function run() {
1920
try {
2021
const skipGrafanaDevImage = core.getBooleanInput(SkipGrafanaDevImageInput);
22+
23+
// Determine default for React image based on repository owner
24+
// Include by default for Grafana org repositories, skip for others
25+
// GITHUB_REPOSITORY is in format "owner/repo", GITHUB_REPOSITORY_OWNER might not be available
26+
const githubRepository = process.env.GITHUB_REPOSITORY || '';
27+
const repositoryOwner = process.env.GITHUB_REPOSITORY_OWNER || githubRepository.split('/')[0] || '';
28+
const isGrafanaOrg = repositoryOwner.toLowerCase() === 'grafana';
29+
30+
// Check if input was explicitly provided by checking if getInput returns non-empty string
31+
// core.getInput() returns empty string when input is not provided
32+
const reactImageInputValue = core.getInput(SkipGrafanaReact19PreviewImageInput);
33+
const isExplicitlyProvided = reactImageInputValue !== '';
34+
35+
// If input is not explicitly provided, use org-based defaults
36+
// If input is explicitly provided, always honor it using getBooleanInput
37+
let skipGrafanaReact19PreviewImage;
38+
if (!isExplicitlyProvided) {
39+
// Input not provided: use defaults based on org
40+
skipGrafanaReact19PreviewImage = !isGrafanaOrg; // false for Grafana org (include), true for external (skip)
41+
} else {
42+
// Input explicitly provided: always honor it
43+
skipGrafanaReact19PreviewImage = core.getBooleanInput(SkipGrafanaReact19PreviewImageInput);
44+
}
45+
2146
const grafanaDependency = core.getInput(GrafanaDependencyInput);
2247
const versionResolverType = core.getInput(VersionResolverTypeInput) || VersionResolverTypes.PluginGrafanaDependency;
2348
const limit = parseInt(core.getInput(LimitInput));
@@ -75,6 +100,11 @@ async function run() {
75100
}
76101
}
77102

103+
if (!skipGrafanaReact19PreviewImage) {
104+
// Add hardcoded Grafana React 19 preview image
105+
images.push({ name: 'grafana', version: 'dev-preview-react19' });
106+
}
107+
78108
console.log('Resolved images: ', images);
79109
core.setOutput(MatrixOutput, JSON.stringify(images));
80110
return images;

0 commit comments

Comments
 (0)