mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
refactor: update Actions Runner admin API endpoint URLs to be consistent w/ other levels (#10573)
Align the URLs of admin API endpoints for runner management with other levels like organizations. It enables using the same URL schema (`/actions/runners`) for managing all kinds of runners. The old API endpoints that use `/admin/runners` have been deprecated but are retained for compatibility reasons for the foreseeable future. ## 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 - I added test coverage for Go changes... - [ ] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - 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 - [ ] I do not want this change to show in the release notes. - [x] I want the title to show in the release notes with a link to this pull request. - [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Other changes without a feature or bug label - [PR](https://codeberg.org/forgejo/forgejo/pulls/10573): <!--number 10573 --><!--line 0 --><!--description cmVmYWN0b3I6IHVwZGF0ZSBBY3Rpb25zIFJ1bm5lciBhZG1pbiBBUEkgZW5kcG9pbnQgVVJMcyB0byBiZSBjb25zaXN0ZW50IHcvIG90aGVyIGxldmVscw==-->refactor: update Actions Runner admin API endpoint URLs to be consistent w/ other levels<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10573 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch> Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
This commit is contained in:
parent
71623b1ab1
commit
49c3b3f70e
4 changed files with 221 additions and 68 deletions
|
|
@ -8,9 +8,9 @@ import (
|
|||
"forgejo.org/services/context"
|
||||
)
|
||||
|
||||
// GetRegistrationToken returns the token to register global runners
|
||||
func GetRegistrationToken(ctx *context.APIContext) {
|
||||
// swagger:operation GET /admin/runners/registration-token admin adminGetRunnerRegistrationToken
|
||||
// GetRunnerRegistrationToken returns a token to register global runners
|
||||
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
|
||||
// produces:
|
||||
|
|
@ -23,11 +23,58 @@ func GetRegistrationToken(ctx *context.APIContext) {
|
|||
shared.GetRegistrationToken(ctx, 0, 0)
|
||||
}
|
||||
|
||||
// SearchActionRunJobs return a list of actions jobs filtered by the provided parameters
|
||||
// GetRegistrationToken returns the token to register global runners
|
||||
//
|
||||
// Deprecated: This operation has been deprecated in Forgejo 15. Use GetRunnerRegistrationToken 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.
|
||||
// deprecated: true
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RegistrationToken"
|
||||
|
||||
shared.GetRegistrationToken(ctx, 0, 0)
|
||||
}
|
||||
|
||||
// GetActionRunJobs returns a list of action run jobs
|
||||
func GetActionRunJobs(ctx *context.APIContext) {
|
||||
// swagger:operation GET /admin/actions/runners/jobs admin adminGetActionRunJobs
|
||||
// ---
|
||||
// summary: Get action run jobs
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: labels
|
||||
// in: query
|
||||
// description: a comma separated list of labels to search for
|
||||
// type: string
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RunJobList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
shared.GetActionRunJobs(ctx, 0, 0)
|
||||
}
|
||||
|
||||
// SearchActionRunJobs returns a list of actions jobs filtered by the provided parameters
|
||||
//
|
||||
// Deprecated: This operation has been deprecated in Forgejo 15. Use GetActionRunJobs instead.
|
||||
func SearchActionRunJobs(ctx *context.APIContext) {
|
||||
// swagger:operation GET /admin/runners/jobs admin adminSearchRunJobs
|
||||
// ---
|
||||
// summary: Search action jobs according to filter conditions
|
||||
// description: >
|
||||
// This operation has been deprecated in Forgejo 15.
|
||||
// Use [`/admin/actions/runners/jobs`](#/admin/adminGetActionRunJobs) instead.
|
||||
// deprecated: true
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
|
|
|||
|
|
@ -1702,13 +1702,14 @@ func Routes() *web.Route {
|
|||
})
|
||||
m.Group("/actions/runners", func() {
|
||||
m.Get("", admin.ListRunners)
|
||||
m.Get("/registration-token", admin.GetRegistrationToken)
|
||||
m.Get("/registration-token", admin.GetRunnerRegistrationToken)
|
||||
m.Get("/{runner_id}", admin.GetRunner)
|
||||
m.Delete("/{runner_id}", admin.DeleteRunner)
|
||||
m.Get("/jobs", admin.GetActionRunJobs)
|
||||
})
|
||||
m.Group("/runners", func() {
|
||||
m.Get("/registration-token", admin.GetRegistrationToken)
|
||||
m.Get("/jobs", admin.SearchActionRunJobs)
|
||||
m.Get("/registration-token", admin.GetRegistrationToken) //nolint:staticcheck
|
||||
m.Get("/jobs", admin.SearchActionRunJobs) //nolint:staticcheck
|
||||
})
|
||||
if setting.Quota.Enabled {
|
||||
m.Group("/quota", func() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue