From f57e6999a251fa70372d321726758341a54d9031 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 17 Nov 2022 19:37:29 +0800 Subject: [PATCH] Remove unused file --- routers/api/bots/runner/runner.go | 2 +- services/bots/bots.go | 55 ------------------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 services/bots/bots.go diff --git a/routers/api/bots/runner/runner.go b/routers/api/bots/runner/runner.go index d5e5f17da1..873b502a7f 100644 --- a/routers/api/bots/runner/runner.go +++ b/routers/api/bots/runner/runner.go @@ -202,7 +202,7 @@ func (s *Service) UpdateTask( Creator: creator, CommitStatus: &git_model.CommitStatus{ SHA: payload.HeadCommit.ID, - TargetURL: fmt.Sprintf("%s/builds/runs/%d", task.Job.Run.Repo.HTMLURL(), task.Job.Run.ID), + TargetURL: task.Job.Run.HTMLURL(), Description: "", Context: task.Job.Name, CreatorID: payload.Pusher.ID, diff --git a/services/bots/bots.go b/services/bots/bots.go deleted file mode 100644 index 64d151ea19..0000000000 --- a/services/bots/bots.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Gitea. All rights reserved. -// Use of this source code is governed by a MIT-style -// license that can be found in the LICENSE file. - -package bots - -//"code.gitea.io/gitea/modules/json" - -/* -// buildQueue is a global queue of bot build -var buildQueue queue.Queue - -// PushToQueue -func PushToQueue(task *bots_model.Build) { - buildQueue.Push(task) -} - -// Dispatch assign a task to a runner -func Dispatch(task *bots_model.Build) (*bots_model.Runner, error) { - runner, err := bots_model.GetUsableRunner(bots_model.FindRunnerOptions{ - RepoID: task.RepoID, - }) - if err != nil { - return nil, err - } - - return runner, bots_model.AssignBuildToRunner(task.ID, runner.ID) -} - -// Init will start the service to get all unfinished tasks and run them -func Init() error { - buildQueue = queue.CreateQueue("actions_task", handle, &bots_model.Build{}) - if buildQueue == nil { - return fmt.Errorf("Unable to create Task Queue") - } - - go graceful.GetManager().RunWithShutdownFns(buildQueue.Run) - - return nil -} - -func handle(data ...queue.Data) []queue.Data { - var unhandled []queue.Data - for _, datum := range data { - build := datum.(*bots_model.Build) - runner, err := Dispatch(build) - if err != nil { - log.Error("Run build failed: %v", err) - unhandled = append(unhandled, build) - } else { - log.Trace("build %v assigned to %s", build.UUID, runner.UUID) - } - } - return unhandled -}*/