Feature: Add per-runner “Disable/Pause” (#36776)
This PR adds per-runner disable/enable support for Gitea Actions so a registered runner can be paused from picking up new jobs without unregistering. Disabled runners stay registered and online but are excluded from new task assignment; running tasks are allowed to finish. Re-enabling restores pickup, and runner list/get responses now expose disabled state. Also added an endpoint for testing http://localhost:3000/devtest/runner-edit/enable <img width="1509" height="701" alt="Bildschirmfoto 2026-02-27 um 22 13 24" src="https://github.com/user-attachments/assets/5328eda9-e59c-46b6-b398-f436e50ee3da" /> Fixes: https://github.com/go-gitea/gitea/issues/36767
This commit is contained in:
@@ -10,6 +10,16 @@
|
||||
<label>{{ctx.Locale.Tr "actions.runners.status"}}</label>
|
||||
<span class="ui {{if .Runner.IsOnline}}green{{else}}basic{{end}} label">{{.Runner.StatusLocaleName ctx.Locale}}</span>
|
||||
</div>
|
||||
<div class="field tw-inline-block tw-mr-4">
|
||||
<label>{{ctx.Locale.Tr "actions.runners.availability"}}</label>
|
||||
<span class="ui {{if .Runner.IsDisabled}}grey{{else}}green{{end}} label">
|
||||
{{if .Runner.IsDisabled}}
|
||||
{{ctx.Locale.Tr "disabled"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "enabled"}}
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="field tw-inline-block tw-mr-4">
|
||||
<label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label>
|
||||
<span>{{if .Runner.LastOnline}}{{DateUtils.TimeSince .Runner.LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span>
|
||||
@@ -39,6 +49,9 @@
|
||||
|
||||
<div class="field">
|
||||
<button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button>
|
||||
<button type="button" class="ui button link-action" data-url="{{.Link}}/update-runner?disabled={{not .Runner.IsDisabled}}">
|
||||
{{if .Runner.IsDisabled}}{{ctx.Locale.Tr "actions.runners.enable_runner"}}{{else}}{{ctx.Locale.Tr "actions.runners.disable_runner"}}{{end}}
|
||||
</button>
|
||||
<button class="ui red button delete-button" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal">
|
||||
{{ctx.Locale.Tr "actions.runners.delete_runner"}}</button>
|
||||
</div>
|
||||
|
||||
@@ -66,7 +66,10 @@
|
||||
<tbody>
|
||||
{{range .Runners}}
|
||||
<tr>
|
||||
<td><span class="ui label {{if .IsOnline}}green{{end}}">{{.StatusLocaleName ctx.Locale}}</span></td>
|
||||
<td>
|
||||
<span class="ui label {{if .IsOnline}}green{{end}}">{{.StatusLocaleName ctx.Locale}}</span>
|
||||
{{if .IsDisabled}}<span class="ui grey label">{{ctx.Locale.Tr "actions.runners.disabled"}}</span>{{end}}
|
||||
</td>
|
||||
<td>{{.ID}}</td>
|
||||
<td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td>
|
||||
<td>{{if .Version}}{{.Version}}{{else}}{{ctx.Locale.Tr "unknown"}}{{end}}</td>
|
||||
|
||||
Generated
+243
-4
@@ -76,6 +76,14 @@
|
||||
],
|
||||
"summary": "Get all runners",
|
||||
"operationId": "getAdminRunners",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter by disabled status (true or false)",
|
||||
"name": "disabled",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunnersResponse"
|
||||
@@ -166,6 +174,49 @@
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"summary": "Update a global runner",
|
||||
"operationId": "updateAdminRunner",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id of the runner",
|
||||
"name": "runner_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/EditActionRunnerOption"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunner"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/actions/runs": {
|
||||
@@ -1947,6 +1998,12 @@
|
||||
"name": "org",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter by disabled status (true or false)",
|
||||
"name": "disabled",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -2062,6 +2119,56 @@
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"organization"
|
||||
],
|
||||
"summary": "Update an org-level runner",
|
||||
"operationId": "updateOrgRunner",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the organization",
|
||||
"name": "org",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id of the runner",
|
||||
"name": "runner_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/EditActionRunnerOption"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunner"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org}/actions/runs": {
|
||||
@@ -4872,6 +4979,12 @@
|
||||
"name": "repo",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter by disabled status (true or false)",
|
||||
"name": "disabled",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -4928,7 +5041,7 @@
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get an repo-level runner",
|
||||
"summary": "Get a repo-level runner",
|
||||
"operationId": "getRepoRunner",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -4972,7 +5085,7 @@
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Delete an repo-level runner",
|
||||
"summary": "Delete a repo-level runner",
|
||||
"operationId": "deleteRepoRunner",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -5008,6 +5121,63 @@
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Update a repo-level runner",
|
||||
"operationId": "updateRepoRunner",
|
||||
"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
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id of the runner",
|
||||
"name": "runner_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/EditActionRunnerOption"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunner"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/actions/runs": {
|
||||
@@ -18441,6 +18611,14 @@
|
||||
],
|
||||
"summary": "Get user-level runners",
|
||||
"operationId": "getUserRunners",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "filter by disabled status (true or false)",
|
||||
"name": "disabled",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunnersResponse"
|
||||
@@ -18479,7 +18657,7 @@
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Get an user-level runner",
|
||||
"summary": "Get a user-level runner",
|
||||
"operationId": "getUserRunner",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -18509,7 +18687,7 @@
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Delete an user-level runner",
|
||||
"summary": "Delete a user-level runner",
|
||||
"operationId": "deleteUserRunner",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -18531,6 +18709,49 @@
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Update a user-level runner",
|
||||
"operationId": "updateUserRunner",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "id of the runner",
|
||||
"name": "runner_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/EditActionRunnerOption"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/definitions/ActionRunner"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
},
|
||||
"422": {
|
||||
"$ref": "#/responses/validationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/actions/runs": {
|
||||
@@ -21115,6 +21336,10 @@
|
||||
"type": "boolean",
|
||||
"x-go-name": "Busy"
|
||||
},
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Disabled"
|
||||
},
|
||||
"ephemeral": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Ephemeral"
|
||||
@@ -24205,6 +24430,20 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"EditActionRunnerOption": {
|
||||
"type": "object",
|
||||
"title": "EditActionRunnerOption represents the editable fields for a runner.",
|
||||
"required": [
|
||||
"disabled"
|
||||
],
|
||||
"properties": {
|
||||
"disabled": {
|
||||
"type": "boolean",
|
||||
"x-go-name": "Disabled"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"EditAttachmentOptions": {
|
||||
"description": "EditAttachmentOptions options for editing attachments",
|
||||
"type": "object",
|
||||
|
||||
Reference in New Issue
Block a user