chore(gRPC): support update stage and step method.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu 2022-09-01 22:05:51 +08:00 committed by Jason Song
parent 68d416bd1b
commit eac6425b2f
4 changed files with 25 additions and 5 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ require (
code.gitea.io/gitea-vet v0.2.2-0.20220122151748-48ebc902541b
code.gitea.io/sdk/gitea v0.15.1
codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570
gitea.com/gitea/proto-go v0.0.0-20220901061207-b88901a1b9bc
gitea.com/gitea/proto-go v0.0.0-20220901135226-82a982903134
gitea.com/go-chi/binding v0.0.0-20220309004920-114340dabecb
gitea.com/go-chi/cache v0.2.0
gitea.com/go-chi/captcha v0.0.0-20211013065431-70641c1a35d5

4
go.sum
View File

@ -89,8 +89,8 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy
git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
gitea.com/gitea/proto-go v0.0.0-20220901061207-b88901a1b9bc h1:kTVjwKxXma2yAdgXz8T1tiJihtWFK8jGLqArX2NownM=
gitea.com/gitea/proto-go v0.0.0-20220901061207-b88901a1b9bc/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
gitea.com/gitea/proto-go v0.0.0-20220901135226-82a982903134 h1:5ofH0FGEkIj/P9a6oFDgkdmGSWow1yD1uubiftMA2Kw=
gitea.com/gitea/proto-go v0.0.0-20220901135226-82a982903134/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
gitea.com/go-chi/binding v0.0.0-20220309004920-114340dabecb h1:Yy0Bxzc8R2wxiwXoG/rECGplJUSpXqCsog9PuJFgiHs=
gitea.com/go-chi/binding v0.0.0-20220309004920-114340dabecb/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=

View File

@ -87,7 +87,7 @@ func notify(repo *repo_model.Repository, doer *user_model.User, payload, ref str
for i, entry := range matchedEntries {
taskStatuses := make(map[string]bots_model.BuildStatus)
for k := range jobs[i] {
taskStatuses[k] = bots_model.BuildPending
taskStatuses[k] = bots_model.StatusPending
}
workflowsStatuses[entry.Name()] = taskStatuses
}
@ -98,7 +98,7 @@ func notify(repo *repo_model.Repository, doer *user_model.User, payload, ref str
TriggerUserID: doer.ID,
Event: evt,
EventPayload: payload,
Status: bots_model.BuildPending,
Status: bots_model.StatusPending,
Ref: ref,
CommitSHA: commit.ID.String(),
}

View File

@ -20,6 +20,7 @@ type Service struct {
runnerv1connect.UnimplementedRunnerServiceHandler
}
// Register for new runner.
func (s *Service) Register(
ctx context.Context,
req *connect.Request[runnerv1.RegisterRequest],
@ -58,6 +59,7 @@ func (s *Service) Register(
return res, nil
}
// Request requests the next available build stage for execution.
func (s *Service) Request(
ctx context.Context,
req *connect.Request[runnerv1.RequestRequest],
@ -67,3 +69,21 @@ func (s *Service) Request(
})
return res, nil
}
// Update updates the build stage.
func (s *Service) Update(
ctx context.Context,
req *connect.Request[runnerv1.UpdateRequest],
) (*connect.Response[runnerv1.UpdateResponse], error) {
res := connect.NewResponse(&runnerv1.UpdateResponse{})
return res, nil
}
// UpdateStep updates the build step.
func (s *Service) UpdateStep(
ctx context.Context,
req *connect.Request[runnerv1.UpdateStepRequest],
) (*connect.Response[runnerv1.UpdateStepResponse], error) {
res := connect.NewResponse(&runnerv1.UpdateStepResponse{})
return res, nil
}