From 162e160286048902e5ddf6f7bedafef97bd018ab Mon Sep 17 00:00:00 2001 From: "yiling.ji" Date: Thu, 2 Jan 2025 09:25:42 +0000 Subject: [PATCH] Merge branch 'fix/exec_workflow' into 'main' Fix temporal workflow run param See merge request product/starhub/starhub-server!782 --- api/handler/callback/git_callback.go | 5 ++--- api/handler/internal.go | 5 ++--- api/handler/internal_test.go | 2 +- cmd/csghub-server/cmd/trigger/git_callback.go | 5 ++--- mirror/reposyncer/local_woker.go | 5 ++--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/api/handler/callback/git_callback.go b/api/handler/callback/git_callback.go index df1f8cb9..c21e7555 100644 --- a/api/handler/callback/git_callback.go +++ b/api/handler/callback/git_callback.go @@ -54,9 +54,8 @@ func (h *GitCallbackHandler) handlePush(c *gin.Context) { TaskQueue: workflow.HandlePushQueueName, } - we, err := workflowClient.ExecuteWorkflow(c, workflowOptions, workflow.HandlePushWorkflow, - &req, - h.config, + we, err := workflowClient.ExecuteWorkflow( + c, workflowOptions, workflow.HandlePushWorkflow, &req, ) if err != nil { slog.Error("failed to handle git push callback", slog.Any("error", err)) diff --git a/api/handler/internal.go b/api/handler/internal.go index d26cf7bc..2c66efe8 100644 --- a/api/handler/internal.go +++ b/api/handler/internal.go @@ -143,9 +143,8 @@ func (h *InternalHandler) PostReceive(ctx *gin.Context) { TaskQueue: workflow.HandlePushQueueName, } - we, err := h.temporalClient.ExecuteWorkflow(ctx, workflowOptions, workflow.HandlePushWorkflow, - callback, - h.config, + we, err := h.temporalClient.ExecuteWorkflow( + ctx, workflowOptions, workflow.HandlePushWorkflow, callback, ) if err != nil { slog.Error("failed to handle git push callback", slog.Any("error", err)) diff --git a/api/handler/internal_test.go b/api/handler/internal_test.go index 10d50f5e..5ff19e2f 100644 --- a/api/handler/internal_test.go +++ b/api/handler/internal_test.go @@ -153,7 +153,7 @@ func TestInternalHandler_PostReceive(t *testing.T) { tester.ctx, client.StartWorkflowOptions{ TaskQueue: workflow.HandlePushQueueName, }, mock.Anything, - &types.GiteaCallbackPushReq{Ref: "ref/heads/main"}, &config.Config{}, + &types.GiteaCallbackPushReq{Ref: "ref/heads/main"}, ).Return( runMock, nil, ) diff --git a/cmd/csghub-server/cmd/trigger/git_callback.go b/cmd/csghub-server/cmd/trigger/git_callback.go index 8fffaf2e..f108511a 100644 --- a/cmd/csghub-server/cmd/trigger/git_callback.go +++ b/cmd/csghub-server/cmd/trigger/git_callback.go @@ -92,9 +92,8 @@ var gitCallbackCmd = &cobra.Command{ TaskQueue: workflow.HandlePushQueueName, } - we, err := workflowClient.ExecuteWorkflow(context.Background(), workflowOptions, workflow.HandlePushWorkflow, - req, - config, + we, err := workflowClient.ExecuteWorkflow( + context.Background(), workflowOptions, workflow.HandlePushWorkflow, req, ) if err != nil { slog.Error("failed to handle git push callback", slog.String("repo", repo.Path), slog.Any("error", err)) diff --git a/mirror/reposyncer/local_woker.go b/mirror/reposyncer/local_woker.go index 4519ed7f..b6a98c11 100644 --- a/mirror/reposyncer/local_woker.go +++ b/mirror/reposyncer/local_woker.go @@ -233,9 +233,8 @@ func (w *LocalMirrorWoker) SyncRepo(ctx context.Context, task queue.MirrorTask) TaskQueue: workflow.HandlePushQueueName, } - we, err := workflowClient.ExecuteWorkflow(ctx, workflowOptions, workflow.HandlePushWorkflow, - callback, - w.config, + we, err := workflowClient.ExecuteWorkflow( + ctx, workflowOptions, workflow.HandlePushWorkflow, callback, ) if err != nil { return fmt.Errorf("failed to handle git push callback: %w", err)