* feat(provisioning): add /connections/{name}/repositories endpoint
Add a new subresource endpoint to list external repositories from git
providers (GitHub, GitLab, Bitbucket) accessible through a connection.
Changes:
- Add ExternalRepositoryList and ExternalRepository types with Name, Owner, and URL fields
- Create connection_repositories.go connector (returns 'not implemented' for now)
- Register storage and authorization for the repositories subresource
- Update OpenAPI documentation
- Regenerate code (deepcopy, openapi, client)
The endpoint is accessible at /apis/provisioning.grafana.app/v0alpha1/namespaces/{namespace}/connections/{name}/repositories
and requires admin read access.
Related: #TBD
* test(provisioning): add unit and integration tests for connection repositories endpoint
- Add unit tests for connection_repositories connector
- Add integration tests for authorization and endpoint behavior
- Tests verify not implemented response and proper authorization
* Fix generation
* fix(tests): fix test compilation and assertions
- Remove unused import in unit test
- Fix integration test Raw() usage
- Fix ExternalRepositoryList type verification test
* Format code
* fix(provisioning): fix ineffectual assignment in connection_repositories connector
- Add debug log statement to use logger variable
- Fixes linter error about ineffectual assignment to ctx
This folder contains a rendered OpenAPI file for each group/version. The “real” OpenAPI is generated by the running server, but the files here are used to build static frontend clients.
Generating RTK API Clients
The RTK API clients are generated from processed OpenAPI files using the scripts/process-specs.ts script. The source files are in pkg/tests/apis/openapi_snapshots, and the processed files are stored in the data/openapi directory. Spec processing happens as part of yarn generate-apis task, but can also be triggered separately (see below).
To generate or update the RTK API clients:
-
If generating or updating an RTK client for the first time, update
scripts/generate-rtk-apis.jssoschemaFilepoints to the processed spec files, for example:'../public/app/features/dashboards/api/endpoints.gen.ts': { schemaFile: '../data/openapi/dashboard.grafana.app-v0alpha1.json', }, -
Generate or update the OpenAPI spec files by running:
go test pkg/tests/apis/openapi_test.goIf generating an RTK client for a new API, also add a new group/version of the API to the
groupsslice. If the API is behind a feature toggle, add the toggle toEnableFeatureTogglesinpkg/tests/apis/openapi_test.go. -
Run:
yarn generate-apisThis command generates (or updates) the spec files in the
data/openapidirectory and generates the RTK API clients.
If you want to process the OpenAPI files without generating the RTK API clients (for example, if you have a separate generate-rtk-apis file), run:
yarn process-specs