feat(e2e-version): replace React 19 preview image with version + feature toggles#239
Open
mckn wants to merge 3 commits into
Open
feat(e2e-version): replace React 19 preview image with version + feature toggles#239mckn wants to merge 3 commits into
mckn wants to merge 3 commits into
Conversation
…ure toggles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
…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>
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; |
| 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 |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
React 19 testing relied on a dedicated
dev-preview-react19image — 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 viaGF_FEATURE_TOGGLES_ENABLE.What changed
Each matrix item gains an
enabledTogglesfield (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.jsononmain, 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→ latest13.1.x;>=13.1.0→ an entry per satisfying minor.runInRepositories— optional array of regexes matched againstGITHUB_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-imageis deprecated in favor ofrunInRepositories; when explicitlytrueit still acts as a kill-switch for all variants.Workflow update
Consumers pass the new field to the container: