113 Commits

Author SHA1 Message Date
20cea80795 Provisioning: Add bulk delete job (#108580)
* Add delete job type

* Regenerate spec

* Add first implementation of worker

* Move interface and mock to repository package

* Add unit tests

* Add integration tests

* Fix linting and spec

* Regenerate client

* Format file

* go fmt

* fix

---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-07-25 16:38:10 +00:00
16339b0788 Provisioning: Move repository file API (#108514)
* Bump nanogit version
* Embed git repository in the Github one
2025-07-24 23:28:59 -05:00
e9b9618fb0 Provisioning: Fix stage options for export (#108585)
* Add ref option to stage options

* Fix the issue with ref in export worker

* Add unit tests for export stage options

* Do not fail if ref is equal to the stage branch

* Format code again

* fix test

---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-07-24 16:53:33 +00:00
915f47befd Provisioning: commit only once staged changes (#108590) 2025-07-24 10:57:02 -05:00
0e7b041b27 Secrets: Move decrypt types to contracts and export public at root pkg (#108376)
* Secrets: Move decrypt types to contracts and export public at root pkg

* Provisioning: Replace decrypt pkg imports

* Merge wire changes
2025-07-23 12:14:28 +02:00
946358900c Provisioning: Add warning job status and different strictness (#108446)
* Add warning job status

* Different strictness for export than for pulling

* Fix some unit tests

* Fix unit tests

* Update frontend to display the warning status

* Fix status badge

* Add missing return statement

* Improve text in alert
2025-07-23 09:33:25 +00:00
482872c3bf Provisioning: Fix bug in job progress recording (#108440)
Fix bug in job progress recording
2025-07-22 14:21:22 +00:00
d72a70d246 Dashboards API: v2alpha2 missing pieces (#108293)
* Dashboards API: v2alpha2 missing pieces

* Fix issue with dashboard client scope for alpha versions

As we now have 2 different alpha versions for v2 we need to store the
clients separately.

* Improve debuggability of provisioning export test

- Add a helper function to print the tree structure.
- Be explicit about the expected file names expected in each case.

* Update pkg/registry/apis/dashboard/mutate.go

* Update pkg/services/authz/zanzana/server/server.go

Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>

* Review

* go lint

---------

Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
Co-authored-by: Igor Suleymanov <radiohead@users.noreply.github.com>
2025-07-22 11:44:05 +02:00
4847882ee7 Provisioning: handle .git extension more gracefully (#108213)
* Move .git to repository packages

* Bump nanogit 2025-07-17

This version handles `.git` extension internally so that the client
doesn't have to worry about it

* Put back mutation for Github

* Mutate also git URL for clarity
2025-07-18 13:25:21 +02:00
446054a61d Provisioning: fix race condition in usage metrics collection (#108289)
* Register usage stats after lister is created

For enterprise where metrics are collected more frequently and in
different ways the collection was happening before the listing was
initialized.

* Move usage to separate package
2025-07-18 13:24:58 +02:00
e3422c415f Provisioning: fix hack-introduced bug on repository updates (#108298)
* Add log line to see which secret service we are using
* Add hack to make test and create endpoint work until we have InLineSecureValues
2025-07-18 10:18:07 +00:00
5cf48294f7 Provisioning: fix authorized github client initialization (#108290)
* Add logging

* Fix the condition for the github token

* Revert "Add logging"

This reverts commit 71cbc675f6d258ef69adbe21b12b68786ecbdeff.

* Fix condition
2025-07-18 10:23:55 +02:00
810868c156 Provisioning: use new secure value client (#108227)
* Use provider in Webhooks registration

* First stab at using the new client

* Simplify mock

* Able to generate graph in OSS

* Remove line already ensured by provider

* Handle the K8s not found error as well

* Commit regenerated wire file

* Add the hack also for deletion

* Fix secrets test util

* Format file
2025-07-17 15:17:14 +02:00
ae4dc181d1 Provisioning: Add user token to git and bitbucket repository specs (#108186)
* Add token user to git and bitbucket specs

* Use token user if available in git type
2025-07-17 10:25:02 +02:00
b232ba5396 Provisioning: Move provisioning extras to OSS extensions (#108167)
* Move provisioning extensions to OSS

* Fix the wire stuff

* Move it to extras packages

* Add hack to assert test differently for enterprise
2025-07-16 13:24:24 +02:00
56543db16a Provisioning: delete secrets on repository deletion (#108113)
- Add hooks to git, github and github webhooks to remove the. 
- Implement deletion in secrets package.
- Add `Mutator` interface and hooks so that we can register any mutator. 
- Add unit test coverage to those mutators. 
- Move provider specific mutation from the massive `register.go` to the respective packages (e.g. `git` , `github`, etc). 
- Add integration test for removal. 
- Change the decryption fallback to simply check for the repository prefix.
2025-07-16 07:38:42 +00:00
d39a47a89b Provisioning: Begin using secrets store (#108044)
- Provisioning: Begin using secrets store
- Refactor integration with secrets store
- Add back the legacy service
- Separate concerns for encrypt and decrypt
- Handle update within Encrypt function
- Add interface for secure value service
- Add feature flag for using secrets service
- Add the dual service for temporary solution.

* Add first integration tests for encrypted tokens
* Add integration test for app platform secrets
* Validate it has the name or not
* Create wire provider
* Always save to the secret if provided secret

---------

Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
Co-authored-by: Roberto Jiménez Sánchez <jszroberto@gmail.com>
2025-07-15 15:43:17 +02:00
b49b103f42 Provisioning: Return available repository types in settings endpoint (#107977)
* Add types for other repositories

* Inject the types from extras

* Fix go-lint

* Fix typecheck

* Add it to the tests

---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
2025-07-11 22:07:04 +00:00
4b8e565a16 Fix innefectual assigment 2025-07-11 23:02:19 +02:00
cff66e8b45 Remove TODOs 2025-07-11 23:02:19 +02:00
acd6df6b89 Fix provisioning reporting 2025-07-11 23:02:19 +02:00
05a2d26787 Provisioning: Add refs endpoint (#108014) 2025-07-11 13:58:39 -07:00
7e0848294e Provisioning: Use Nanogit for basic git operations in Github repository type (#107889) 2025-07-10 09:46:38 -07:00
106206ae93 Ignore delete error if not found 2025-07-10 12:45:35 +02:00
b0df15c770 Fix issue with path in folder deletion
Folder path must not have a trailing slash in Nanogit
2025-07-10 12:45:35 +02:00
2484402f7a address PR comments 2025-07-10 12:45:35 +02:00
4386085aa9 fix linter 2025-07-10 12:45:35 +02:00
bd81243bbb Git sync: Implement folder deletion 2025-07-10 12:45:35 +02:00
b249942b61 Bump nanogit 2025-07-09 (#107871)
* Bump nanogit 2025-07-09

This version contains significant performance improvements in memory and
CPU thanks to optimizing buffers, using a faster zlib library and using
streaming instead of loading everything in memory.
2025-07-09 14:03:29 +02:00
3f502f305d Chore: Update mocks with recent mockery (#107816) 2025-07-09 09:15:34 +02:00
ef6e28b955 K8s: Make v0alpha1 opt-in (#107056) 2025-06-20 16:37:17 -05:00
d1b4bb182d Provisioning: Bump nanogit library for performance improvemnents (#107026)
* Bump nanogit library

This version of nanogit will be optimized for performance, specially for
bulk writes. It will store packfiles in a temporary file if there are
too many and clean up after push or when the writer is removed.

* Format code in nanogit/git.go
2025-06-20 12:51:29 +02:00
fe4abf2221 Git Sync UI: Delete Provisioned Dashboard Flow (#106593)
* DeleteProvisionedDashboardDrawer: delete provisioned dashboard flow set up with drawer

* clean up

* add tests

* more test and clean up

* revert endpoint change

* adjust tests

* remove unuse codes

* fix type, fix test, add read only message

* small changes

* fix test, i18n fix

* comments

* Fix bug for file deletion using a branch

* PR comments update

* Use the provided ref for parser so that URLs work

* call useDeleteRepositoryFilesWithPathMutation in delete drawer component directly

* remove console log

* Update public/app/features/dashboard-scene/components/Provisioned/DashboardEditFormSharedFields.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* PR comments

* use string for fields

* extract handle request logic from save form and delete form and put into one hook

* Add test for useProvisionedRequestHandler

* Update public/app/features/dashboard-scene/components/Provisioned/DashboardEditFormSharedFields.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard-scene/components/Provisioned/DashboardEditFormSharedFields.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard-scene/components/Provisioned/DashboardEditFormSharedFields.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard-scene/components/Provisioned/DashboardEditFormSharedFields.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard-scene/settings/DeleteProvisionedDashboardForm.test.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Update public/app/features/dashboard-scene/settings/DeleteProvisionedDashboardForm.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* use drawer close in both save form and delete form

* Add back panelEditor onDiscard

* add panelEditor onDiscard to delete flow

* Update public/app/features/dashboard-scene/settings/DeleteProvisionedDashboardForm.tsx

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

---------

Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2025-06-18 15:14:03 -04:00
3cb62e370b Provisioning: Add pure git repository type (#106815)
* Add repository type git to spec
* Register git type
* Update test checks
2025-06-18 09:05:37 +02:00
689cafc1fa App Platform Provisioning: Add experimental nanogit mode for Git Sync (#106763)
* Add nanogit package
* Add nanoGit feature flag
* Put logger into nanogit context
* Commit go mod and go sum updates
* Add more stuff around logging
* Nanogit also in extra one
* Add owner to dependency
2025-06-17 19:07:30 +02:00
b1c1d080e2 Internationalisation: Mark up MSSQL (#105532)
* scaffolding

* markup

* fix typos + extract translations

* update crowdin.yml

* uppercase Grafana
2025-05-20 14:39:41 +01:00
38de0cac3a Chore: Replace usages of golang.org/x/net/context with stdlib context package (#105676) 2025-05-20 14:59:40 +02:00
002f46736a refactor(unified-storage): move generated protos to own pkg (#105356) 2025-05-15 21:36:52 +02:00
4da4482ec5 Provisioning: Avoid writing 1970 date (#104912) 2025-05-14 13:24:15 +03:00
8866f2cfc1 Provisioning: Split progress on \r (#105268) 2025-05-13 10:59:08 +03:00
047499a363 Provisioning: introduce concept of provisioning extras (#104981)
* Spike: Extras

* Attempt to wire it up

* Hack

* Fix issue with jobs

* Wire more things up

* Fix more wiring stuff

* Remove webhook secret key from main registration

* Move secret encryption also outside register

* Add TODOs in code

* Add more explanations

* Move connectors to different package

* Move pull request job into webhooks

* Separate registration

* Remove duplicate files

* Fix missing function

* Extract webhook repository logic out of the core github repository

* Use status patcher in webhook connector

* Fix change in go mod

* Change hooks signature

* Remove TODOs

* Remove Webhook methos from go-git

* Remove leftover

* Fix mistake in OpenAPI spec

* Fix some tests

* Fix some issues

* Fix linting
2025-05-13 09:50:43 +02:00
8f79e4882f Replace usage of http.DefaultClient and http.DefaultTransport (#104135)
Remove usage of http.DefaultClient and http.DefaultTransport

Part of grafana/data-sources#484
2025-05-09 13:26:39 -04:00
2df2b169cc Provisioning: Require author name (#104789) 2025-04-30 19:33:21 +03:00
3b3c2e225c Provisioning: cover most cases in go-git clone (#104513)
* Add some clone tests

* Add case to create ref if it doesn't not exist

* Add unit tests for context cancellation

* Bare repository not needed

* Make tests work without git command
2025-04-30 14:05:19 +02:00
2e51096eb4 Provisioning: Export dashboards with conversion errors (#104369) 2025-04-24 14:16:25 +01:00
b09d79b21c K8s/Dashboard: Promote from alpha1 to beta1 (#104009) 2025-04-23 20:54:35 +03:00
9e9e971ab3 Provisioning: unit test and bug fixes go-git repository (#104390)
* Add unit test for unimplemented methods

* Add unit test for GoGitRepo_Read

* Add tests for Delete

* Add more tests

* Add unit test for GoGitRepo_Push

* Add unit test for ReadTree
2025-04-23 15:59:03 +03:00
c8981d91c7 Provisioning: remaining unit test coverage github repository (#104382)
* Add test for GitHubRepository_LatestRef

* Add test for GitHubRepository_LatestRef

* Add test for GitHubRepository_CommentPullRequest

* Add remaining tests for GitHubRepository

* Add remaining tests for GitHubRepository

* Fix linting
2025-04-23 13:29:21 +01:00
3923538ba4 Provisioning: Delete from repository, not the resource client on rename (#104291)
Co-authored-by: Roberto Jimenez Sanchez <roberto.jimenez@grafana.com>
2025-04-23 12:30:30 +02:00
a438b192d3 Provisioning: unit test repository/github package (#104310)
* Add unit tests IsAuthenticated

* Add unit tests RepoExists

* Add unit tests GetContents

* Add initial unit tests GetTree

* Add unit tests for CreateFile

* Add unit test UpdateFile

* Add unit tests DeleteFile

* Add unit tests for Commits

* Add unit tests for helpers

* Add unit test CompareCommits

* Add GetBranch tests

* Add unit tests BranchExists and CreateBranch

* Add unit tests Webhooks

* Remove unused code

* Add unit tests CommentPullRequest

* Add more cases for GetTree

* Complete coverage

* Fix linting
2025-04-22 18:20:29 +01:00