From 9177e52cf4c6fe725139d264da223b92189ce817 Mon Sep 17 00:00:00 2001 From: Andreas Ahlenstorf Date: Thu, 12 Mar 2026 16:12:18 +0100 Subject: [PATCH] chore: deprecate HTTP API endpoints for obtaining the runner registration token (#11650) Forgejo Runner is deprecating the runner registration token. It is too powerful, requires tooling, and is unnecessary. https://codeberg.org/forgejo/forgejo/pulls/10677 added an HTTP API for runner registration. https://codeberg.org/forgejo/forgejo/pulls/11516 added the ability to manage runners using Forgejo's web interface and marked the runner registration token in the UI as deprecated. This PR deprecates the HTTP endpoints for obtaining the runner registration token by updating the API documentation. The implementation and all the tests remain in place and untouched. See https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/88 for context. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests for Go changes (can be removed for JavaScript changes) - I added test coverage for Go changes... - [ ] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [x] `make pr-go` before pushing ### Tests for JavaScript changes (can be removed for Go changes) - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. *The decision if the pull request will be shown in the release notes is up to the mergers / release team.* The content of the `release-notes/.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11650 Reviewed-by: Mathieu Fenniak Co-authored-by: Andreas Ahlenstorf Co-committed-by: Andreas Ahlenstorf --- routers/api/v1/admin/runners.go | 10 ++++++++-- routers/api/v1/api.go | 4 ++-- routers/api/v1/org/action.go | 8 +++++++- routers/api/v1/repo/action.go | 6 ++++++ routers/api/v1/user/runners.go | 6 ++++++ templates/swagger/v1_json.tmpl | 10 +++++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/routers/api/v1/admin/runners.go b/routers/api/v1/admin/runners.go index 81c029c57c..db62979b62 100644 --- a/routers/api/v1/admin/runners.go +++ b/routers/api/v1/admin/runners.go @@ -9,10 +9,16 @@ import ( ) // GetRunnerRegistrationToken returns a token to register global runners +// +// Deprecated: This operation has been deprecated in Forgejo 15. Use the web UI or RegisterRunner instead. func GetRunnerRegistrationToken(ctx *context.APIContext) { // swagger:operation GET /admin/actions/runners/registration-token admin adminGetRunnerRegistrationToken // --- // summary: Get a runner registration token for registering global runners + // description: > + // This operation has been deprecated in Forgejo 15. + // Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead. + // deprecated: true // produces: // - application/json // parameters: @@ -25,14 +31,14 @@ func GetRunnerRegistrationToken(ctx *context.APIContext) { // GetRegistrationToken returns the token to register global runners // -// Deprecated: This operation has been deprecated in Forgejo 15. Use GetRunnerRegistrationToken instead. +// Deprecated: This operation has been deprecated in Forgejo 15. Use the web UI or RegisterRunner instead. func GetRegistrationToken(ctx *context.APIContext) { // swagger:operation GET /admin/runners/registration-token admin adminGetRegistrationToken // --- // summary: Get a runner registration token for registering global runners // description: > // This operation has been deprecated in Forgejo 15. - // Use [`/admin/actions/runners/registration-token`](#/admin/adminGetRunnerRegistrationToken) instead. + // Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead. // deprecated: true // produces: // - application/json diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index ce013e7fdb..f551f20c6a 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -1010,7 +1010,7 @@ func Routes() *web.Route { m.Combo(""). Get(reqToken(), user.ListRunners). Post(bind(api.RegisterRunnerOptions{}), user.RegisterRunner) - m.Get("/registration-token", reqToken(), user.GetRegistrationToken) + m.Get("/registration-token", reqToken(), user.GetRegistrationToken) //nolint:staticcheck m.Get("/{runner_id}", reqToken(), user.GetRunner) m.Delete("/{runner_id}", reqToken(), user.DeleteRunner) m.Get("/jobs", reqToken(), user.SearchActionRunJobs) @@ -1694,7 +1694,7 @@ func Routes() *web.Route { m.Combo(""). Get(admin.ListRunners). Post(bind(api.RegisterRunnerOptions{}), admin.RegisterRunner) - m.Get("/registration-token", admin.GetRunnerRegistrationToken) + m.Get("/registration-token", admin.GetRunnerRegistrationToken) //nolint:staticcheck m.Get("/{runner_id}", admin.GetRunner) m.Delete("/{runner_id}", admin.DeleteRunner) m.Get("/jobs", admin.GetActionRunJobs) diff --git a/routers/api/v1/org/action.go b/routers/api/v1/org/action.go index dac6704d4b..6036d476f7 100644 --- a/routers/api/v1/org/action.go +++ b/routers/api/v1/org/action.go @@ -168,11 +168,17 @@ func (Action) DeleteSecret(ctx *context.APIContext) { ctx.Status(http.StatusNoContent) } -// GetRegistrationToken returns the organization's runner registration token +// GetRegistrationToken returns the organization's runner registration token. +// +// Deprecated: This operation has been deprecated in Forgejo 15. Use the web UI or RegisterRunner instead. func (Action) GetRegistrationToken(ctx *context.APIContext) { // swagger:operation GET /orgs/{org}/actions/runners/registration-token organization orgGetRunnerRegistrationToken // --- // summary: Get the organization's runner registration token + // description: > + // This operation has been deprecated in Forgejo 15. + // Use the web UI or [`/orgs/{org}/actions/runners`](#/organization/registerOrgRunner) instead. + // deprecated: true // produces: // - application/json // parameters: diff --git a/routers/api/v1/repo/action.go b/routers/api/v1/repo/action.go index ab049e4383..94a25a088f 100644 --- a/routers/api/v1/repo/action.go +++ b/routers/api/v1/repo/action.go @@ -482,10 +482,16 @@ func (Action) ListVariables(ctx *context.APIContext) { } // GetRegistrationToken returns the runner registration token to register runners for the repository +// +// Deprecated: This operation has been deprecated in Forgejo 15. Use the web UI or RegisterRunner instead. func (Action) GetRegistrationToken(ctx *context.APIContext) { // swagger:operation GET /repos/{owner}/{repo}/actions/runners/registration-token repository repoGetRunnerRegistrationToken // --- // summary: Get a repository's runner registration token + // description: > + // This operation has been deprecated in Forgejo 15. + // Use the web UI or [`/repos/{owner}/{repo}/actions/runners`](#/repository/registerRepoRunner) instead. + // deprecated: true // produces: // - application/json // parameters: diff --git a/routers/api/v1/user/runners.go b/routers/api/v1/user/runners.go index 340233f27d..29bf13b982 100644 --- a/routers/api/v1/user/runners.go +++ b/routers/api/v1/user/runners.go @@ -9,10 +9,16 @@ import ( ) // GetRegistrationToken returns a token to register user-level runners +// +// Deprecated: This operation has been deprecated in Forgejo 15. Use the web UI or RegisterRunner instead. func GetRegistrationToken(ctx *context.APIContext) { // swagger:operation GET /user/actions/runners/registration-token user userGetRunnerRegistrationToken // --- // summary: Get the user's runner registration token + // description: > + // This operation has been deprecated in Forgejo 15. + // Use the web UI or [`/user/actions/runners`](#/user/registerUserRunner) instead. + // deprecated: true // produces: // - application/json // parameters: diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 7a800cc171..08bd72ef60 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -414,6 +414,7 @@ }, "/admin/actions/runners/registration-token": { "get": { + "description": "This operation has been deprecated in Forgejo 15. Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead.\n", "produces": [ "application/json" ], @@ -422,6 +423,7 @@ ], "summary": "Get a runner registration token for registering global runners", "operationId": "adminGetRunnerRegistrationToken", + "deprecated": true, "responses": { "200": { "$ref": "#/responses/RegistrationToken" @@ -1347,7 +1349,7 @@ }, "/admin/runners/registration-token": { "get": { - "description": "This operation has been deprecated in Forgejo 15. Use [`/admin/actions/runners/registration-token`](#/admin/adminGetRunnerRegistrationToken) instead.\n", + "description": "This operation has been deprecated in Forgejo 15. Use the web UI or [`/admin/actions/runners`](#/admin/registerAdminRunner) instead.\n", "produces": [ "application/json" ], @@ -2833,6 +2835,7 @@ }, "/orgs/{org}/actions/runners/registration-token": { "get": { + "description": "This operation has been deprecated in Forgejo 15. Use the web UI or [`/orgs/{org}/actions/runners`](#/organization/registerOrgRunner) instead.\n", "produces": [ "application/json" ], @@ -2841,6 +2844,7 @@ ], "summary": "Get the organization's runner registration token", "operationId": "orgGetRunnerRegistrationToken", + "deprecated": true, "parameters": [ { "type": "string", @@ -5583,6 +5587,7 @@ }, "/repos/{owner}/{repo}/actions/runners/registration-token": { "get": { + "description": "This operation has been deprecated in Forgejo 15. Use the web UI or [`/repos/{owner}/{repo}/actions/runners`](#/repository/registerRepoRunner) instead.\n", "produces": [ "application/json" ], @@ -5591,6 +5596,7 @@ ], "summary": "Get a repository's runner registration token", "operationId": "repoGetRunnerRegistrationToken", + "deprecated": true, "parameters": [ { "type": "string", @@ -19086,6 +19092,7 @@ }, "/user/actions/runners/registration-token": { "get": { + "description": "This operation has been deprecated in Forgejo 15. Use the web UI or [`/user/actions/runners`](#/user/registerUserRunner) instead.\n", "produces": [ "application/json" ], @@ -19094,6 +19101,7 @@ ], "summary": "Get the user's runner registration token", "operationId": "userGetRunnerRegistrationToken", + "deprecated": true, "responses": { "200": { "$ref": "#/responses/RegistrationToken"