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

  1. 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
  2. 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.go using the new do function approach
  • Uses int64 for runner controller IDs (passed directly to withPath)
  • Single type() block for interface and service definitions
  • Comprehensive test coverage using testify assertions
  • Interface assertions for both services
  • Pagination support via ListOptions for 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

Merge request reports

Loading