* Deprecate Legacy Storage Migration in Backend * Change the messaging around legacy storage * Disable cards to connect * Commit import changes * Block repository creation if resources are in legacy storage * Update error message * Prettify * chore: uncomment unified migration * chore: adapt and fix tests * Remove legacy storage migration from frontend * Refactor provisioning job options by removing legacy storage and history fields - Removed the `History` field from `MigrateJobOptions` and related references in the codebase. - Eliminated the `LegacyStorage` field from `RepositoryViewList` and its associated comments. - Updated tests and generated OpenAPI schema to reflect these changes. - Simplified the `MigrationWorker` by removing dependencies on legacy storage checks. * Refactor OpenAPI schema and tests to remove deprecated fields - Removed the `history` field from `MigrateJobOptions` and updated the OpenAPI schema accordingly. - Eliminated the `legacyStorage` field from `RepositoryViewList` and its associated comments in the schema. - Updated integration tests to reflect the removal of these fields. * Fix typescript errors * Refactor provisioning code to remove legacy storage dependencies - Eliminated references to `dualwrite.Service` and related legacy storage checks across multiple files. - Updated `APIBuilder`, `RepositoryController`, and `SyncWorker` to streamline resource handling without legacy storage considerations. - Adjusted tests to reflect the removal of legacy storage mocks and dependencies, ensuring cleaner and more maintainable code. * Fix unit tests * Remove more references to legacy * Enhance provisioning wizard with migration options - Added a checkbox for migrating existing resources in the BootstrapStep component. - Updated the form context to track the new migration option. - Adjusted the SynchronizeStep and useCreateSyncJob hook to incorporate the migration logic. - Enhanced localization with new descriptions and labels for migration features. * Remove unused variable and dualwrite reference in provisioning code - Eliminated an unused variable declaration in `provisioning_manifest.go`. - Removed the `nil` reference for dualwrite in `repo_operator.go`, aligning with the standalone operator's assumption of unified storage. * Update go.mod and go.sum to include new dependencies - Added `github.com/grafana/grafana-app-sdk` version `0.48.5` and several indirect dependencies including `github.com/getkin/kin-openapi`, `github.com/hashicorp/errwrap`, and others. - Updated `go.sum` to reflect the new dependencies and their respective versions. * Refactor provisioning components for improved readability - Simplified the import statement in HomePage.tsx by removing unnecessary line breaks. - Consolidated props in the SynchronizeStep component for cleaner code. - Enhanced the layout of the ProvisioningWizard component by streamlining the rendering of the SynchronizeStep. * Deprecate MigrationWorker and clean up related comments - Removed the deprecated MigrationWorker implementation and its associated comments from the provisioning code. - This change reflects the ongoing effort to eliminate legacy components and improve code maintainability. * Fix linting issues * Add explicit comment * Update useResourceStats hook in BootstrapStep component to accept selected target - Modified the BootstrapStep component to pass the selected target to the useResourceStats hook. - Updated related tests to reflect the change in expected arguments for the useResourceStats hook. * fix(provisioning): Update migrate tests to match export-then-sync behavior for all repository types Updates test expectations for folder-type repositories to match the implementation changes where both folder and instance repository types now run export followed by sync. Only the namespace cleaner is skipped for folder-type repositories. Changes: - Update "should run export and sync for folder-type repositories" test to include export mocks - Update "should fail when sync job fails for folder-type repositories" test to include export mocks - Rename test to clarify that both export and sync run for folder types - Add proper mock expectations for SetMessage, StrictMaxErrors, Process, and ResetResults All migrate package tests now pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Update provisioning wizard text and improve resource counting display - Enhanced descriptions for migrating existing resources to clarify that unmanaged resources will also be included. - Refactored BootstrapStepResourceCounting component to simplify the rendering logic and ensure both external storage and unmanaged resources are displayed correctly. - Updated alert messages in SynchronizeStep to reflect accurate information regarding resource management during migration. - Adjusted localization strings for consistency with the new descriptions. * Update provisioning wizard alert messages for clarity and accuracy - Revised alert points to indicate that resources can still be modified during migration, with a note on potential export issues. - Clarified that resources will be marked as managed post-provisioning and that dashboards remain accessible throughout the process. * Fix issue with trigger wrong type of job * Fix export failure when folder already exists in repository When exporting resources to a repository, if a folder already exists, the Read() method would fail with "path component is empty" error. This occurred because: 1. Folders are identified by trailing slash (e.g., "Legacy Folder/") 2. The Read() method passes this path directly to GetTreeByPath() 3. GetTreeByPath() splits the path by "/" creating empty components 4. This causes the "path component is empty" error The fix strips the trailing slash before calling GetTreeByPath() to avoid empty path components, while still using the trailing slash convention to identify directories. The Create() method already handles this correctly by appending ".keep" to directory paths, which is why the first export succeeded but subsequent exports failed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Fix folder tree not updated when folder already exists in repository When exporting resources and a folder already exists in the repository, the folder was not being added to the FolderManager's tree. This caused subsequent dashboard exports to fail with "folder NOT found in tree". The fix adds the folder to fm.tree even when it already exists in the repository, ensuring all folders are available for resource lookups. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Revert "Merge remote-tracking branch 'origin/uncomment-unified-migration-code' into cleanup/deprecate-legacy-storage-migration-in-provisioning" This reverts commit6440fae342, reversing changes made toec39fb04f2. * fix: handle empty folder titles in path construction - Skip folders with empty titles in dirPath to avoid empty path components - Skip folders with empty paths before checking if they exist in repository - Fix unit tests to properly check useResourceStats hook calls with type annotations * Update workspace * Fix BootstrapStep tests after reverting unified migration merge Updated test expectations to match the current component behavior where resource counts are displayed for both instance and folder sync options. - Changed 'Empty' count expectation from 3 to 4 (2 cards × 2 counts each) - Changed '7 resources' test to use findAllByText instead of findByText since the count appears in multiple cards 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Remove bubbletee deps * Fix workspace * provisioning: update error message to reference enableMigration config Update the error message when provisioning cannot be used due to incompatible data format to instruct users to enable data migration for folders and dashboards using the enableMigration configuration introduced in PR #114857. Also update the test helper to include EnableMigration: true for both dashboards and folders to match the new configuration pattern. * provisioning: add comment explaining Mode5 and EnableMigration requirement Add a comment in the integration test helper explaining that Provisioning requires Mode5 (unified storage) and EnableMigration (data migration) as it expects resources to be fully migrated to unified storage. * Remove migrate resources checkbox from folder type provisioning wizard - Remove checkbox UI for migrating existing resources in folder type - Remove migrateExistingResources from migration logic - Simplify migration to only use requiresMigration flag - Remove unused translation keys - Update i18n strings * Fix linting * Remove unnecessary React Fragment wrapper in BootstrapStep * Address comments --------- Co-authored-by: Rafael Paulovic <rafael.paulovic@grafana.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
178 lines
6.7 KiB
CUE
178 lines
6.7 KiB
CUE
package repository
|
|
|
|
repository: {
|
|
kind: "Repository"
|
|
pluralName: "Repositories"
|
|
current: "v0alpha1"
|
|
validation: {
|
|
operations: [
|
|
"CREATE",
|
|
"UPDATE",
|
|
]
|
|
}
|
|
versions: {
|
|
"v0alpha1": {
|
|
codegen: {
|
|
ts: {enabled: false}
|
|
go: {enabled: true}
|
|
}
|
|
schema: {
|
|
#LocalRepositoryConfig: {
|
|
// Path to the local repository
|
|
path: string
|
|
}
|
|
#GitHubRepositoryConfig: {
|
|
// The repository URL (e.g. `https://github.com/example/test`).
|
|
url?: string
|
|
// The branch to use in the repository.
|
|
branch: string
|
|
// Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.
|
|
token?: string
|
|
// Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.
|
|
encryptedToken?: [...string]
|
|
// Whether we should show dashboard previews for pull requests.
|
|
// By default, this is false (i.e. we will not create previews).
|
|
generateDashboardPreviews?: bool
|
|
// Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.
|
|
path?: string
|
|
}
|
|
#GitRepositoryConfig: {
|
|
// The repository URL (e.g. `https://github.com/example/test.git`).
|
|
url?: string
|
|
// The branch to use in the repository.
|
|
branch: string
|
|
// TokenUser is the user that will be used to access the repository if it's a personal access token.
|
|
tokenUser?: string
|
|
// Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.
|
|
token?: string
|
|
// Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.
|
|
encryptedToken?: [...string]
|
|
// Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.
|
|
path?: string
|
|
}
|
|
#BitbucketRepositoryConfig: {
|
|
// The repository URL (e.g. `https://bitbucket.org/example/test`).
|
|
url?: string
|
|
// The branch to use in the repository.
|
|
branch: string
|
|
// TokenUser is the user that will be used to access the repository if it's a personal access token.
|
|
tokenUser?: string
|
|
// Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.
|
|
token?: string
|
|
// Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.
|
|
encryptedToken?: [...string]
|
|
// Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.
|
|
path?: string
|
|
}
|
|
#GitLabRepositoryConfig: {
|
|
// The repository URL (e.g. `https://gitlab.com/example/test`).
|
|
url?: string
|
|
// The branch to use in the repository.
|
|
branch: string
|
|
// Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.
|
|
token?: string
|
|
// Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.
|
|
encryptedToken?: [...string]
|
|
// Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.
|
|
path?: string
|
|
}
|
|
#SyncOptions: {
|
|
// Enabled must be saved as true before any sync job will run
|
|
enabled: bool
|
|
// Where values should be saved
|
|
target: "instance" | "folder"
|
|
// When non-zero, the sync will run periodically
|
|
intervalSeconds?: int
|
|
}
|
|
#ConnectionInfo: {
|
|
name: string
|
|
}
|
|
#HealthStatus: {
|
|
// When not healthy, requests will not be executed
|
|
healthy: bool
|
|
// When the health was checked last time
|
|
checked?: int
|
|
// Summary messages (can be shown to users)
|
|
// Will only be populated when not healthy
|
|
message?: [...string]
|
|
}
|
|
#SyncStatus: {
|
|
// pending, running, success, error
|
|
state: "pending" | "running" | "success" | "error"
|
|
// The ID for the job that ran this sync
|
|
job?: string
|
|
// When the sync job started
|
|
started?: int
|
|
// When the sync job finished
|
|
finished?: int
|
|
// When the next sync check is scheduled
|
|
scheduled?: int
|
|
// Summary messages (will be shown to users)
|
|
message: [...string]
|
|
// The repository ref when the last successful sync ran
|
|
lastRef?: string
|
|
// Incremental synchronization for versioned repositories
|
|
incremental?: bool
|
|
}
|
|
#ResourceCount: {
|
|
group: string
|
|
resource: string
|
|
count: int
|
|
}
|
|
#WebhookStatus: {
|
|
id?: int
|
|
url?: string
|
|
secret?: string
|
|
encryptedSecret?: [...string]
|
|
subscribedEvents?: [...string]
|
|
lastEvent?: int
|
|
}
|
|
spec: {
|
|
// The repository display name (shown in the UI)
|
|
title: string
|
|
// Repository description
|
|
description?: string
|
|
// UI driven Workflow that allow changes to the contends of the repository.
|
|
// The order is relevant for defining the precedence of the workflows.
|
|
// When empty, the repository does not support any edits (eg, readonly)
|
|
workflows?: [...string]
|
|
// Sync settings -- how values are pulled from the repository into grafana
|
|
sync: #SyncOptions
|
|
// The repository type. When selected oneOf the values below should be non-nil
|
|
type: "local" | "github" | "git" | "bitbucket" | "gitlab"
|
|
// The repository on the local file system.
|
|
// Mutually exclusive with local | github.
|
|
local?: #LocalRepositoryConfig
|
|
// The repository on GitHub.
|
|
// Mutually exclusive with local | github | git.
|
|
github?: #GitHubRepositoryConfig
|
|
// The repository on Git.
|
|
// Mutually exclusive with local | github | git.
|
|
git?: #GitRepositoryConfig
|
|
// The repository on Bitbucket.
|
|
// Mutually exclusive with local | github | git.
|
|
bitbucket?: #BitbucketRepositoryConfig
|
|
// The repository on GitLab.
|
|
// Mutually exclusive with local | github | git.
|
|
gitlab?: #GitLabRepositoryConfig
|
|
// The connection the repository references.
|
|
// This means the Repository is interacting with git via a Connection.
|
|
connection?: #ConnectionInfo
|
|
}
|
|
status: {
|
|
// The generation of the spec last time reconciliation ran
|
|
observedGeneration?: int
|
|
// This will get updated with the current health status (and updated periodically)
|
|
health: #HealthStatus
|
|
// Sync information with the last sync information
|
|
sync: #SyncStatus
|
|
// The object count when sync last ran
|
|
stats?: [...#ResourceCount]
|
|
// Webhook Information (if applicable)
|
|
webhook?: #WebhookStatus
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|