feat: implement Runner Controller API
Relates to issue #2190
Changes
This MR implements comprehensive support for the GitLab Runner Controller API, adding two new services to the client library.
New Services
-
RunnerControllersService - Manages runner controllers
-
ListRunnerControllers()- List all runner controllers with pagination support -
GetRunnerController()- Get a specific runner controller by ID -
CreateRunnerController()- Create a new runner controller -
UpdateRunnerController()- Update an existing runner controller -
DeleteRunnerController()- Delete a runner controller
-
-
RunnerControllerTokensService - Manages runner controller authentication tokens
-
ListRunnerControllerTokens()- List tokens for a runner controller -
GetRunnerControllerToken()- Get a specific token by ID -
CreateRunnerControllerToken()- Create a new authentication token -
RevokeRunnerControllerToken()- Revoke an existing token
-
Implementation Details
- All endpoints are admin-only (documented in godoc comments)
- Follows existing patterns from
cluster_agents.gousing the newdofunction approach - Uses
int64for runner controller IDs (passed directly towithPath) - Single
type()block for interface and service definitions - Comprehensive test coverage using testify assertions
- Interface assertions for both services
- Pagination support via
ListOptionsfor list endpoints - Token visibility handled correctly (token value only in create response)
- Proper HTTP methods (GET, POST, PUT, DELETE)
- Correct terminology: "Delete" for controllers, "Revoke" for tokens
Files Added
-
runner_controllers.go- RunnerControllersService implementation -
runner_controller_tokens.go- RunnerControllerTokensService implementation -
runner_controllers_test.go- Tests for controller operations -
runner_controller_tokens_test.go- Tests for token operations
Files Modified
-
gitlab.go- Added service fields and initialization for both new services -
gitlab_service_map_generated_test.go- Added service interface mappings -
testing/api_generated.go- Added mock generation directives -
testing/client_generated.go- Added mock fields and instantiations
Note
Documentation is not yet available in the official GitLab API docs. See gitlab-org/gitlab#581275 for tracking.
Edited by Timo Furrer