chore(model): create build, stage, step and logs table

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu
2022-11-25 17:48:44 +08:00
committed by Jason Song
parent e05f224d19
commit e07d416366
7 changed files with 66 additions and 31 deletions
+5 -3
View File
@@ -10,11 +10,14 @@ import (
"code.gitea.io/gitea/modules/log"
pingv1 "gitea.com/gitea/proto-go/ping/v1"
"gitea.com/gitea/proto-go/ping/v1/pingv1connect"
"github.com/bufbuild/connect-go"
)
type Service struct{}
type Service struct {
pingv1connect.UnimplementedPingServiceHandler
}
func (s *Service) Ping(
ctx context.Context,
@@ -22,10 +25,9 @@ func (s *Service) Ping(
) (*connect.Response[pingv1.PingResponse], error) {
log.Info("Content-Type: %s", req.Header().Get("Content-Type"))
log.Info("User-Agent: %s", req.Header().Get("User-Agent"))
log.Info("X-Gitea-Token: %s", req.Header().Get("X-Gitea-Token"))
log.Info("X-Runner-Token: %s", req.Header().Get("X-Runner-Token"))
res := connect.NewResponse(&pingv1.PingResponse{
Data: fmt.Sprintf("Hello, %s!", req.Msg.Data),
})
res.Header().Set("Gitea-Version", "v1")
return res, nil
}
+2 -2
View File
@@ -118,14 +118,14 @@ func GetBuildJobLogs(ctx *context.Context) {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
var buildJob *bots_model.BuildJob
var buildJob *bots_model.BuildStage
wf := ctx.Params("workflow")
jobname := ctx.Params("jobname")
LOOP_WORKFLOWS:
for workflow, jobs := range workflows {
if workflow == wf {
for _, job := range jobs {
if jobname == job.Jobname {
if jobname == job.Name {
buildJob = job
break LOOP_WORKFLOWS
}