Skip to content

fix: make validate-backend work without webpack output - #1813

Open
ckbedwell wants to merge 1 commit into
mainfrom
fix/validate-backend-metadata
Open

fix: make validate-backend work without webpack output#1813
ckbedwell wants to merge 1 commit into
mainfrom
fix/validate-backend-metadata

Conversation

@ckbedwell

Copy link
Copy Markdown
Contributor

Problem

./scripts/validate-backend is meant to verify the Go backend loads in Grafana without running the full frontend dev setup. After #1806 it only ran mage buildAll, which writes the linux binary into dist/datasource/ but not the plugin metadata Grafana needs to register the nested datasource. On a clean tree the health and registration checks fail even when the binary is fine.

The script also bind-mounted its throwaway datasource YAML as a file onto a path inside dev/provisioning/datasources/. Docker created that file on the host, and cleanup did not remove it — so a later yarn server could pick up an extra empty SM datasource.

Solution

Stage src/plugin.json and src/datasource/plugin.json into dist/ after the build step, with fail-fast checks that both files exist before starting Grafana. Mount the temp provisioning directory over the container datasources path instead of a single file bind, so nothing is written under dev/provisioning/ on the host.

Test plan

  • ./scripts/validate-backend passes on a clean tree (mage output only)
  • SKIP_BUILD=1 ./scripts/validate-backend passes after removing dist/plugin.json files (staging copies them back)
  • No dev/provisioning/datasources/sm-backend-validate.yaml left on the host after the script exits

Stage plugin.json into dist/ after mage buildAll so the script can verify
backend load on a clean tree, and mount temp provisioning as a directory so
nothing is left under dev/provisioning/datasources.
@ckbedwell
ckbedwell requested a review from a team as a code owner August 14, 2026 16:35
@ckbedwell
ckbedwell requested review from VikaCep and g3john August 14, 2026 16:35
@github-actions github-actions Bot added the fix A fix applied to the application. label Aug 14, 2026
@github-actions

Copy link
Copy Markdown

Script size changes

Name +/- Main This PR Outcome
[731.js] = 6,624.40 kB 6,624.40 kB
[87.js] = 3,622.85 kB 3,622.85 kB
[469.js] = 506.85 kB 506.85 kB
[datasource/module.js] = 120.48 kB 120.48 kB
[9.js] = 99.10 kB 99.10 kB
[628.js] = 92.69 kB 92.69 kB
[692.js] = 68.38 kB 68.38 kB
[590.js] = 47.64 kB 47.64 kB
[module.js] = 35.29 kB 35.29 kB
[546.js] = 27.49 kB 27.49 kB
[294.js] = 22.06 kB 22.06 kB
[466.js] = 5.15 kB 5.15 kB
[131.js] = 5.00 kB 5.00 kB
[845.js] = 3.25 kB 3.25 kB
[295.js] = 2.79 kB 2.79 kB

Totals

Name +/- Main This PR Outcome
[Scripts] = 11,283.42 kB 11,283.42 kB
[Non-script Assets] = 1,472.14 kB 1,472.14 kB
[All] = 12,755.56 kB 12,755.56 kB

Generated by 🚫 dangerJS against 7ac87c0

@g3john g3john 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.

LGTM

g3john

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix applied to the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants