Remove API registration-token (#36801)
Replace #36793 --------- Co-authored-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
@@ -10,21 +10,6 @@ import (
|
|||||||
|
|
||||||
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
||||||
|
|
||||||
// GetRegistrationToken returns the token to register global runners
|
|
||||||
func GetRegistrationToken(ctx *context.APIContext) {
|
|
||||||
// swagger:operation GET /admin/runners/registration-token admin adminGetRunnerRegistrationToken
|
|
||||||
// ---
|
|
||||||
// summary: Get a global actions runner registration token
|
|
||||||
// produces:
|
|
||||||
// - application/json
|
|
||||||
// parameters:
|
|
||||||
// responses:
|
|
||||||
// "200":
|
|
||||||
// "$ref": "#/responses/RegistrationToken"
|
|
||||||
|
|
||||||
shared.GetRegistrationToken(ctx, 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegistrationToken returns the token to register global runners
|
// CreateRegistrationToken returns the token to register global runners
|
||||||
func CreateRegistrationToken(ctx *context.APIContext) {
|
func CreateRegistrationToken(ctx *context.APIContext) {
|
||||||
// swagger:operation POST /admin/actions/runners/registration-token admin adminCreateRunnerRegistrationToken
|
// swagger:operation POST /admin/actions/runners/registration-token admin adminCreateRunnerRegistrationToken
|
||||||
|
|||||||
@@ -917,7 +917,6 @@ func Routes() *web.Router {
|
|||||||
|
|
||||||
m.Group("/runners", func() {
|
m.Group("/runners", func() {
|
||||||
m.Get("", reqToken(), reqChecker, act.ListRunners)
|
m.Get("", reqToken(), reqChecker, act.ListRunners)
|
||||||
m.Get("/registration-token", reqToken(), reqChecker, act.GetRegistrationToken)
|
|
||||||
m.Post("/registration-token", reqToken(), reqChecker, act.CreateRegistrationToken)
|
m.Post("/registration-token", reqToken(), reqChecker, act.CreateRegistrationToken)
|
||||||
m.Get("/{runner_id}", reqToken(), reqChecker, act.GetRunner)
|
m.Get("/{runner_id}", reqToken(), reqChecker, act.GetRunner)
|
||||||
m.Delete("/{runner_id}", reqToken(), reqChecker, act.DeleteRunner)
|
m.Delete("/{runner_id}", reqToken(), reqChecker, act.DeleteRunner)
|
||||||
@@ -1045,7 +1044,6 @@ func Routes() *web.Router {
|
|||||||
|
|
||||||
m.Group("/runners", func() {
|
m.Group("/runners", func() {
|
||||||
m.Get("", reqToken(), user.ListRunners)
|
m.Get("", reqToken(), user.ListRunners)
|
||||||
m.Get("/registration-token", reqToken(), user.GetRegistrationToken)
|
|
||||||
m.Post("/registration-token", reqToken(), user.CreateRegistrationToken)
|
m.Post("/registration-token", reqToken(), user.CreateRegistrationToken)
|
||||||
m.Get("/{runner_id}", reqToken(), user.GetRunner)
|
m.Get("/{runner_id}", reqToken(), user.GetRunner)
|
||||||
m.Delete("/{runner_id}", reqToken(), user.DeleteRunner)
|
m.Delete("/{runner_id}", reqToken(), user.DeleteRunner)
|
||||||
@@ -1734,9 +1732,6 @@ func Routes() *web.Router {
|
|||||||
m.Get("/runs", admin.ListWorkflowRuns)
|
m.Get("/runs", admin.ListWorkflowRuns)
|
||||||
m.Get("/jobs", admin.ListWorkflowJobs)
|
m.Get("/jobs", admin.ListWorkflowJobs)
|
||||||
})
|
})
|
||||||
m.Group("/runners", func() {
|
|
||||||
m.Get("/registration-token", admin.GetRegistrationToken)
|
|
||||||
})
|
|
||||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryAdmin), reqToken(), reqSiteAdmin())
|
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryAdmin), reqToken(), reqSiteAdmin())
|
||||||
|
|
||||||
m.Group("/topics", func() {
|
m.Group("/topics", func() {
|
||||||
|
|||||||
@@ -170,27 +170,6 @@ func (Action) DeleteSecret(ctx *context.APIContext) {
|
|||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
|
||||||
// GetRegistrationToken returns the token to register org runners
|
|
||||||
func (Action) GetRegistrationToken(ctx *context.APIContext) {
|
|
||||||
// swagger:operation GET /orgs/{org}/actions/runners/registration-token organization orgGetRunnerRegistrationToken
|
|
||||||
// ---
|
|
||||||
// summary: Get an organization's actions runner registration token
|
|
||||||
// produces:
|
|
||||||
// - application/json
|
|
||||||
// parameters:
|
|
||||||
// - name: org
|
|
||||||
// in: path
|
|
||||||
// description: name of the organization
|
|
||||||
// type: string
|
|
||||||
// required: true
|
|
||||||
// responses:
|
|
||||||
// "200":
|
|
||||||
// "$ref": "#/responses/RegistrationToken"
|
|
||||||
|
|
||||||
shared.GetRegistrationToken(ctx, ctx.Org.Organization.ID, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
||||||
// CreateRegistrationToken returns the token to register org runners
|
// CreateRegistrationToken returns the token to register org runners
|
||||||
func (Action) CreateRegistrationToken(ctx *context.APIContext) {
|
func (Action) CreateRegistrationToken(ctx *context.APIContext) {
|
||||||
|
|||||||
@@ -510,31 +510,6 @@ func (Action) ListVariables(ctx *context.APIContext) {
|
|||||||
ctx.JSON(http.StatusOK, variables)
|
ctx.JSON(http.StatusOK, variables)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRegistrationToken returns the token to register repo runners
|
|
||||||
func (Action) GetRegistrationToken(ctx *context.APIContext) {
|
|
||||||
// swagger:operation GET /repos/{owner}/{repo}/actions/runners/registration-token repository repoGetRunnerRegistrationToken
|
|
||||||
// ---
|
|
||||||
// summary: Get a repository's actions runner registration token
|
|
||||||
// produces:
|
|
||||||
// - application/json
|
|
||||||
// parameters:
|
|
||||||
// - name: owner
|
|
||||||
// in: path
|
|
||||||
// description: owner of the repo
|
|
||||||
// type: string
|
|
||||||
// required: true
|
|
||||||
// - name: repo
|
|
||||||
// in: path
|
|
||||||
// description: name of the repo
|
|
||||||
// type: string
|
|
||||||
// required: true
|
|
||||||
// responses:
|
|
||||||
// "200":
|
|
||||||
// "$ref": "#/responses/RegistrationToken"
|
|
||||||
|
|
||||||
shared.GetRegistrationToken(ctx, 0, ctx.Repo.Repository.ID)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegistrationToken returns the token to register repo runners
|
// CreateRegistrationToken returns the token to register repo runners
|
||||||
func (Action) CreateRegistrationToken(ctx *context.APIContext) {
|
func (Action) CreateRegistrationToken(ctx *context.APIContext) {
|
||||||
// swagger:operation POST /repos/{owner}/{repo}/actions/runners/registration-token repository repoCreateRunnerRegistrationToken
|
// swagger:operation POST /repos/{owner}/{repo}/actions/runners/registration-token repository repoCreateRunnerRegistrationToken
|
||||||
|
|||||||
@@ -10,21 +10,6 @@ import (
|
|||||||
|
|
||||||
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
|
||||||
|
|
||||||
// GetRegistrationToken returns the token to register user runners
|
|
||||||
func GetRegistrationToken(ctx *context.APIContext) {
|
|
||||||
// swagger:operation GET /user/actions/runners/registration-token user userGetRunnerRegistrationToken
|
|
||||||
// ---
|
|
||||||
// summary: Get an user's actions runner registration token
|
|
||||||
// produces:
|
|
||||||
// - application/json
|
|
||||||
// parameters:
|
|
||||||
// responses:
|
|
||||||
// "200":
|
|
||||||
// "$ref": "#/responses/RegistrationToken"
|
|
||||||
|
|
||||||
shared.GetRegistrationToken(ctx, ctx.Doer.ID, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateRegistrationToken returns the token to register user runners
|
// CreateRegistrationToken returns the token to register user runners
|
||||||
func CreateRegistrationToken(ctx *context.APIContext) {
|
func CreateRegistrationToken(ctx *context.APIContext) {
|
||||||
// swagger:operation POST /user/actions/runners/registration-token user userCreateRunnerRegistrationToken
|
// swagger:operation POST /user/actions/runners/registration-token user userCreateRunnerRegistrationToken
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ type API interface {
|
|||||||
CreateVariable(*context.APIContext)
|
CreateVariable(*context.APIContext)
|
||||||
// UpdateVariable update a variable
|
// UpdateVariable update a variable
|
||||||
UpdateVariable(*context.APIContext)
|
UpdateVariable(*context.APIContext)
|
||||||
// GetRegistrationToken get registration token
|
|
||||||
GetRegistrationToken(*context.APIContext)
|
|
||||||
// CreateRegistrationToken get registration token
|
// CreateRegistrationToken get registration token
|
||||||
CreateRegistrationToken(*context.APIContext)
|
CreateRegistrationToken(*context.APIContext)
|
||||||
// ListRunners list runners
|
// ListRunners list runners
|
||||||
|
|||||||
Generated
-87
@@ -564,23 +564,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/admin/runners/registration-token": {
|
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"admin"
|
|
||||||
],
|
|
||||||
"summary": "Get a global actions runner registration token",
|
|
||||||
"operationId": "adminGetRunnerRegistrationToken",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"$ref": "#/responses/RegistrationToken"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/admin/unadopted": {
|
"/admin/unadopted": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
@@ -1980,30 +1963,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/orgs/{org}/actions/runners/registration-token": {
|
"/orgs/{org}/actions/runners/registration-token": {
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"organization"
|
|
||||||
],
|
|
||||||
"summary": "Get an organization's actions runner registration token",
|
|
||||||
"operationId": "orgGetRunnerRegistrationToken",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "name of the organization",
|
|
||||||
"name": "org",
|
|
||||||
"in": "path",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"$ref": "#/responses/RegistrationToken"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
"post": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -4929,37 +4888,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/repos/{owner}/{repo}/actions/runners/registration-token": {
|
"/repos/{owner}/{repo}/actions/runners/registration-token": {
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"repository"
|
|
||||||
],
|
|
||||||
"summary": "Get a repository's actions runner registration token",
|
|
||||||
"operationId": "repoGetRunnerRegistrationToken",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "owner of the repo",
|
|
||||||
"name": "owner",
|
|
||||||
"in": "path",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "name of the repo",
|
|
||||||
"name": "repo",
|
|
||||||
"in": "path",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"$ref": "#/responses/RegistrationToken"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
"post": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
@@ -18416,21 +18344,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/user/actions/runners/registration-token": {
|
"/user/actions/runners/registration-token": {
|
||||||
"get": {
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"user"
|
|
||||||
],
|
|
||||||
"summary": "Get an user's actions runner registration token",
|
|
||||||
"operationId": "userGetRunnerRegistrationToken",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"$ref": "#/responses/RegistrationToken"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"post": {
|
"post": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func (r *mockRunner) doRegister(t *testing.T, name, token string, labels []strin
|
|||||||
func (r *mockRunner) registerAsRepoRunner(t *testing.T, ownerName, repoName, runnerName string, labels []string, ephemeral bool) {
|
func (r *mockRunner) registerAsRepoRunner(t *testing.T, ownerName, repoName, runnerName string, labels []string, ephemeral bool) {
|
||||||
session := loginUser(t, ownerName)
|
session := loginUser(t, ownerName)
|
||||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
|
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
|
||||||
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/actions/runners/registration-token", ownerName, repoName)).AddTokenAuth(token)
|
req := NewRequest(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/actions/runners/registration-token", ownerName, repoName)).AddTokenAuth(token)
|
||||||
resp := MakeRequest(t, req, http.StatusOK)
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
var registrationToken struct {
|
var registrationToken struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
|||||||
Reference in New Issue
Block a user