grafana/apps/provisioning/pkg
Roberto Jiménez Sánchez 185d018a26
Provisioning: Generalize the job admission validator (#125978)
* Provisioning: Generalize the job admission validator (P0.9)

validateExportResourceRefs (shared by push and migrate job options)
hard-rejected anything that wasn't a Dashboard, so job-driven flows for
any newly-supported kind failed at admission.

Validate each resource ref's kind/group against the configured
supported-resource set instead of the dashboard constants. The set is
injected into the job AdmissionValidator and threaded through ValidateJob.
When no set is configured it falls back to the dashboard-only default,
preserving legacy behavior. Disabled resources are not accepted.

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

* Provisioning: Integration tests for config-driven job admission validation

Update the existing job-validation integration assertions for the
generalized validator: the default active set is {Folder, Dashboard}, so
Folder is now accepted for export — switch the rejection cases to kinds
that are genuinely outside the active set (declared-but-disabled Playlist
and LibraryPanel, case-mismatched "dashboard") and to the new error
messages.

Add a config-driven integration test that boots Grafana with a custom
[provisioning] resources set and asserts the validator honors it: a kind
added purely through config is accepted for push/migrate, while unknown,
disabled, and wrong-group refs are rejected at admission.

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

* Provisioning: Drop repo dependency from config-driven job validation test

The test created a local repository whose initial sync failed under the
postgres CI runner (the worker's repo status update hit the permitted-path
check), making setup flaky. Job admission only requires a non-empty
repository name and does not check repository existence, so creating Job
objects directly through the resource client exercises the validator in
isolation without a real repository.

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

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 17:44:10 +02:00
..
apis Provisioning: Capability-based config-driven supported resources (#125856) 2026-06-08 13:57:38 +02:00
connection Provisioning: Add githubEnterprise repository and connection type (#124162) 2026-05-12 08:22:36 -04:00
controller Provisioning: Retry SQLITE_BUSY on repository status patch (#123873) 2026-04-30 15:20:18 +03:00
generated Provisioning: Spec scaffolding for Commit & PR Conventions (#125671) 2026-05-29 15:16:42 +00:00
jobs Provisioning: Generalize the job admission validator (#125978) 2026-06-08 17:44:10 +02:00
loki Provisioning: Move apifmt, loki and safepath to provisioning app (#110226) 2025-08-27 13:26:48 -05:00
quotas Chore: Use range where possible (#123281) 2026-04-22 22:56:28 +00:00
repository Provisioning: Wire folderless sync target behavior (#125812) 2026-06-08 11:52:04 +00:00
resources Provisioning: Add selective dashboard export via Resources field (#123381) 2026-04-27 08:42:00 +02:00
safepath Provisioning: Full Sync - react when metadata is deleted (#120763) 2026-03-20 12:43:05 +01:00
util Chore: Remove remaining ptr constructor helper functions (#124553) 2026-05-11 21:00:39 +03:00