Skip to content

feat(e2e-version): replace React 19 preview image with version + feature toggles#239

Open
mckn wants to merge 3 commits into
mainfrom
mckn/react19-feature-toggles
Open

feat(e2e-version): replace React 19 preview image with version + feature toggles#239
mckn wants to merge 3 commits into
mainfrom
mckn/react19-feature-toggles

Conversation

@mckn

@mckn mckn commented Jun 4, 2026

Copy link
Copy Markdown

Why

React 19 testing relied on a dedicated dev-preview-react19 image — a bespoke image outside the normal Grafana release process. Instead, React 19 (and feature toggles generally) should be tested against real Grafana releases with the toggle enabled via GF_FEATURE_TOGGLES_ENABLE.

What changed

Each matrix item gains an enabledToggles field (comma-separated, empty when none). Feature-toggle variants are now appended to the matrix as real releases with toggles enabled.

The variant definitions are not baked into the action — they're fetched at runtime from feature-toggle-variants.json on main, so adding/removing a variant is a PR merge that applies to all consumers regardless of the pinned action version (no release or consumer bump). If the fetch fails, variants are skipped and the rest of the matrix is unaffected.

The file is a JSON array of variants:

[
  {
    "name": "grafana-enterprise",
    "enabledToggles": "react19",
    "grafanaDependency": ">=13.1.0 <13.2.0",
    "runInRepositories": ["^grafana/"]
  }
]
  • grafanaDependency — a semver range. The toggles are applied to every available stable version (latest patch per minor) that satisfies it. E.g. >=13.1.0 <13.2.0 → latest 13.1.x; >=13.1.0 → an entry per satisfying minor.
  • runInRepositories — optional array of regexes matched against GITHUB_REPOSITORY (owner/repo); the variant applies when any matches. Omitted = everywhere. Invalid patterns are ignored with a warning.

The baseline entry for a version is kept alongside its toggle-enabled variant (no dedup), so the release is tested both with and without the toggle.

skip-grafana-react-19-preview-image is deprecated in favor of runInRepositories; when explicitly true it still acts as a kill-switch for all variants.

Workflow update

Consumers pass the new field to the container:

- name: Start Grafana
  run: |
    GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.version }} \
    GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.name }} \
    GF_FEATURE_TOGGLES_ENABLE=${{ matrix.GRAFANA_IMAGE.enabledToggles }} \
    docker-compose up -d

…ure toggles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mckn mckn requested a review from a team as a code owner June 4, 2026 16:14
@mckn mckn requested review from andresmgot, sunker and wbrowne June 4, 2026 16:14
@cla-assistant

cla-assistant Bot commented Jun 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@mckn mckn moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Jun 5, 2026
@mckn mckn self-assigned this Jun 5, 2026
Source the feature-toggle variant list from a JSON file on main, fetched
at runtime, so variants can be added/removed by merging a PR without
requiring consumers to bump the pinned action version. Falls back to
skipping variants (with a warning) if the fetch fails.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Comment thread e2e-version/index.js Outdated
Comment thread e2e-version/action.yml
Comment thread e2e-version/README.md
Comment thread e2e-version/README.md
…repository

The variant list is now a JSON array where each variant specifies a
grafanaDependency semver range; the toggles are applied to every available
stable Grafana version that satisfies the range. Variants can also be
scoped to repositories via runInRepositories regex patterns, replacing the
org-based default and deprecating skip-grafana-react-19-preview-image.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment thread e2e-version/index.js
Comment on lines +200 to +224
const definitions = await fetchFeatureToggleVariants();
const variants = [];
for (const { name, enabledToggles, grafanaDependency, runInRepositories } of definitions) {
if (!matchesRepository(runInRepositories, repository)) {
console.log(`Skipping feature-toggle variant "${enabledToggles}": not enabled for repository ${repository}`);
continue;
}
if (!grafanaDependency || semver.validRange(grafanaDependency) === null) {
console.warn(
`Skipping feature-toggle variant "${enabledToggles}": invalid grafanaDependency range "${grafanaDependency}"`
);
continue;
}
const matching = availableGrafanaVersions.filter((v) => semver.satisfies(v.version, grafanaDependency));
if (matching.length === 0) {
console.log(
`Skipping feature-toggle variant "${enabledToggles}": no stable release satisfies ${grafanaDependency}`
);
continue;
}
for (const v of matching) {
variants.push({ name, version: v.version, enabledToggles });
}
}
return variants;
Comment thread e2e-version/README.md
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} GF_FEATURE_TOGGLES_ENABLE=${{ matrix.GRAFANA_IMAGE.enabledToggles }} docker-compose up -d
Comment thread e2e-version/README.md
run: |
docker-compose pull
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker-compose up -d
GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} GF_FEATURE_TOGGLES_ENABLE=${{ matrix.GRAFANA_IMAGE.enabledToggles }} docker-compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

2 participants