aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorYarden Shoham <hrsi88@gmail.com>2023-02-28 14:42:40 +0200
committerGitHub <noreply@github.com>2023-02-28 13:42:40 +0100
commit6c6a7e7d974840f075817f960fa664645f7d1213 (patch)
tree3ab731fac9dba39c1c9e5137294456cf2b856602 /routers
parent111c5092878c1701909d89fd1075262cf415d6f2 (diff)
downloadgitea-6c6a7e7d974840f075817f960fa664645f7d1213.tar.gz
gitea-6c6a7e7d974840f075817f960fa664645f7d1213.zip
Avoid too long names for actions (#23162) (#23190)
Backport #23162 The name of the job or step comes from the workflow file, while the name of the runner comes from its registration. If the strings used for these names are too long, they could cause db issues. Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/actions/runner/runner.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/api/actions/runner/runner.go b/routers/api/actions/runner/runner.go
index 7dbab9da0a..d0bfb2363e 100644
--- a/routers/api/actions/runner/runner.go
+++ b/routers/api/actions/runner/runner.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/modules/actions"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/util"
actions_service "code.gitea.io/gitea/services/actions"
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
@@ -55,9 +56,10 @@ func (s *Service) Register(
}
// create new runner
+ name, _ := util.SplitStringAtByteN(req.Msg.Name, 255)
runner := &actions_model.ActionRunner{
UUID: gouuid.New().String(),
- Name: req.Msg.Name,
+ Name: name,
OwnerID: runnerToken.OwnerID,
RepoID: runnerToken.RepoID,
AgentLabels: req.Msg.AgentLabels,