From 6a033f9b10cb1bdf8df93d26c70b938585f4c7b7 Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Mon, 6 May 2024 21:58:36 +0800 Subject: [PATCH] feat(cloudevents-server): support new events for tibuild Signed-off-by: wuhuizuo --- .../pkg/events/custom/tibuild/handler.go | 2 ++ cloudevents-server/pkg/events/custom/tibuild/types.go | 10 ++++++---- tibuild/pkg/rest/service/dev_build_service.go | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cloudevents-server/pkg/events/custom/tibuild/handler.go b/cloudevents-server/pkg/events/custom/tibuild/handler.go index 2e16c3b3..a23edae6 100644 --- a/cloudevents-server/pkg/events/custom/tibuild/handler.go +++ b/cloudevents-server/pkg/events/custom/tibuild/handler.go @@ -38,8 +38,10 @@ func (h *triggerHandler) SupportEventTypes() []string { return []string{ EventTypeDevbuildFakeGithubCreate, EventTypeDevbuildFakeGithubPush, + EventTypeDevbuildFakeGithubPullRequest, EventTypeHotfixFakeGithubCreate, EventTypeHotfixFakeGithubPush, + EventTypeHotfixFakeGithubPullRequest, } } diff --git a/cloudevents-server/pkg/events/custom/tibuild/types.go b/cloudevents-server/pkg/events/custom/tibuild/types.go index 7fdbc178..29f9d603 100644 --- a/cloudevents-server/pkg/events/custom/tibuild/types.go +++ b/cloudevents-server/pkg/events/custom/tibuild/types.go @@ -1,8 +1,10 @@ package tibuild const ( - EventTypeDevbuildFakeGithubPush = "net.pingcap.tibuild.devbuild.push" // Fake GitHub push events in the development build. - EventTypeDevbuildFakeGithubCreate = "net.pingcap.tibuild.devbuild.create" // Fake GitHub create events in the development build. - EventTypeHotfixFakeGithubPush = "net.pingcap.tibuild.hotfix.push" // Fake GitHub push events in the hotfix build. - EventTypeHotfixFakeGithubCreate = "net.pingcap.tibuild.hotfix.create" // Fake GitHub create events in the hotfix build. + EventTypeDevbuildFakeGithubPush = "net.pingcap.tibuild.devbuild.push" // Fake GitHub push events in the development build. + EventTypeDevbuildFakeGithubCreate = "net.pingcap.tibuild.devbuild.create" // Fake GitHub create events in the development build. + EventTypeDevbuildFakeGithubPullRequest = "net.pingcap.tibuild.devbuild.pull_request" // Fake GitHub pull request events in the development build. + EventTypeHotfixFakeGithubPush = "net.pingcap.tibuild.hotfix.push" // Fake GitHub push events in the hotfix build. + EventTypeHotfixFakeGithubCreate = "net.pingcap.tibuild.hotfix.create" // Fake GitHub create events in the hotfix build. + EventTypeHotfixFakeGithubPullRequest = "net.pingcap.tibuild.hotfix.pull_request" // Fake GitHub pull request events in the hotfix build. ) diff --git a/tibuild/pkg/rest/service/dev_build_service.go b/tibuild/pkg/rest/service/dev_build_service.go index 8ce6c7eb..47ddc29f 100644 --- a/tibuild/pkg/rest/service/dev_build_service.go +++ b/tibuild/pkg/rest/service/dev_build_service.go @@ -102,7 +102,7 @@ func (s DevbuildServer) Create(ctx context.Context, req DevBuild, option DevBuil if err != nil { slog.Error("save triggered entity failed", "reason", err) } - return nil, fmt.Errorf("trigger jenkins fail: %w", ErrInternalError) + return nil, fmt.Errorf("trigger Tekton fail: %w", ErrInternalError) } }