diff --git a/auth/jwt_middleware.go b/auth/jwt_middleware.go index cd0cdb73..276c3563 100644 --- a/auth/jwt_middleware.go +++ b/auth/jwt_middleware.go @@ -5,18 +5,20 @@ import ( "net/http" "time" - "github.com/containerish/OpenRegistry/store/v1/types" "github.com/golang-jwt/jwt/v5" "github.com/google/uuid" echo_jwt "github.com/labstack/echo-jwt/v4" "github.com/labstack/echo/v4" + + "github.com/containerish/OpenRegistry/store/v1/types" ) const ( - AccessCookieKey = "access_token" - RefreshCookKey = "refresh_token" - Service = "service" - QueryToken = "token" + AccessCookieKey = "access_token" + SessionCookieKey = "session_id" + RefreshCookKey = "refresh_token" + Service = "service" + QueryToken = "token" ) // JWT basically uses the default JWT middleware by echo, but has a slightly different skipper func diff --git a/auth/signin.go b/auth/signin.go index c665a693..cc643044 100644 --- a/auth/signin.go +++ b/auth/signin.go @@ -7,10 +7,11 @@ import ( "net/http" "time" - "github.com/containerish/OpenRegistry/store/v1/types" "github.com/google/uuid" "github.com/jackc/pgx/v4" "github.com/labstack/echo/v4" + + "github.com/containerish/OpenRegistry/store/v1/types" ) func (a *auth) SignIn(ctx echo.Context) error { @@ -170,7 +171,7 @@ func (a *auth) SignIn(ctx echo.Context) error { } sessionId := fmt.Sprintf("%s:%s", id, userFromDb.ID) - sessionCookie := a.createCookie(ctx, "session_id", sessionId, false, time.Now().Add(time.Hour*750)) + sessionCookie := a.createCookie(ctx, SessionCookieKey, sessionId, false, time.Now().Add(time.Hour*750)) accessCookie := a.createCookie(ctx, AccessCookieKey, access, true, time.Now().Add(time.Hour*750)) refreshCookie := a.createCookie(ctx, RefreshCookKey, refresh, true, time.Now().Add(time.Hour*750)) @@ -178,8 +179,9 @@ func (a *auth) SignIn(ctx echo.Context) error { ctx.SetCookie(refreshCookie) ctx.SetCookie(sessionCookie) err = ctx.JSON(http.StatusOK, echo.Map{ - "token": access, - "refresh": refresh, + SessionCookieKey: sessionId, + AccessCookieKey: access, + RefreshCookKey: refresh, }) a.logger.Log(ctx, err).Send() return err diff --git a/auth/signup.go b/auth/signup.go index 407fb130..0c53b506 100644 --- a/auth/signup.go +++ b/auth/signup.go @@ -8,12 +8,13 @@ import ( "strings" "time" + "github.com/google/uuid" + "github.com/labstack/echo/v4" + "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/services/email" store_err "github.com/containerish/OpenRegistry/store/v1" "github.com/containerish/OpenRegistry/store/v1/types" - "github.com/google/uuid" - "github.com/labstack/echo/v4" ) func (a *auth) parseSignUpRequest(ctx echo.Context) (*types.User, error) { @@ -95,7 +96,7 @@ func (a *auth) SignUp(ctx echo.Context) error { if strings.Contains(err.Error(), store_err.ErrDuplicateConstraintEmail) { echoErr := ctx.JSON(http.StatusInternalServerError, echo.Map{ "error": err.Error(), - "message": "this email already taken, try sign in?", + "message": "this email is already taken, try sign in?", }) a.logger.Log(ctx, err).Send() return echoErr diff --git a/buf.gen.yaml b/buf.gen.yaml index 3bfec575..d185fc17 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,16 +1,13 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/go + - remote: buf.build/protocolbuffers/go out: . - opt: - - paths=source_relative - - plugin: buf.build/bufbuild/validate-go + opt: paths=source_relative + - remote: buf.build/bufbuild/validate-go out: . - opt: - - paths=source_relative - - plugin: buf.build/bufbuild/connect-go + opt: paths=source_relative + - remote: buf.build/connectrpc/go out: . - opt: - - paths=source_relative + opt: paths=source_relative diff --git a/buf.lock b/buf.lock new file mode 100644 index 00000000..4286171e --- /dev/null +++ b/buf.lock @@ -0,0 +1,9 @@ +# Generated by buf. DO NOT EDIT. +version: v2 +deps: + - name: buf.build/envoyproxy/protoc-gen-validate + commit: 6607b10f00ed4a3d98f906807131c44a + digest: b5:ade405ac4328bd0a2cf83c93bcb4bc389d4897afd86a0096df4537b180916882da4e4f0c2d45f0b1554d7a6c87f6c5bc94b71b3555ca71cc31a9a8baed26a9f9 + - name: buf.build/googleapis/googleapis + commit: 5ae7f88519b04fe1965da0f8a375a088 + digest: b5:ac717f02b210c53aeaa5d8801b118cae7a1883dab531034859889622dcb389979ee731ab42192c16c3cdb39b40f2dda72a8c1ebeefa3bcdf95f9e5739dc30cca diff --git a/buf.work.yaml b/buf.work.yaml deleted file mode 100644 index 4bddfe67..00000000 --- a/buf.work.yaml +++ /dev/null @@ -1,3 +0,0 @@ -version: v1 -directories: - - protos diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 00000000..567d9738 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,20 @@ +version: v2 +modules: + - path: protos + name: buf.build/containerish/openregistry +deps: + - buf.build/envoyproxy/protoc-gen-validate + - buf.build/googleapis/googleapis +lint: + use: + - STANDARD + except: + - FIELD_NOT_REQUIRED + - PACKAGE_NO_IMPORT_CYCLE + disallow_comment_ignores: true +breaking: + use: + - FILE + except: + - EXTENSION_NO_DELETE + - FIELD_SAME_DEFAULT diff --git a/go.mod b/go.mod index 1c3d3858..f2045eb5 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.23 toolchain go1.23.0 require ( + connectrpc.com/connect v1.17.0 github.com/alexliesenfeld/health v0.8.0 github.com/alphadose/haxmap v1.4.0 github.com/aws/aws-sdk-go-v2 v1.32.2 @@ -14,7 +15,6 @@ require ( github.com/aws/smithy-go v1.22.0 github.com/axiomhq/axiom-go v0.21.1 github.com/bradleyfalzon/ghinstallation/v2 v2.11.0 - github.com/bufbuild/connect-go v1.10.0 github.com/fatih/color v1.17.0 github.com/go-playground/locales v0.14.1 github.com/go-playground/universal-translator v0.18.1 diff --git a/go.sum b/go.sum index 65e1a5ae..253055e0 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk= +connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -79,8 +81,6 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bradleyfalzon/ghinstallation/v2 v2.11.0 h1:R9d0v+iobRHSaE4wKUnXFiZp53AL4ED5MzgEMwGTZag= github.com/bradleyfalzon/ghinstallation/v2 v2.11.0/go.mod h1:0LWKQwOHewXO/1acI6TtyE0Xc4ObDb2rFN7eHBAG71M= -github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg= -github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8= github.com/calebcase/tmpfile v1.0.3 h1:BZrOWZ79gJqQ3XbAQlihYZf/YCV0H4KPIdM5K5oMpJo= github.com/calebcase/tmpfile v1.0.3/go.mod h1:UAUc01aHeC+pudPagY/lWvt2qS9ZO5Zzof6/tIUzqeI= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= diff --git a/protos/buf.lock b/protos/buf.lock deleted file mode 100644 index 4cb0aef5..00000000 --- a/protos/buf.lock +++ /dev/null @@ -1,11 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: envoyproxy - repository: protoc-gen-validate - commit: 6607b10f00ed4a3d98f906807131c44a - - remote: buf.build - owner: googleapis - repository: googleapis - commit: 5ae7f88519b04fe1965da0f8a375a088 diff --git a/protos/buf.yaml b/protos/buf.yaml deleted file mode 100644 index e6b4e5c4..00000000 --- a/protos/buf.yaml +++ /dev/null @@ -1,11 +0,0 @@ -version: v1 -name: buf.build/containerish/openregistry -lint: - use: - - STANDARD -deps: - - buf.build/googleapis/googleapis - - buf.build/envoyproxy/protoc-gen-validate -breaking: - use: - - FILE diff --git a/router/github.go b/router/github.go index 202f5ce6..7e39aac0 100644 --- a/router/github.go +++ b/router/github.go @@ -52,7 +52,7 @@ func RegisterGitHubRoutes( ) go func() { addr := net.JoinHostPort(cfg.Host, fmt.Sprintf("%d", cfg.Port)) - color.Green("connect-go GitHub Automation gRPC service running on: %s", addr) + color.Green("connectrpc GitHub Automation gRPC service running on: %s", addr) ghCors := cors.New(cors.Options{ AllowedOrigins: allowedOrigins, AllowOriginFunc: func(origin string) bool { @@ -79,7 +79,7 @@ func RegisterGitHubRoutes( }) handler := ghCors.Handler(h2c.NewHandler(githubMux, &http2.Server{})) if err := http.ListenAndServe(addr, handler); err != nil { - color.Red("connect-go GitHub Automation service listen error: %s", err) + color.Red("connectrpc GitHub Automation service listen error: %s", err) } }() } diff --git a/router/vuln_scanning_routes.go b/router/vuln_scanning_routes.go index 4798f18c..cb01bf0d 100644 --- a/router/vuln_scanning_routes.go +++ b/router/vuln_scanning_routes.go @@ -63,9 +63,9 @@ func RegisterVulnScaningRoutes( }) handler := h2c.NewHandler(vulnScanningCors.Handler(clairApi), &http2.Server{}) - color.Green("connect-go Clair gRPC service running on: %s", addr) + color.Green("connectrpc Clair gRPC service running on: %s", addr) if err := http.ListenAndServe(addr, handler); err != nil { - color.Red("connect-go listen error: %s", err) + color.Red("connectrpc listen error: %s", err) } }() } diff --git a/services/kon/github_actions/v1/github_actions_v1connect/build_job.connect.go b/services/kon/github_actions/v1/github_actions_v1connect/build_job.connect.go index 26f5817b..0723f9cc 100644 --- a/services/kon/github_actions/v1/github_actions_v1connect/build_job.connect.go +++ b/services/kon/github_actions/v1/github_actions_v1connect/build_job.connect.go @@ -5,9 +5,9 @@ package github_actions_v1connect import ( + connect "connectrpc.com/connect" context "context" errors "errors" - connect_go "github.com/bufbuild/connect-go" v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" http "net/http" strings "strings" @@ -18,7 +18,7 @@ import ( // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. -const _ = connect_go.IsAtLeastVersion0_1_0 +const _ = connect.IsAtLeastVersion1_13_0 const ( // GithubActionsBuildServiceName is the fully-qualified name of the GithubActionsBuildService @@ -57,16 +57,28 @@ const ( GithubActionsBuildServiceBulkDeleteBuildJobsProcedure = "/services.kon.github_actions.v1.GithubActionsBuildService/BulkDeleteBuildJobs" ) +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + githubActionsBuildServiceServiceDescriptor = v1.File_services_kon_github_actions_v1_build_job_proto.Services().ByName("GithubActionsBuildService") + githubActionsBuildServiceStoreJobMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("StoreJob") + githubActionsBuildServiceGetBuildJobMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("GetBuildJob") + githubActionsBuildServiceTriggerBuildMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("TriggerBuild") + githubActionsBuildServiceCancelBuildMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("CancelBuild") + githubActionsBuildServiceDeleteJobMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("DeleteJob") + githubActionsBuildServiceListBuildJobsMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("ListBuildJobs") + githubActionsBuildServiceBulkDeleteBuildJobsMethodDescriptor = githubActionsBuildServiceServiceDescriptor.Methods().ByName("BulkDeleteBuildJobs") +) + // GithubActionsBuildServiceClient is a client for the // services.kon.github_actions.v1.GithubActionsBuildService service. type GithubActionsBuildServiceClient interface { - StoreJob(context.Context, *connect_go.Request[v1.StoreJobRequest]) (*connect_go.Response[v1.StoreJobResponse], error) - GetBuildJob(context.Context, *connect_go.Request[v1.GetBuildJobRequest]) (*connect_go.Response[v1.GetBuildJobResponse], error) - TriggerBuild(context.Context, *connect_go.Request[v1.TriggerBuildRequest]) (*connect_go.Response[v1.TriggerBuildResponse], error) - CancelBuild(context.Context, *connect_go.Request[v1.CancelBuildRequest]) (*connect_go.Response[v1.CancelBuildResponse], error) - DeleteJob(context.Context, *connect_go.Request[v1.DeleteJobRequest]) (*connect_go.Response[v1.DeleteJobResponse], error) - ListBuildJobs(context.Context, *connect_go.Request[v1.ListBuildJobsRequest]) (*connect_go.Response[v1.ListBuildJobsResponse], error) - BulkDeleteBuildJobs(context.Context, *connect_go.Request[v1.BulkDeleteBuildJobsRequest]) (*connect_go.Response[v1.BulkDeleteBuildJobsResponse], error) + StoreJob(context.Context, *connect.Request[v1.StoreJobRequest]) (*connect.Response[v1.StoreJobResponse], error) + GetBuildJob(context.Context, *connect.Request[v1.GetBuildJobRequest]) (*connect.Response[v1.GetBuildJobResponse], error) + TriggerBuild(context.Context, *connect.Request[v1.TriggerBuildRequest]) (*connect.Response[v1.TriggerBuildResponse], error) + CancelBuild(context.Context, *connect.Request[v1.CancelBuildRequest]) (*connect.Response[v1.CancelBuildResponse], error) + DeleteJob(context.Context, *connect.Request[v1.DeleteJobRequest]) (*connect.Response[v1.DeleteJobResponse], error) + ListBuildJobs(context.Context, *connect.Request[v1.ListBuildJobsRequest]) (*connect.Response[v1.ListBuildJobsResponse], error) + BulkDeleteBuildJobs(context.Context, *connect.Request[v1.BulkDeleteBuildJobsRequest]) (*connect.Response[v1.BulkDeleteBuildJobsResponse], error) } // NewGithubActionsBuildServiceClient constructs a client for the @@ -77,104 +89,111 @@ type GithubActionsBuildServiceClient interface { // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). -func NewGithubActionsBuildServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GithubActionsBuildServiceClient { +func NewGithubActionsBuildServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GithubActionsBuildServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &githubActionsBuildServiceClient{ - storeJob: connect_go.NewClient[v1.StoreJobRequest, v1.StoreJobResponse]( + storeJob: connect.NewClient[v1.StoreJobRequest, v1.StoreJobResponse]( httpClient, baseURL+GithubActionsBuildServiceStoreJobProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceStoreJobMethodDescriptor), + connect.WithClientOptions(opts...), ), - getBuildJob: connect_go.NewClient[v1.GetBuildJobRequest, v1.GetBuildJobResponse]( + getBuildJob: connect.NewClient[v1.GetBuildJobRequest, v1.GetBuildJobResponse]( httpClient, baseURL+GithubActionsBuildServiceGetBuildJobProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceGetBuildJobMethodDescriptor), + connect.WithClientOptions(opts...), ), - triggerBuild: connect_go.NewClient[v1.TriggerBuildRequest, v1.TriggerBuildResponse]( + triggerBuild: connect.NewClient[v1.TriggerBuildRequest, v1.TriggerBuildResponse]( httpClient, baseURL+GithubActionsBuildServiceTriggerBuildProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceTriggerBuildMethodDescriptor), + connect.WithClientOptions(opts...), ), - cancelBuild: connect_go.NewClient[v1.CancelBuildRequest, v1.CancelBuildResponse]( + cancelBuild: connect.NewClient[v1.CancelBuildRequest, v1.CancelBuildResponse]( httpClient, baseURL+GithubActionsBuildServiceCancelBuildProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceCancelBuildMethodDescriptor), + connect.WithClientOptions(opts...), ), - deleteJob: connect_go.NewClient[v1.DeleteJobRequest, v1.DeleteJobResponse]( + deleteJob: connect.NewClient[v1.DeleteJobRequest, v1.DeleteJobResponse]( httpClient, baseURL+GithubActionsBuildServiceDeleteJobProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceDeleteJobMethodDescriptor), + connect.WithClientOptions(opts...), ), - listBuildJobs: connect_go.NewClient[v1.ListBuildJobsRequest, v1.ListBuildJobsResponse]( + listBuildJobs: connect.NewClient[v1.ListBuildJobsRequest, v1.ListBuildJobsResponse]( httpClient, baseURL+GithubActionsBuildServiceListBuildJobsProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceListBuildJobsMethodDescriptor), + connect.WithClientOptions(opts...), ), - bulkDeleteBuildJobs: connect_go.NewClient[v1.BulkDeleteBuildJobsRequest, v1.BulkDeleteBuildJobsResponse]( + bulkDeleteBuildJobs: connect.NewClient[v1.BulkDeleteBuildJobsRequest, v1.BulkDeleteBuildJobsResponse]( httpClient, baseURL+GithubActionsBuildServiceBulkDeleteBuildJobsProcedure, - opts..., + connect.WithSchema(githubActionsBuildServiceBulkDeleteBuildJobsMethodDescriptor), + connect.WithClientOptions(opts...), ), } } // githubActionsBuildServiceClient implements GithubActionsBuildServiceClient. type githubActionsBuildServiceClient struct { - storeJob *connect_go.Client[v1.StoreJobRequest, v1.StoreJobResponse] - getBuildJob *connect_go.Client[v1.GetBuildJobRequest, v1.GetBuildJobResponse] - triggerBuild *connect_go.Client[v1.TriggerBuildRequest, v1.TriggerBuildResponse] - cancelBuild *connect_go.Client[v1.CancelBuildRequest, v1.CancelBuildResponse] - deleteJob *connect_go.Client[v1.DeleteJobRequest, v1.DeleteJobResponse] - listBuildJobs *connect_go.Client[v1.ListBuildJobsRequest, v1.ListBuildJobsResponse] - bulkDeleteBuildJobs *connect_go.Client[v1.BulkDeleteBuildJobsRequest, v1.BulkDeleteBuildJobsResponse] + storeJob *connect.Client[v1.StoreJobRequest, v1.StoreJobResponse] + getBuildJob *connect.Client[v1.GetBuildJobRequest, v1.GetBuildJobResponse] + triggerBuild *connect.Client[v1.TriggerBuildRequest, v1.TriggerBuildResponse] + cancelBuild *connect.Client[v1.CancelBuildRequest, v1.CancelBuildResponse] + deleteJob *connect.Client[v1.DeleteJobRequest, v1.DeleteJobResponse] + listBuildJobs *connect.Client[v1.ListBuildJobsRequest, v1.ListBuildJobsResponse] + bulkDeleteBuildJobs *connect.Client[v1.BulkDeleteBuildJobsRequest, v1.BulkDeleteBuildJobsResponse] } // StoreJob calls services.kon.github_actions.v1.GithubActionsBuildService.StoreJob. -func (c *githubActionsBuildServiceClient) StoreJob(ctx context.Context, req *connect_go.Request[v1.StoreJobRequest]) (*connect_go.Response[v1.StoreJobResponse], error) { +func (c *githubActionsBuildServiceClient) StoreJob(ctx context.Context, req *connect.Request[v1.StoreJobRequest]) (*connect.Response[v1.StoreJobResponse], error) { return c.storeJob.CallUnary(ctx, req) } // GetBuildJob calls services.kon.github_actions.v1.GithubActionsBuildService.GetBuildJob. -func (c *githubActionsBuildServiceClient) GetBuildJob(ctx context.Context, req *connect_go.Request[v1.GetBuildJobRequest]) (*connect_go.Response[v1.GetBuildJobResponse], error) { +func (c *githubActionsBuildServiceClient) GetBuildJob(ctx context.Context, req *connect.Request[v1.GetBuildJobRequest]) (*connect.Response[v1.GetBuildJobResponse], error) { return c.getBuildJob.CallUnary(ctx, req) } // TriggerBuild calls services.kon.github_actions.v1.GithubActionsBuildService.TriggerBuild. -func (c *githubActionsBuildServiceClient) TriggerBuild(ctx context.Context, req *connect_go.Request[v1.TriggerBuildRequest]) (*connect_go.Response[v1.TriggerBuildResponse], error) { +func (c *githubActionsBuildServiceClient) TriggerBuild(ctx context.Context, req *connect.Request[v1.TriggerBuildRequest]) (*connect.Response[v1.TriggerBuildResponse], error) { return c.triggerBuild.CallUnary(ctx, req) } // CancelBuild calls services.kon.github_actions.v1.GithubActionsBuildService.CancelBuild. -func (c *githubActionsBuildServiceClient) CancelBuild(ctx context.Context, req *connect_go.Request[v1.CancelBuildRequest]) (*connect_go.Response[v1.CancelBuildResponse], error) { +func (c *githubActionsBuildServiceClient) CancelBuild(ctx context.Context, req *connect.Request[v1.CancelBuildRequest]) (*connect.Response[v1.CancelBuildResponse], error) { return c.cancelBuild.CallUnary(ctx, req) } // DeleteJob calls services.kon.github_actions.v1.GithubActionsBuildService.DeleteJob. -func (c *githubActionsBuildServiceClient) DeleteJob(ctx context.Context, req *connect_go.Request[v1.DeleteJobRequest]) (*connect_go.Response[v1.DeleteJobResponse], error) { +func (c *githubActionsBuildServiceClient) DeleteJob(ctx context.Context, req *connect.Request[v1.DeleteJobRequest]) (*connect.Response[v1.DeleteJobResponse], error) { return c.deleteJob.CallUnary(ctx, req) } // ListBuildJobs calls services.kon.github_actions.v1.GithubActionsBuildService.ListBuildJobs. -func (c *githubActionsBuildServiceClient) ListBuildJobs(ctx context.Context, req *connect_go.Request[v1.ListBuildJobsRequest]) (*connect_go.Response[v1.ListBuildJobsResponse], error) { +func (c *githubActionsBuildServiceClient) ListBuildJobs(ctx context.Context, req *connect.Request[v1.ListBuildJobsRequest]) (*connect.Response[v1.ListBuildJobsResponse], error) { return c.listBuildJobs.CallUnary(ctx, req) } // BulkDeleteBuildJobs calls // services.kon.github_actions.v1.GithubActionsBuildService.BulkDeleteBuildJobs. -func (c *githubActionsBuildServiceClient) BulkDeleteBuildJobs(ctx context.Context, req *connect_go.Request[v1.BulkDeleteBuildJobsRequest]) (*connect_go.Response[v1.BulkDeleteBuildJobsResponse], error) { +func (c *githubActionsBuildServiceClient) BulkDeleteBuildJobs(ctx context.Context, req *connect.Request[v1.BulkDeleteBuildJobsRequest]) (*connect.Response[v1.BulkDeleteBuildJobsResponse], error) { return c.bulkDeleteBuildJobs.CallUnary(ctx, req) } // GithubActionsBuildServiceHandler is an implementation of the // services.kon.github_actions.v1.GithubActionsBuildService service. type GithubActionsBuildServiceHandler interface { - StoreJob(context.Context, *connect_go.Request[v1.StoreJobRequest]) (*connect_go.Response[v1.StoreJobResponse], error) - GetBuildJob(context.Context, *connect_go.Request[v1.GetBuildJobRequest]) (*connect_go.Response[v1.GetBuildJobResponse], error) - TriggerBuild(context.Context, *connect_go.Request[v1.TriggerBuildRequest]) (*connect_go.Response[v1.TriggerBuildResponse], error) - CancelBuild(context.Context, *connect_go.Request[v1.CancelBuildRequest]) (*connect_go.Response[v1.CancelBuildResponse], error) - DeleteJob(context.Context, *connect_go.Request[v1.DeleteJobRequest]) (*connect_go.Response[v1.DeleteJobResponse], error) - ListBuildJobs(context.Context, *connect_go.Request[v1.ListBuildJobsRequest]) (*connect_go.Response[v1.ListBuildJobsResponse], error) - BulkDeleteBuildJobs(context.Context, *connect_go.Request[v1.BulkDeleteBuildJobsRequest]) (*connect_go.Response[v1.BulkDeleteBuildJobsResponse], error) + StoreJob(context.Context, *connect.Request[v1.StoreJobRequest]) (*connect.Response[v1.StoreJobResponse], error) + GetBuildJob(context.Context, *connect.Request[v1.GetBuildJobRequest]) (*connect.Response[v1.GetBuildJobResponse], error) + TriggerBuild(context.Context, *connect.Request[v1.TriggerBuildRequest]) (*connect.Response[v1.TriggerBuildResponse], error) + CancelBuild(context.Context, *connect.Request[v1.CancelBuildRequest]) (*connect.Response[v1.CancelBuildResponse], error) + DeleteJob(context.Context, *connect.Request[v1.DeleteJobRequest]) (*connect.Response[v1.DeleteJobResponse], error) + ListBuildJobs(context.Context, *connect.Request[v1.ListBuildJobsRequest]) (*connect.Response[v1.ListBuildJobsResponse], error) + BulkDeleteBuildJobs(context.Context, *connect.Request[v1.BulkDeleteBuildJobsRequest]) (*connect.Response[v1.BulkDeleteBuildJobsResponse], error) } // NewGithubActionsBuildServiceHandler builds an HTTP handler from the service implementation. It @@ -182,41 +201,48 @@ type GithubActionsBuildServiceHandler interface { // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. -func NewGithubActionsBuildServiceHandler(svc GithubActionsBuildServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { - githubActionsBuildServiceStoreJobHandler := connect_go.NewUnaryHandler( +func NewGithubActionsBuildServiceHandler(svc GithubActionsBuildServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + githubActionsBuildServiceStoreJobHandler := connect.NewUnaryHandler( GithubActionsBuildServiceStoreJobProcedure, svc.StoreJob, - opts..., + connect.WithSchema(githubActionsBuildServiceStoreJobMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceGetBuildJobHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceGetBuildJobHandler := connect.NewUnaryHandler( GithubActionsBuildServiceGetBuildJobProcedure, svc.GetBuildJob, - opts..., + connect.WithSchema(githubActionsBuildServiceGetBuildJobMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceTriggerBuildHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceTriggerBuildHandler := connect.NewUnaryHandler( GithubActionsBuildServiceTriggerBuildProcedure, svc.TriggerBuild, - opts..., + connect.WithSchema(githubActionsBuildServiceTriggerBuildMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceCancelBuildHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceCancelBuildHandler := connect.NewUnaryHandler( GithubActionsBuildServiceCancelBuildProcedure, svc.CancelBuild, - opts..., + connect.WithSchema(githubActionsBuildServiceCancelBuildMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceDeleteJobHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceDeleteJobHandler := connect.NewUnaryHandler( GithubActionsBuildServiceDeleteJobProcedure, svc.DeleteJob, - opts..., + connect.WithSchema(githubActionsBuildServiceDeleteJobMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceListBuildJobsHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceListBuildJobsHandler := connect.NewUnaryHandler( GithubActionsBuildServiceListBuildJobsProcedure, svc.ListBuildJobs, - opts..., + connect.WithSchema(githubActionsBuildServiceListBuildJobsMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - githubActionsBuildServiceBulkDeleteBuildJobsHandler := connect_go.NewUnaryHandler( + githubActionsBuildServiceBulkDeleteBuildJobsHandler := connect.NewUnaryHandler( GithubActionsBuildServiceBulkDeleteBuildJobsProcedure, svc.BulkDeleteBuildJobs, - opts..., + connect.WithSchema(githubActionsBuildServiceBulkDeleteBuildJobsMethodDescriptor), + connect.WithHandlerOptions(opts...), ) return "/services.kon.github_actions.v1.GithubActionsBuildService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { @@ -243,30 +269,30 @@ func NewGithubActionsBuildServiceHandler(svc GithubActionsBuildServiceHandler, o // UnimplementedGithubActionsBuildServiceHandler returns CodeUnimplemented from all methods. type UnimplementedGithubActionsBuildServiceHandler struct{} -func (UnimplementedGithubActionsBuildServiceHandler) StoreJob(context.Context, *connect_go.Request[v1.StoreJobRequest]) (*connect_go.Response[v1.StoreJobResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.StoreJob is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) StoreJob(context.Context, *connect.Request[v1.StoreJobRequest]) (*connect.Response[v1.StoreJobResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.StoreJob is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) GetBuildJob(context.Context, *connect_go.Request[v1.GetBuildJobRequest]) (*connect_go.Response[v1.GetBuildJobResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.GetBuildJob is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) GetBuildJob(context.Context, *connect.Request[v1.GetBuildJobRequest]) (*connect.Response[v1.GetBuildJobResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.GetBuildJob is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) TriggerBuild(context.Context, *connect_go.Request[v1.TriggerBuildRequest]) (*connect_go.Response[v1.TriggerBuildResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.TriggerBuild is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) TriggerBuild(context.Context, *connect.Request[v1.TriggerBuildRequest]) (*connect.Response[v1.TriggerBuildResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.TriggerBuild is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) CancelBuild(context.Context, *connect_go.Request[v1.CancelBuildRequest]) (*connect_go.Response[v1.CancelBuildResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.CancelBuild is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) CancelBuild(context.Context, *connect.Request[v1.CancelBuildRequest]) (*connect.Response[v1.CancelBuildResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.CancelBuild is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) DeleteJob(context.Context, *connect_go.Request[v1.DeleteJobRequest]) (*connect_go.Response[v1.DeleteJobResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.DeleteJob is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) DeleteJob(context.Context, *connect.Request[v1.DeleteJobRequest]) (*connect.Response[v1.DeleteJobResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.DeleteJob is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) ListBuildJobs(context.Context, *connect_go.Request[v1.ListBuildJobsRequest]) (*connect_go.Response[v1.ListBuildJobsResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.ListBuildJobs is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) ListBuildJobs(context.Context, *connect.Request[v1.ListBuildJobsRequest]) (*connect.Response[v1.ListBuildJobsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.ListBuildJobs is not implemented")) } -func (UnimplementedGithubActionsBuildServiceHandler) BulkDeleteBuildJobs(context.Context, *connect_go.Request[v1.BulkDeleteBuildJobsRequest]) (*connect_go.Response[v1.BulkDeleteBuildJobsResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.BulkDeleteBuildJobs is not implemented")) +func (UnimplementedGithubActionsBuildServiceHandler) BulkDeleteBuildJobs(context.Context, *connect.Request[v1.BulkDeleteBuildJobsRequest]) (*connect.Response[v1.BulkDeleteBuildJobsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GithubActionsBuildService.BulkDeleteBuildJobs is not implemented")) } diff --git a/services/kon/github_actions/v1/github_actions_v1connect/build_logs.connect.go b/services/kon/github_actions/v1/github_actions_v1connect/build_logs.connect.go index 8fcf879f..e6a5def3 100644 --- a/services/kon/github_actions/v1/github_actions_v1connect/build_logs.connect.go +++ b/services/kon/github_actions/v1/github_actions_v1connect/build_logs.connect.go @@ -5,9 +5,9 @@ package github_actions_v1connect import ( + connect "connectrpc.com/connect" context "context" errors "errors" - connect_go "github.com/bufbuild/connect-go" v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" http "net/http" strings "strings" @@ -18,7 +18,7 @@ import ( // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. -const _ = connect_go.IsAtLeastVersion0_1_0 +const _ = connect.IsAtLeastVersion1_13_0 const ( // GitHubActionsLogsServiceName is the fully-qualified name of the GitHubActionsLogsService service. @@ -41,11 +41,18 @@ const ( GitHubActionsLogsServiceDumpLogsProcedure = "/services.kon.github_actions.v1.GitHubActionsLogsService/DumpLogs" ) +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + gitHubActionsLogsServiceServiceDescriptor = v1.File_services_kon_github_actions_v1_build_logs_proto.Services().ByName("GitHubActionsLogsService") + gitHubActionsLogsServiceStreamWorkflowRunLogsMethodDescriptor = gitHubActionsLogsServiceServiceDescriptor.Methods().ByName("StreamWorkflowRunLogs") + gitHubActionsLogsServiceDumpLogsMethodDescriptor = gitHubActionsLogsServiceServiceDescriptor.Methods().ByName("DumpLogs") +) + // GitHubActionsLogsServiceClient is a client for the // services.kon.github_actions.v1.GitHubActionsLogsService service. type GitHubActionsLogsServiceClient interface { - StreamWorkflowRunLogs(context.Context, *connect_go.Request[v1.StreamWorkflowRunLogsRequest]) (*connect_go.ServerStreamForClient[v1.StreamWorkflowRunLogsResponse], error) - DumpLogs(context.Context, *connect_go.Request[v1.DumpLogsRequest]) (*connect_go.Response[v1.DumpLogsResponse], error) + StreamWorkflowRunLogs(context.Context, *connect.Request[v1.StreamWorkflowRunLogsRequest]) (*connect.ServerStreamForClient[v1.StreamWorkflowRunLogsResponse], error) + DumpLogs(context.Context, *connect.Request[v1.DumpLogsRequest]) (*connect.Response[v1.DumpLogsResponse], error) } // NewGitHubActionsLogsServiceClient constructs a client for the @@ -56,44 +63,46 @@ type GitHubActionsLogsServiceClient interface { // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). -func NewGitHubActionsLogsServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GitHubActionsLogsServiceClient { +func NewGitHubActionsLogsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GitHubActionsLogsServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &gitHubActionsLogsServiceClient{ - streamWorkflowRunLogs: connect_go.NewClient[v1.StreamWorkflowRunLogsRequest, v1.StreamWorkflowRunLogsResponse]( + streamWorkflowRunLogs: connect.NewClient[v1.StreamWorkflowRunLogsRequest, v1.StreamWorkflowRunLogsResponse]( httpClient, baseURL+GitHubActionsLogsServiceStreamWorkflowRunLogsProcedure, - opts..., + connect.WithSchema(gitHubActionsLogsServiceStreamWorkflowRunLogsMethodDescriptor), + connect.WithClientOptions(opts...), ), - dumpLogs: connect_go.NewClient[v1.DumpLogsRequest, v1.DumpLogsResponse]( + dumpLogs: connect.NewClient[v1.DumpLogsRequest, v1.DumpLogsResponse]( httpClient, baseURL+GitHubActionsLogsServiceDumpLogsProcedure, - opts..., + connect.WithSchema(gitHubActionsLogsServiceDumpLogsMethodDescriptor), + connect.WithClientOptions(opts...), ), } } // gitHubActionsLogsServiceClient implements GitHubActionsLogsServiceClient. type gitHubActionsLogsServiceClient struct { - streamWorkflowRunLogs *connect_go.Client[v1.StreamWorkflowRunLogsRequest, v1.StreamWorkflowRunLogsResponse] - dumpLogs *connect_go.Client[v1.DumpLogsRequest, v1.DumpLogsResponse] + streamWorkflowRunLogs *connect.Client[v1.StreamWorkflowRunLogsRequest, v1.StreamWorkflowRunLogsResponse] + dumpLogs *connect.Client[v1.DumpLogsRequest, v1.DumpLogsResponse] } // StreamWorkflowRunLogs calls // services.kon.github_actions.v1.GitHubActionsLogsService.StreamWorkflowRunLogs. -func (c *gitHubActionsLogsServiceClient) StreamWorkflowRunLogs(ctx context.Context, req *connect_go.Request[v1.StreamWorkflowRunLogsRequest]) (*connect_go.ServerStreamForClient[v1.StreamWorkflowRunLogsResponse], error) { +func (c *gitHubActionsLogsServiceClient) StreamWorkflowRunLogs(ctx context.Context, req *connect.Request[v1.StreamWorkflowRunLogsRequest]) (*connect.ServerStreamForClient[v1.StreamWorkflowRunLogsResponse], error) { return c.streamWorkflowRunLogs.CallServerStream(ctx, req) } // DumpLogs calls services.kon.github_actions.v1.GitHubActionsLogsService.DumpLogs. -func (c *gitHubActionsLogsServiceClient) DumpLogs(ctx context.Context, req *connect_go.Request[v1.DumpLogsRequest]) (*connect_go.Response[v1.DumpLogsResponse], error) { +func (c *gitHubActionsLogsServiceClient) DumpLogs(ctx context.Context, req *connect.Request[v1.DumpLogsRequest]) (*connect.Response[v1.DumpLogsResponse], error) { return c.dumpLogs.CallUnary(ctx, req) } // GitHubActionsLogsServiceHandler is an implementation of the // services.kon.github_actions.v1.GitHubActionsLogsService service. type GitHubActionsLogsServiceHandler interface { - StreamWorkflowRunLogs(context.Context, *connect_go.Request[v1.StreamWorkflowRunLogsRequest], *connect_go.ServerStream[v1.StreamWorkflowRunLogsResponse]) error - DumpLogs(context.Context, *connect_go.Request[v1.DumpLogsRequest]) (*connect_go.Response[v1.DumpLogsResponse], error) + StreamWorkflowRunLogs(context.Context, *connect.Request[v1.StreamWorkflowRunLogsRequest], *connect.ServerStream[v1.StreamWorkflowRunLogsResponse]) error + DumpLogs(context.Context, *connect.Request[v1.DumpLogsRequest]) (*connect.Response[v1.DumpLogsResponse], error) } // NewGitHubActionsLogsServiceHandler builds an HTTP handler from the service implementation. It @@ -101,16 +110,18 @@ type GitHubActionsLogsServiceHandler interface { // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. -func NewGitHubActionsLogsServiceHandler(svc GitHubActionsLogsServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { - gitHubActionsLogsServiceStreamWorkflowRunLogsHandler := connect_go.NewServerStreamHandler( +func NewGitHubActionsLogsServiceHandler(svc GitHubActionsLogsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + gitHubActionsLogsServiceStreamWorkflowRunLogsHandler := connect.NewServerStreamHandler( GitHubActionsLogsServiceStreamWorkflowRunLogsProcedure, svc.StreamWorkflowRunLogs, - opts..., + connect.WithSchema(gitHubActionsLogsServiceStreamWorkflowRunLogsMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - gitHubActionsLogsServiceDumpLogsHandler := connect_go.NewUnaryHandler( + gitHubActionsLogsServiceDumpLogsHandler := connect.NewUnaryHandler( GitHubActionsLogsServiceDumpLogsProcedure, svc.DumpLogs, - opts..., + connect.WithSchema(gitHubActionsLogsServiceDumpLogsMethodDescriptor), + connect.WithHandlerOptions(opts...), ) return "/services.kon.github_actions.v1.GitHubActionsLogsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { @@ -127,10 +138,10 @@ func NewGitHubActionsLogsServiceHandler(svc GitHubActionsLogsServiceHandler, opt // UnimplementedGitHubActionsLogsServiceHandler returns CodeUnimplemented from all methods. type UnimplementedGitHubActionsLogsServiceHandler struct{} -func (UnimplementedGitHubActionsLogsServiceHandler) StreamWorkflowRunLogs(context.Context, *connect_go.Request[v1.StreamWorkflowRunLogsRequest], *connect_go.ServerStream[v1.StreamWorkflowRunLogsResponse]) error { - return connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsLogsService.StreamWorkflowRunLogs is not implemented")) +func (UnimplementedGitHubActionsLogsServiceHandler) StreamWorkflowRunLogs(context.Context, *connect.Request[v1.StreamWorkflowRunLogsRequest], *connect.ServerStream[v1.StreamWorkflowRunLogsResponse]) error { + return connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsLogsService.StreamWorkflowRunLogs is not implemented")) } -func (UnimplementedGitHubActionsLogsServiceHandler) DumpLogs(context.Context, *connect_go.Request[v1.DumpLogsRequest]) (*connect_go.Response[v1.DumpLogsResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsLogsService.DumpLogs is not implemented")) +func (UnimplementedGitHubActionsLogsServiceHandler) DumpLogs(context.Context, *connect.Request[v1.DumpLogsRequest]) (*connect.Response[v1.DumpLogsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsLogsService.DumpLogs is not implemented")) } diff --git a/services/kon/github_actions/v1/github_actions_v1connect/build_project.connect.go b/services/kon/github_actions/v1/github_actions_v1connect/build_project.connect.go index 3f7f1890..609c29e8 100644 --- a/services/kon/github_actions/v1/github_actions_v1connect/build_project.connect.go +++ b/services/kon/github_actions/v1/github_actions_v1connect/build_project.connect.go @@ -5,9 +5,9 @@ package github_actions_v1connect import ( + connect "connectrpc.com/connect" context "context" errors "errors" - connect_go "github.com/bufbuild/connect-go" v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" http "net/http" strings "strings" @@ -18,7 +18,7 @@ import ( // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. -const _ = connect_go.IsAtLeastVersion0_1_0 +const _ = connect.IsAtLeastVersion1_13_0 const ( // GitHubActionsProjectServiceName is the fully-qualified name of the GitHubActionsProjectService @@ -48,13 +48,22 @@ const ( GitHubActionsProjectServiceListProjectsProcedure = "/services.kon.github_actions.v1.GitHubActionsProjectService/ListProjects" ) +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + gitHubActionsProjectServiceServiceDescriptor = v1.File_services_kon_github_actions_v1_build_project_proto.Services().ByName("GitHubActionsProjectService") + gitHubActionsProjectServiceCreateProjectMethodDescriptor = gitHubActionsProjectServiceServiceDescriptor.Methods().ByName("CreateProject") + gitHubActionsProjectServiceGetProjectMethodDescriptor = gitHubActionsProjectServiceServiceDescriptor.Methods().ByName("GetProject") + gitHubActionsProjectServiceDeleteProjectMethodDescriptor = gitHubActionsProjectServiceServiceDescriptor.Methods().ByName("DeleteProject") + gitHubActionsProjectServiceListProjectsMethodDescriptor = gitHubActionsProjectServiceServiceDescriptor.Methods().ByName("ListProjects") +) + // GitHubActionsProjectServiceClient is a client for the // services.kon.github_actions.v1.GitHubActionsProjectService service. type GitHubActionsProjectServiceClient interface { - CreateProject(context.Context, *connect_go.Request[v1.CreateProjectRequest]) (*connect_go.Response[v1.CreateProjectResponse], error) - GetProject(context.Context, *connect_go.Request[v1.GetProjectRequest]) (*connect_go.Response[v1.GetProjectResponse], error) - DeleteProject(context.Context, *connect_go.Request[v1.DeleteProjectRequest]) (*connect_go.Response[v1.DeleteProjectResponse], error) - ListProjects(context.Context, *connect_go.Request[v1.ListProjectsRequest]) (*connect_go.Response[v1.ListProjectsResponse], error) + CreateProject(context.Context, *connect.Request[v1.CreateProjectRequest]) (*connect.Response[v1.CreateProjectResponse], error) + GetProject(context.Context, *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.GetProjectResponse], error) + DeleteProject(context.Context, *connect.Request[v1.DeleteProjectRequest]) (*connect.Response[v1.DeleteProjectResponse], error) + ListProjects(context.Context, *connect.Request[v1.ListProjectsRequest]) (*connect.Response[v1.ListProjectsResponse], error) } // NewGitHubActionsProjectServiceClient constructs a client for the @@ -65,67 +74,71 @@ type GitHubActionsProjectServiceClient interface { // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). -func NewGitHubActionsProjectServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GitHubActionsProjectServiceClient { +func NewGitHubActionsProjectServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GitHubActionsProjectServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &gitHubActionsProjectServiceClient{ - createProject: connect_go.NewClient[v1.CreateProjectRequest, v1.CreateProjectResponse]( + createProject: connect.NewClient[v1.CreateProjectRequest, v1.CreateProjectResponse]( httpClient, baseURL+GitHubActionsProjectServiceCreateProjectProcedure, - opts..., + connect.WithSchema(gitHubActionsProjectServiceCreateProjectMethodDescriptor), + connect.WithClientOptions(opts...), ), - getProject: connect_go.NewClient[v1.GetProjectRequest, v1.GetProjectResponse]( + getProject: connect.NewClient[v1.GetProjectRequest, v1.GetProjectResponse]( httpClient, baseURL+GitHubActionsProjectServiceGetProjectProcedure, - opts..., + connect.WithSchema(gitHubActionsProjectServiceGetProjectMethodDescriptor), + connect.WithClientOptions(opts...), ), - deleteProject: connect_go.NewClient[v1.DeleteProjectRequest, v1.DeleteProjectResponse]( + deleteProject: connect.NewClient[v1.DeleteProjectRequest, v1.DeleteProjectResponse]( httpClient, baseURL+GitHubActionsProjectServiceDeleteProjectProcedure, - opts..., + connect.WithSchema(gitHubActionsProjectServiceDeleteProjectMethodDescriptor), + connect.WithClientOptions(opts...), ), - listProjects: connect_go.NewClient[v1.ListProjectsRequest, v1.ListProjectsResponse]( + listProjects: connect.NewClient[v1.ListProjectsRequest, v1.ListProjectsResponse]( httpClient, baseURL+GitHubActionsProjectServiceListProjectsProcedure, - opts..., + connect.WithSchema(gitHubActionsProjectServiceListProjectsMethodDescriptor), + connect.WithClientOptions(opts...), ), } } // gitHubActionsProjectServiceClient implements GitHubActionsProjectServiceClient. type gitHubActionsProjectServiceClient struct { - createProject *connect_go.Client[v1.CreateProjectRequest, v1.CreateProjectResponse] - getProject *connect_go.Client[v1.GetProjectRequest, v1.GetProjectResponse] - deleteProject *connect_go.Client[v1.DeleteProjectRequest, v1.DeleteProjectResponse] - listProjects *connect_go.Client[v1.ListProjectsRequest, v1.ListProjectsResponse] + createProject *connect.Client[v1.CreateProjectRequest, v1.CreateProjectResponse] + getProject *connect.Client[v1.GetProjectRequest, v1.GetProjectResponse] + deleteProject *connect.Client[v1.DeleteProjectRequest, v1.DeleteProjectResponse] + listProjects *connect.Client[v1.ListProjectsRequest, v1.ListProjectsResponse] } // CreateProject calls services.kon.github_actions.v1.GitHubActionsProjectService.CreateProject. -func (c *gitHubActionsProjectServiceClient) CreateProject(ctx context.Context, req *connect_go.Request[v1.CreateProjectRequest]) (*connect_go.Response[v1.CreateProjectResponse], error) { +func (c *gitHubActionsProjectServiceClient) CreateProject(ctx context.Context, req *connect.Request[v1.CreateProjectRequest]) (*connect.Response[v1.CreateProjectResponse], error) { return c.createProject.CallUnary(ctx, req) } // GetProject calls services.kon.github_actions.v1.GitHubActionsProjectService.GetProject. -func (c *gitHubActionsProjectServiceClient) GetProject(ctx context.Context, req *connect_go.Request[v1.GetProjectRequest]) (*connect_go.Response[v1.GetProjectResponse], error) { +func (c *gitHubActionsProjectServiceClient) GetProject(ctx context.Context, req *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.GetProjectResponse], error) { return c.getProject.CallUnary(ctx, req) } // DeleteProject calls services.kon.github_actions.v1.GitHubActionsProjectService.DeleteProject. -func (c *gitHubActionsProjectServiceClient) DeleteProject(ctx context.Context, req *connect_go.Request[v1.DeleteProjectRequest]) (*connect_go.Response[v1.DeleteProjectResponse], error) { +func (c *gitHubActionsProjectServiceClient) DeleteProject(ctx context.Context, req *connect.Request[v1.DeleteProjectRequest]) (*connect.Response[v1.DeleteProjectResponse], error) { return c.deleteProject.CallUnary(ctx, req) } // ListProjects calls services.kon.github_actions.v1.GitHubActionsProjectService.ListProjects. -func (c *gitHubActionsProjectServiceClient) ListProjects(ctx context.Context, req *connect_go.Request[v1.ListProjectsRequest]) (*connect_go.Response[v1.ListProjectsResponse], error) { +func (c *gitHubActionsProjectServiceClient) ListProjects(ctx context.Context, req *connect.Request[v1.ListProjectsRequest]) (*connect.Response[v1.ListProjectsResponse], error) { return c.listProjects.CallUnary(ctx, req) } // GitHubActionsProjectServiceHandler is an implementation of the // services.kon.github_actions.v1.GitHubActionsProjectService service. type GitHubActionsProjectServiceHandler interface { - CreateProject(context.Context, *connect_go.Request[v1.CreateProjectRequest]) (*connect_go.Response[v1.CreateProjectResponse], error) - GetProject(context.Context, *connect_go.Request[v1.GetProjectRequest]) (*connect_go.Response[v1.GetProjectResponse], error) - DeleteProject(context.Context, *connect_go.Request[v1.DeleteProjectRequest]) (*connect_go.Response[v1.DeleteProjectResponse], error) - ListProjects(context.Context, *connect_go.Request[v1.ListProjectsRequest]) (*connect_go.Response[v1.ListProjectsResponse], error) + CreateProject(context.Context, *connect.Request[v1.CreateProjectRequest]) (*connect.Response[v1.CreateProjectResponse], error) + GetProject(context.Context, *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.GetProjectResponse], error) + DeleteProject(context.Context, *connect.Request[v1.DeleteProjectRequest]) (*connect.Response[v1.DeleteProjectResponse], error) + ListProjects(context.Context, *connect.Request[v1.ListProjectsRequest]) (*connect.Response[v1.ListProjectsResponse], error) } // NewGitHubActionsProjectServiceHandler builds an HTTP handler from the service implementation. It @@ -133,26 +146,30 @@ type GitHubActionsProjectServiceHandler interface { // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. -func NewGitHubActionsProjectServiceHandler(svc GitHubActionsProjectServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { - gitHubActionsProjectServiceCreateProjectHandler := connect_go.NewUnaryHandler( +func NewGitHubActionsProjectServiceHandler(svc GitHubActionsProjectServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + gitHubActionsProjectServiceCreateProjectHandler := connect.NewUnaryHandler( GitHubActionsProjectServiceCreateProjectProcedure, svc.CreateProject, - opts..., + connect.WithSchema(gitHubActionsProjectServiceCreateProjectMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - gitHubActionsProjectServiceGetProjectHandler := connect_go.NewUnaryHandler( + gitHubActionsProjectServiceGetProjectHandler := connect.NewUnaryHandler( GitHubActionsProjectServiceGetProjectProcedure, svc.GetProject, - opts..., + connect.WithSchema(gitHubActionsProjectServiceGetProjectMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - gitHubActionsProjectServiceDeleteProjectHandler := connect_go.NewUnaryHandler( + gitHubActionsProjectServiceDeleteProjectHandler := connect.NewUnaryHandler( GitHubActionsProjectServiceDeleteProjectProcedure, svc.DeleteProject, - opts..., + connect.WithSchema(gitHubActionsProjectServiceDeleteProjectMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - gitHubActionsProjectServiceListProjectsHandler := connect_go.NewUnaryHandler( + gitHubActionsProjectServiceListProjectsHandler := connect.NewUnaryHandler( GitHubActionsProjectServiceListProjectsProcedure, svc.ListProjects, - opts..., + connect.WithSchema(gitHubActionsProjectServiceListProjectsMethodDescriptor), + connect.WithHandlerOptions(opts...), ) return "/services.kon.github_actions.v1.GitHubActionsProjectService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { @@ -173,18 +190,18 @@ func NewGitHubActionsProjectServiceHandler(svc GitHubActionsProjectServiceHandle // UnimplementedGitHubActionsProjectServiceHandler returns CodeUnimplemented from all methods. type UnimplementedGitHubActionsProjectServiceHandler struct{} -func (UnimplementedGitHubActionsProjectServiceHandler) CreateProject(context.Context, *connect_go.Request[v1.CreateProjectRequest]) (*connect_go.Response[v1.CreateProjectResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.CreateProject is not implemented")) +func (UnimplementedGitHubActionsProjectServiceHandler) CreateProject(context.Context, *connect.Request[v1.CreateProjectRequest]) (*connect.Response[v1.CreateProjectResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.CreateProject is not implemented")) } -func (UnimplementedGitHubActionsProjectServiceHandler) GetProject(context.Context, *connect_go.Request[v1.GetProjectRequest]) (*connect_go.Response[v1.GetProjectResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.GetProject is not implemented")) +func (UnimplementedGitHubActionsProjectServiceHandler) GetProject(context.Context, *connect.Request[v1.GetProjectRequest]) (*connect.Response[v1.GetProjectResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.GetProject is not implemented")) } -func (UnimplementedGitHubActionsProjectServiceHandler) DeleteProject(context.Context, *connect_go.Request[v1.DeleteProjectRequest]) (*connect_go.Response[v1.DeleteProjectResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.DeleteProject is not implemented")) +func (UnimplementedGitHubActionsProjectServiceHandler) DeleteProject(context.Context, *connect.Request[v1.DeleteProjectRequest]) (*connect.Response[v1.DeleteProjectResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.DeleteProject is not implemented")) } -func (UnimplementedGitHubActionsProjectServiceHandler) ListProjects(context.Context, *connect_go.Request[v1.ListProjectsRequest]) (*connect_go.Response[v1.ListProjectsResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.ListProjects is not implemented")) +func (UnimplementedGitHubActionsProjectServiceHandler) ListProjects(context.Context, *connect.Request[v1.ListProjectsRequest]) (*connect.Response[v1.ListProjectsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubActionsProjectService.ListProjects is not implemented")) } diff --git a/services/kon/github_actions/v1/github_actions_v1connect/events.connect.go b/services/kon/github_actions/v1/github_actions_v1connect/events.connect.go deleted file mode 100644 index 9662c14e..00000000 --- a/services/kon/github_actions/v1/github_actions_v1connect/events.connect.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by protoc-gen-connect-go. DO NOT EDIT. -// -// Source: services/kon/github_actions/v1/events.proto - -package github_actions_v1connect - -import ( - context "context" - errors "errors" - connect_go "github.com/bufbuild/connect-go" - _ "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" - emptypb "google.golang.org/protobuf/types/known/emptypb" - structpb "google.golang.org/protobuf/types/known/structpb" - http "net/http" - strings "strings" -) - -// This is a compile-time assertion to ensure that this generated file and the connect package are -// compatible. If you get a compiler error that this constant is not defined, this code was -// generated with a version of connect newer than the one compiled into your binary. You can fix the -// problem by either regenerating this code with an older version of connect or updating the connect -// version compiled into your binary. -const _ = connect_go.IsAtLeastVersion0_1_0 - -const ( - // GitHubWebhookListenerServiceName is the fully-qualified name of the GitHubWebhookListenerService - // service. - GitHubWebhookListenerServiceName = "services.kon.github_actions.v1.GitHubWebhookListenerService" -) - -// These constants are the fully-qualified names of the RPCs defined in this package. They're -// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. -// -// Note that these are different from the fully-qualified method names used by -// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to -// reflection-formatted method names, remove the leading slash and convert the remaining slash to a -// period. -const ( - // GitHubWebhookListenerServiceListenProcedure is the fully-qualified name of the - // GitHubWebhookListenerService's Listen RPC. - GitHubWebhookListenerServiceListenProcedure = "/services.kon.github_actions.v1.GitHubWebhookListenerService/Listen" -) - -// GitHubWebhookListenerServiceClient is a client for the -// services.kon.github_actions.v1.GitHubWebhookListenerService service. -type GitHubWebhookListenerServiceClient interface { - Listen(context.Context, *connect_go.Request[structpb.Struct]) (*connect_go.Response[emptypb.Empty], error) -} - -// NewGitHubWebhookListenerServiceClient constructs a client for the -// services.kon.github_actions.v1.GitHubWebhookListenerService service. By default, it uses the -// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends -// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or -// connect.WithGRPCWeb() options. -// -// The URL supplied here should be the base URL for the Connect or gRPC server (for example, -// http://api.acme.com or https://acme.com/grpc). -func NewGitHubWebhookListenerServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) GitHubWebhookListenerServiceClient { - baseURL = strings.TrimRight(baseURL, "/") - return &gitHubWebhookListenerServiceClient{ - listen: connect_go.NewClient[structpb.Struct, emptypb.Empty]( - httpClient, - baseURL+GitHubWebhookListenerServiceListenProcedure, - opts..., - ), - } -} - -// gitHubWebhookListenerServiceClient implements GitHubWebhookListenerServiceClient. -type gitHubWebhookListenerServiceClient struct { - listen *connect_go.Client[structpb.Struct, emptypb.Empty] -} - -// Listen calls services.kon.github_actions.v1.GitHubWebhookListenerService.Listen. -func (c *gitHubWebhookListenerServiceClient) Listen(ctx context.Context, req *connect_go.Request[structpb.Struct]) (*connect_go.Response[emptypb.Empty], error) { - return c.listen.CallUnary(ctx, req) -} - -// GitHubWebhookListenerServiceHandler is an implementation of the -// services.kon.github_actions.v1.GitHubWebhookListenerService service. -type GitHubWebhookListenerServiceHandler interface { - Listen(context.Context, *connect_go.Request[structpb.Struct]) (*connect_go.Response[emptypb.Empty], error) -} - -// NewGitHubWebhookListenerServiceHandler builds an HTTP handler from the service implementation. It -// returns the path on which to mount the handler and the handler itself. -// -// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf -// and JSON codecs. They also support gzip compression. -func NewGitHubWebhookListenerServiceHandler(svc GitHubWebhookListenerServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { - mux := http.NewServeMux() - mux.Handle(GitHubWebhookListenerServiceListenProcedure, connect_go.NewUnaryHandler( - GitHubWebhookListenerServiceListenProcedure, - svc.Listen, - opts..., - )) - return "/services.kon.github_actions.v1.GitHubWebhookListenerService/", mux -} - -// UnimplementedGitHubWebhookListenerServiceHandler returns CodeUnimplemented from all methods. -type UnimplementedGitHubWebhookListenerServiceHandler struct{} - -func (UnimplementedGitHubWebhookListenerServiceHandler) Listen(context.Context, *connect_go.Request[structpb.Struct]) (*connect_go.Response[emptypb.Empty], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.kon.github_actions.v1.GitHubWebhookListenerService.Listen is not implemented")) -} diff --git a/services/kon/github_actions/v1/server/build_job.go b/services/kon/github_actions/v1/server/build_job.go index 14277adb..b9d936fb 100644 --- a/services/kon/github_actions/v1/server/build_job.go +++ b/services/kon/github_actions/v1/server/build_job.go @@ -4,25 +4,26 @@ import ( "context" "fmt" - connect_go "github.com/bufbuild/connect-go" + "connectrpc.com/connect" + "github.com/google/go-github/v56/github" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + common_v1 "github.com/containerish/OpenRegistry/common/v1" v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" "github.com/containerish/OpenRegistry/store/v1/types" - "github.com/google/go-github/v56/github" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) // BulkDeleteBuildJobs implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) BulkDeleteBuildJobs( ctx context.Context, - req *connect_go.Request[v1.BulkDeleteBuildJobsRequest], + req *connect.Request[v1.BulkDeleteBuildJobsRequest], ) ( - *connect_go.Response[v1.BulkDeleteBuildJobsResponse], + *connect.Response[v1.BulkDeleteBuildJobsResponse], error, ) { // githubClient := gha.getGithubClientFromContext(ctx) // if err := req.Msg.Validate(); err != nil { - // return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + // return nil, connect.NewError(connect.CodeInvalidArgument, err) // } // // errList := []error{} @@ -34,16 +35,16 @@ func (gha *GitHubActionsServer) BulkDeleteBuildJobs( // } // // if len(errList) > 0 { - // return nil, connect_go.NewError(connect_go.CodeInternal, fmt.Errorf("%v", errList)) + // return nil, connect.NewError(connect.CodeInternal, fmt.Errorf("%v", errList)) // } // - // return connect_go.NewResponse(&v1.BulkDeleteBuildJobsResponse{ + // return connect.NewResponse(&v1.BulkDeleteBuildJobsResponse{ // Message: fmt.Sprintf("%d build jobs deleted successfully", len(req.Msg.GetJobIds())), // }), nil gha.logger.Debug().Str("procedure", req.Spec().Procedure).Bool("method_not_implemented", true).Send() return nil, - connect_go.NewError( - connect_go.CodeUnimplemented, + connect.NewError( + connect.CodeUnimplemented, fmt.Errorf("bulk job deletion is not supported by GitHub Actions integration"), ) } @@ -51,9 +52,9 @@ func (gha *GitHubActionsServer) BulkDeleteBuildJobs( // CancelBuild implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) CancelBuild( ctx context.Context, - req *connect_go.Request[v1.CancelBuildRequest], + req *connect.Request[v1.CancelBuildRequest], ) ( - *connect_go.Response[v1.CancelBuildResponse], + *connect.Response[v1.CancelBuildResponse], error, ) { logEvent := gha.logger.Debug().Str("procedure", req.Spec().Procedure) @@ -62,7 +63,7 @@ func (gha *GitHubActionsServer) CancelBuild( if err := req.Msg.Validate(); err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } _, err := githubClient.Actions.CancelWorkflowRunByID( @@ -73,11 +74,11 @@ func (gha *GitHubActionsServer) CancelBuild( ) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(&v1.CancelBuildResponse{ + return connect.NewResponse(&v1.CancelBuildResponse{ Message: "build job canceled successfully", }), nil } @@ -87,26 +88,26 @@ func (gha *GitHubActionsServer) CancelBuild( // or deleting them isn't the best we can provide to the user. func (gha *GitHubActionsServer) DeleteJob( ctx context.Context, - req *connect_go.Request[v1.DeleteJobRequest], + req *connect.Request[v1.DeleteJobRequest], ) ( - *connect_go.Response[v1.DeleteJobResponse], + *connect.Response[v1.DeleteJobResponse], error, ) { // githubClient := gha.getGithubClientFromContext(ctx) // user := ctx.Value(OpenRegistryUserContextKey).(*types.User) // if err := req.Msg.Validate(); err != nil { - // return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + // return nil, connect.NewError(connect.CodeInvalidArgument, err) // } // _, err := githubClient.Actions.DeleteWorkflowRun(ctx, user.Username, req.Msg.GetRepo(), req.Msg.GetRunId()) // if err != nil { - // return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + // return nil, connect.NewError(connect.CodeInvalidArgument, err) // } gha.logger.Debug().Str("procedure", req.Spec().Procedure).Bool("method_not_implemented", true).Send() return nil, - connect_go.NewError( - connect_go.CodeUnimplemented, + connect.NewError( + connect.CodeUnimplemented, fmt.Errorf("job deletion is not supported by GitHub Actions integration"), ) } @@ -114,16 +115,16 @@ func (gha *GitHubActionsServer) DeleteJob( // GetBuildJob implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) GetBuildJob( ctx context.Context, - req *connect_go.Request[v1.GetBuildJobRequest], + req *connect.Request[v1.GetBuildJobRequest], ) ( - *connect_go.Response[v1.GetBuildJobResponse], + *connect.Response[v1.GetBuildJobResponse], error, ) { logEvent := gha.logger.Debug().Str("procedure", req.Spec().Procedure) err := req.Msg.Validate() if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } user := ctx.Value(OpenRegistryUserContextKey).(*types.User) @@ -139,10 +140,10 @@ func (gha *GitHubActionsServer) GetBuildJob( ) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } - resp := connect_go.NewResponse(&v1.GetBuildJobResponse{ + resp := connect.NewResponse(&v1.GetBuildJobResponse{ // Id: job.GetID(), LogsUrl: job.GetLogsURL(), Status: job.GetStatus(), @@ -161,16 +162,16 @@ func (gha *GitHubActionsServer) GetBuildJob( // ListBuildJobs implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) ListBuildJobs( ctx context.Context, - req *connect_go.Request[v1.ListBuildJobsRequest], + req *connect.Request[v1.ListBuildJobsRequest], ) ( - *connect_go.Response[v1.ListBuildJobsResponse], + *connect.Response[v1.ListBuildJobsResponse], error, ) { logEvent := gha.logger.Debug().Str("procedure", req.Spec().Procedure) err := req.Msg.Validate() if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } user := ctx.Value(OpenRegistryUserContextKey).(*types.User) @@ -183,10 +184,9 @@ func (gha *GitHubActionsServer) ListBuildJobs( ListOptions: github.ListOptions{Page: 0, PerPage: 75}, }, ) - if err != nil { logEvent.Err(err).Any("request_body", req.Msg).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } jobs := []*v1.GetBuildJobResponse{} @@ -210,31 +210,31 @@ func (gha *GitHubActionsServer) ListBuildJobs( } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(&v1.ListBuildJobsResponse{Jobs: jobs}), nil + return connect.NewResponse(&v1.ListBuildJobsResponse{Jobs: jobs}), nil } // StoreJob implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) StoreJob( ctx context.Context, - req *connect_go.Request[v1.StoreJobRequest], -) (*connect_go.Response[v1.StoreJobResponse], error) { + req *connect.Request[v1.StoreJobRequest], +) (*connect.Response[v1.StoreJobResponse], error) { // err := req.Msg.Validate() // if err != nil { - // return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + // return nil, connect.NewError(connect.CodeInvalidArgument, err) // } // // req.Msg.TriggeredAt = timestamppb.New(time.Now()) // if err = gha.store.StoreJob(ctx, req.Msg); err != nil { - // return nil, connect_go.NewError(connect_go.CodeInternal, err) + // return nil, connect.NewError(connect.CodeInternal, err) // } - // return connect_go.NewResponse(&v1.StoreJobResponse{ + // return connect.NewResponse(&v1.StoreJobResponse{ // Message: "job stored successfully", // }), nil gha.logger.Debug().Str("procedure", req.Spec().Procedure).Bool("method_not_implemented", true).Send() - return nil, connect_go.NewError( - connect_go.CodeUnimplemented, + return nil, connect.NewError( + connect.CodeUnimplemented, fmt.Errorf("job storing is not supported by GitHub Actions integration"), ) } @@ -242,9 +242,9 @@ func (gha *GitHubActionsServer) StoreJob( // TriggerBuild implements github_actions_v1connect.GithubActionsBuildServiceHandler func (gha *GitHubActionsServer) TriggerBuild( ctx context.Context, - req *connect_go.Request[v1.TriggerBuildRequest], + req *connect.Request[v1.TriggerBuildRequest], ) ( - *connect_go.Response[v1.TriggerBuildResponse], + *connect.Response[v1.TriggerBuildResponse], error, ) { logEvent := gha.logger.Debug().Str("procedure", req.Spec().Procedure) @@ -253,7 +253,7 @@ func (gha *GitHubActionsServer) TriggerBuild( if err := req.Msg.Validate(); err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } _, err := githubClient.Actions.RerunWorkflowByID( @@ -263,14 +263,13 @@ func (gha *GitHubActionsServer) TriggerBuild( 0, // req.Msg.GetRunId(), ) - if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(&v1.TriggerBuildResponse{ + return connect.NewResponse(&v1.TriggerBuildResponse{ Message: "job triggered successfully", }), nil } diff --git a/services/kon/github_actions/v1/server/build_logs.go b/services/kon/github_actions/v1/server/build_logs.go index dcaafebe..6a8abd4c 100644 --- a/services/kon/github_actions/v1/server/build_logs.go +++ b/services/kon/github_actions/v1/server/build_logs.go @@ -1,22 +1,22 @@ package server import ( - "net/url" - "archive/zip" "bytes" "context" "fmt" "net/http" + "net/url" "strconv" "strings" "time" + "connectrpc.com/connect" "github.com/bradleyfalzon/ghinstallation/v2" - connect_go "github.com/bufbuild/connect-go" + "github.com/google/go-github/v56/github" + github_actions_v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" github_impl "github.com/containerish/OpenRegistry/vcs/github" - "github.com/google/go-github/v56/github" ) type WorkflowStep struct { @@ -27,8 +27,8 @@ type WorkflowStep struct { func (ghs *GitHubActionsServer) streamPreviousRunLogs( ctx context.Context, - req *connect_go.Request[github_actions_v1.StreamWorkflowRunLogsRequest], - stream *connect_go.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], + req *connect.Request[github_actions_v1.StreamWorkflowRunLogsRequest], + stream *connect.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], githubClient *github.Client, ) error { logEvent := ghs.logger.Debug().Str("method", "streamPreviousRunLogs") @@ -44,19 +44,19 @@ func (ghs *GitHubActionsServer) streamPreviousRunLogs( ) if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeUnavailable, err) + return connect.NewError(connect.CodeUnavailable, err) } if len(runs.WorkflowRuns) < 1 { errMsg := fmt.Errorf("no github actions run found for this id") logEvent.Err(errMsg).Send() - return connect_go.NewError(connect_go.CodeInvalidArgument, errMsg) + return connect.NewError(connect.CodeInvalidArgument, errMsg) } workflowSteps, err := ghs.getLogsToStream(ctx, githubClient, runs.WorkflowRuns[0].GetLogsURL()) if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeInvalidArgument, err) + return connect.NewError(connect.CodeInvalidArgument, err) } for _, step := range workflowSteps { @@ -71,12 +71,12 @@ func (ghs *GitHubActionsServer) streamPreviousRunLogs( func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( ctx context.Context, - req *connect_go.Request[github_actions_v1.StreamWorkflowRunLogsRequest], - stream *connect_go.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], + req *connect.Request[github_actions_v1.StreamWorkflowRunLogsRequest], + stream *connect.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], ) error { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) if err := req.Msg.Validate(); err != nil { - return connect_go.NewError(connect_go.CodeInvalidArgument, err) + return connect.NewError(connect.CodeInvalidArgument, err) } logEvent. @@ -89,8 +89,8 @@ func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( if !ok { errMsg := fmt.Errorf("github app installation id not found for user") logEvent.Err(errMsg).Send() - return connect_go.NewError( - connect_go.CodeInvalidArgument, errMsg, + return connect.NewError( + connect.CodeInvalidArgument, errMsg, ) } @@ -106,7 +106,7 @@ func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( err := ghs.waitForJobToFinish(ctx, githubClient, req, stream) if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeInvalidArgument, err) + return connect.NewError(connect.CodeInvalidArgument, err) } delete(ghs.activeLogStreamJobs, ghs.getLogsEventKey(req.Msg)) @@ -119,7 +119,7 @@ func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( if !ok { errMsg := fmt.Errorf("missing GitHub App installation ID") logEvent.Err(errMsg).Send() - return connect_go.NewError(connect_go.CodeInternal, errMsg) + return connect.NewError(connect.CodeInternal, errMsg) } client := ghs.refreshGHClient(githubAppInstallation) @@ -134,17 +134,16 @@ func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( }, }, ) - if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeInternal, err) + return connect.NewError(connect.CodeInternal, err) } runID := actionRuns.WorkflowRuns[0].GetID() uri, err := ghs.getWorkflowRunLogsURL(ctx, req.Msg.GetRepoOwner(), req.Msg.GetRepoName(), runID) if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeNotFound, err) + return connect.NewError(connect.CodeNotFound, err) } workflowSteps, err := ghs.getLogsToStream(ctx, githubClient, uri.String()) @@ -158,7 +157,6 @@ func (ghs *GitHubActionsServer) StreamWorkflowRunLogs( LogMessage: step.Buf.String(), MsgType: github_actions_v1.StreamWorkflowRunMessageType_STREAM_WORKFLOW_RUN_MESSAGE_TYPE_STEP, }) - } logEvent.Bool("success", true).Send() @@ -220,7 +218,6 @@ func (ghs *GitHubActionsServer) retryGetWorkflowRunLogsURL( } return logsUrl, logsErr - } func (ghs *GitHubActionsServer) getWorkflowRunLogsURL( @@ -236,22 +233,22 @@ func (ghs *GitHubActionsServer) getWorkflowRunLogsURL( func (ghs *GitHubActionsServer) DumpLogs( ctx context.Context, - req *connect_go.Request[github_actions_v1.DumpLogsRequest], + req *connect.Request[github_actions_v1.DumpLogsRequest], ) ( - *connect_go.Response[github_actions_v1.DumpLogsResponse], + *connect.Response[github_actions_v1.DumpLogsResponse], error, ) { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) if err := req.Msg.Validate(); err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } ghAppInstallationID, ok := ctx.Value(github_impl.GithubInstallationIDContextKey).(int64) if !ok { errMsg := fmt.Errorf("github app installation id not found for user") logEvent.Err(errMsg).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, errMsg) + return nil, connect.NewError(connect.CodeInvalidArgument, errMsg) } githubClient := ghs.refreshGHClient(ghAppInstallationID) @@ -268,19 +265,19 @@ func (ghs *GitHubActionsServer) DumpLogs( ) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeUnavailable, err) + return nil, connect.NewError(connect.CodeUnavailable, err) } if len(runs.WorkflowRuns) < 1 { errMsg := fmt.Errorf("no github actions run found for this id") logEvent.Err(errMsg).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, errMsg) + return nil, connect.NewError(connect.CodeInvalidArgument, errMsg) } workflowSteps, err := ghs.getLogsToStream(ctx, githubClient, runs.WorkflowRuns[0].GetLogsURL()) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } var logs []string for _, step := range workflowSteps { @@ -288,7 +285,7 @@ func (ghs *GitHubActionsServer) DumpLogs( } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(&github_actions_v1.DumpLogsResponse{Logs: logs}), nil + return connect.NewResponse(&github_actions_v1.DumpLogsResponse{Logs: logs}), nil } func (ghs *GitHubActionsServer) getLogsEventKey(job *github_actions_v1.StreamWorkflowRunLogsRequest) string { @@ -312,8 +309,8 @@ func (ghs *GitHubActionsServer) getFileInfo(fi *zip.File) (string, int64) { func (ghs *GitHubActionsServer) waitForJobToFinish( ctx context.Context, githubClient *github.Client, - req *connect_go.Request[github_actions_v1.StreamWorkflowRunLogsRequest], - stream *connect_go.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], + req *connect.Request[github_actions_v1.StreamWorkflowRunLogsRequest], + stream *connect.ServerStream[github_actions_v1.StreamWorkflowRunLogsResponse], ) error { now := time.Now() logEvent := ghs.logger.Debug(). @@ -330,7 +327,7 @@ func (ghs *GitHubActionsServer) waitForJobToFinish( ) if err != nil { logEvent.Err(err).Send() - return connect_go.NewError(connect_go.CodeInvalidArgument, err) + return connect.NewError(connect.CodeInvalidArgument, err) } logEvent.Str("status", workflowRun.GetStatus()) diff --git a/services/kon/github_actions/v1/server/build_project.go b/services/kon/github_actions/v1/server/build_project.go index b39f32af..8147aad6 100644 --- a/services/kon/github_actions/v1/server/build_project.go +++ b/services/kon/github_actions/v1/server/build_project.go @@ -3,27 +3,28 @@ package server import ( "context" - connect_go "github.com/bufbuild/connect-go" + "connectrpc.com/connect" + "github.com/google/uuid" + "google.golang.org/protobuf/types/known/timestamppb" + common_v1 "github.com/containerish/OpenRegistry/common/v1" github_actions_v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" "github.com/containerish/OpenRegistry/store/v1/types" - "github.com/google/uuid" - "google.golang.org/protobuf/types/known/timestamppb" ) // CreateProject implements github_actions_v1connect.GitHubActionsProjectServiceHandler func (ghs *GitHubActionsServer) CreateProject( ctx context.Context, - req *connect_go.Request[github_actions_v1.CreateProjectRequest], + req *connect.Request[github_actions_v1.CreateProjectRequest], ) ( - *connect_go.Response[github_actions_v1.CreateProjectResponse], + *connect.Response[github_actions_v1.CreateProjectResponse], error, ) { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) err := req.Msg.Validate() if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } req.Msg.Id = &common_v1.UUID{ @@ -32,10 +33,10 @@ func (ghs *GitHubActionsServer) CreateProject( req.Msg.CreatedAt = timestamppb.Now() if err = ghs.store.StoreProject(ctx, req.Msg); err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } - resp := connect_go.NewResponse(&github_actions_v1.CreateProjectResponse{ + resp := connect.NewResponse(&github_actions_v1.CreateProjectResponse{ Message: "project created successfully", Id: req.Msg.GetId(), }) @@ -47,24 +48,24 @@ func (ghs *GitHubActionsServer) CreateProject( // DeleteProject implements github_actions_v1connect.GitHubActionsProjectServiceHandler func (ghs *GitHubActionsServer) DeleteProject( ctx context.Context, - req *connect_go.Request[github_actions_v1.DeleteProjectRequest], + req *connect.Request[github_actions_v1.DeleteProjectRequest], ) ( - *connect_go.Response[github_actions_v1.DeleteProjectResponse], + *connect.Response[github_actions_v1.DeleteProjectResponse], error, ) { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) err := req.Msg.Validate() if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } if err = ghs.store.DeleteProject(ctx, req.Msg); err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } - resp := connect_go.NewResponse(&github_actions_v1.DeleteProjectResponse{ + resp := connect.NewResponse(&github_actions_v1.DeleteProjectResponse{ Message: "project deleted successfully", }) @@ -75,32 +76,32 @@ func (ghs *GitHubActionsServer) DeleteProject( // GetProject implements github_actions_v1connect.GitHubActionsProjectServiceHandler func (ghs *GitHubActionsServer) GetProject( ctx context.Context, - req *connect_go.Request[github_actions_v1.GetProjectRequest], + req *connect.Request[github_actions_v1.GetProjectRequest], ) ( - *connect_go.Response[github_actions_v1.GetProjectResponse], + *connect.Response[github_actions_v1.GetProjectResponse], error, ) { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) if err := req.Msg.Validate(); err != nil { - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } project, err := ghs.store.GetProject(ctx, req.Msg) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(project), nil + return connect.NewResponse(project), nil } // ListProjects implements github_actions_v1connect.GitHubActionsProjectServiceHandler func (ghs *GitHubActionsServer) ListProjects( ctx context.Context, - req *connect_go.Request[github_actions_v1.ListProjectsRequest], + req *connect.Request[github_actions_v1.ListProjectsRequest], ) ( - *connect_go.Response[github_actions_v1.ListProjectsResponse], + *connect.Response[github_actions_v1.ListProjectsResponse], error, ) { logEvent := ghs.logger.Debug().Str("procedure", req.Spec().Procedure) @@ -108,7 +109,7 @@ func (ghs *GitHubActionsServer) ListProjects( err := req.Msg.Validate() if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInvalidArgument, err) + return nil, connect.NewError(connect.CodeInvalidArgument, err) } req.Msg.OwnerId = &common_v1.UUID{ @@ -118,9 +119,9 @@ func (ghs *GitHubActionsServer) ListProjects( projects, err := ghs.store.ListProjects(ctx, req.Msg) if err != nil { logEvent.Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } logEvent.Bool("success", true).Send() - return connect_go.NewResponse(projects), nil + return connect.NewResponse(projects), nil } diff --git a/services/kon/github_actions/v1/server/github_action_logs.go b/services/kon/github_actions/v1/server/github_action_logs.go index 9a6463ec..547c8fc4 100644 --- a/services/kon/github_actions/v1/server/github_action_logs.go +++ b/services/kon/github_actions/v1/server/github_action_logs.go @@ -9,7 +9,7 @@ import ( "net/http" "sort" - connect_go "github.com/bufbuild/connect-go" + "connectrpc.com/connect" "github.com/google/go-github/v56/github" ) @@ -21,14 +21,14 @@ func (ghs *GitHubActionsServer) getLogsToStream( downloadLogsReq, err := http.NewRequestWithContext(ctx, http.MethodGet, logsURL, nil) if err != nil { ghs.logger.Debug().Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } downloadLogsReq.Header.Set("Accept", "application/json") downloadLogsResp, err := githubClient.BareDo(ctx, downloadLogsReq) if err != nil { ghs.logger.Debug().Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } defer downloadLogsResp.Body.Close() @@ -36,14 +36,14 @@ func (ghs *GitHubActionsServer) getLogsToStream( _, err = io.Copy(&buf, downloadLogsResp.Body) if err != nil { ghs.logger.Debug().Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } reader := bytes.NewReader(buf.Bytes()) zipReader, err := zip.NewReader(reader, int64(buf.Len())) if err != nil { ghs.logger.Debug().Err(err).Send() - return nil, connect_go.NewError(connect_go.CodeInternal, err) + return nil, connect.NewError(connect.CodeInternal, err) } logEvent := ghs.logger.Debug().Int("zip_file_count", len(zipReader.File)) diff --git a/services/kon/github_actions/v1/server/interceptor.go b/services/kon/github_actions/v1/server/interceptor.go index d76fc74f..069aec9f 100644 --- a/services/kon/github_actions/v1/server/interceptor.go +++ b/services/kon/github_actions/v1/server/interceptor.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/bufbuild/connect-go" + "connectrpc.com/connect" "github.com/containerish/OpenRegistry/config" "github.com/containerish/OpenRegistry/store/v1/types" diff --git a/services/kon/github_actions/v1/server/interceptor_helpers.go b/services/kon/github_actions/v1/server/interceptor_helpers.go index 4d3cad0f..331b3392 100644 --- a/services/kon/github_actions/v1/server/interceptor_helpers.go +++ b/services/kon/github_actions/v1/server/interceptor_helpers.go @@ -7,11 +7,12 @@ import ( "net/url" "strings" - "github.com/bufbuild/connect-go" - "github.com/containerish/OpenRegistry/auth" - "github.com/containerish/OpenRegistry/telemetry" + "connectrpc.com/connect" "github.com/golang-jwt/jwt/v5" "github.com/google/uuid" + + "github.com/containerish/OpenRegistry/auth" + "github.com/containerish/OpenRegistry/telemetry" ) func getTokenFromReq(req connect.AnyRequest, jwtSigningPubKey *rsa.PublicKey) (uuid.UUID, error) { diff --git a/services/kon/github_actions/v1/server/server.go b/services/kon/github_actions/v1/server/server.go index ded25bf2..b25e66cc 100644 --- a/services/kon/github_actions/v1/server/server.go +++ b/services/kon/github_actions/v1/server/server.go @@ -5,16 +5,17 @@ import ( "net/http" "sync" + "connectrpc.com/connect" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/bufbuild/connect-go" + "github.com/fatih/color" + "github.com/google/go-github/v56/github" + "github.com/containerish/OpenRegistry/config" github_actions_v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1" connect_v1 "github.com/containerish/OpenRegistry/services/kon/github_actions/v1/github_actions_v1connect" "github.com/containerish/OpenRegistry/store/v1/automation" "github.com/containerish/OpenRegistry/telemetry" "github.com/containerish/OpenRegistry/vcs" - "github.com/fatih/color" - "github.com/google/go-github/v56/github" ) type GitHubActionsServer struct { diff --git a/services/yor/clair/v1/clairconnect/clair.connect.go b/services/yor/clair/v1/clairconnect/clair.connect.go index db62506a..3af942a5 100644 --- a/services/yor/clair/v1/clairconnect/clair.connect.go +++ b/services/yor/clair/v1/clairconnect/clair.connect.go @@ -5,9 +5,9 @@ package clairconnect import ( + connect "connectrpc.com/connect" context "context" errors "errors" - connect_go "github.com/bufbuild/connect-go" v1 "github.com/containerish/OpenRegistry/services/yor/clair/v1" http "net/http" strings "strings" @@ -18,7 +18,7 @@ import ( // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. -const _ = connect_go.IsAtLeastVersion0_1_0 +const _ = connect.IsAtLeastVersion1_13_0 const ( // ClairServiceName is the fully-qualified name of the ClairService service. @@ -44,11 +44,19 @@ const ( ClairServiceEnableVulnerabilityScanningProcedure = "/services.yor.clair.v1.ClairService/EnableVulnerabilityScanning" ) +// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. +var ( + clairServiceServiceDescriptor = v1.File_services_yor_clair_v1_clair_proto.Services().ByName("ClairService") + clairServiceSubmitManifestToScanMethodDescriptor = clairServiceServiceDescriptor.Methods().ByName("SubmitManifestToScan") + clairServiceGetVulnerabilityReportMethodDescriptor = clairServiceServiceDescriptor.Methods().ByName("GetVulnerabilityReport") + clairServiceEnableVulnerabilityScanningMethodDescriptor = clairServiceServiceDescriptor.Methods().ByName("EnableVulnerabilityScanning") +) + // ClairServiceClient is a client for the services.yor.clair.v1.ClairService service. type ClairServiceClient interface { - SubmitManifestToScan(context.Context, *connect_go.Request[v1.SubmitManifestToScanRequest]) (*connect_go.Response[v1.SubmitManifestToScanResponse], error) - GetVulnerabilityReport(context.Context, *connect_go.Request[v1.GetVulnerabilityReportRequest]) (*connect_go.Response[v1.GetVulnerabilityReportResponse], error) - EnableVulnerabilityScanning(context.Context, *connect_go.Request[v1.EnableVulnerabilityScanningRequest]) (*connect_go.Response[v1.EnableVulnerabilityScanningResponse], error) + SubmitManifestToScan(context.Context, *connect.Request[v1.SubmitManifestToScanRequest]) (*connect.Response[v1.SubmitManifestToScanResponse], error) + GetVulnerabilityReport(context.Context, *connect.Request[v1.GetVulnerabilityReportRequest]) (*connect.Response[v1.GetVulnerabilityReportResponse], error) + EnableVulnerabilityScanning(context.Context, *connect.Request[v1.EnableVulnerabilityScanningRequest]) (*connect.Response[v1.EnableVulnerabilityScanningResponse], error) } // NewClairServiceClient constructs a client for the services.yor.clair.v1.ClairService service. By @@ -58,54 +66,57 @@ type ClairServiceClient interface { // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). -func NewClairServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) ClairServiceClient { +func NewClairServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ClairServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &clairServiceClient{ - submitManifestToScan: connect_go.NewClient[v1.SubmitManifestToScanRequest, v1.SubmitManifestToScanResponse]( + submitManifestToScan: connect.NewClient[v1.SubmitManifestToScanRequest, v1.SubmitManifestToScanResponse]( httpClient, baseURL+ClairServiceSubmitManifestToScanProcedure, - opts..., + connect.WithSchema(clairServiceSubmitManifestToScanMethodDescriptor), + connect.WithClientOptions(opts...), ), - getVulnerabilityReport: connect_go.NewClient[v1.GetVulnerabilityReportRequest, v1.GetVulnerabilityReportResponse]( + getVulnerabilityReport: connect.NewClient[v1.GetVulnerabilityReportRequest, v1.GetVulnerabilityReportResponse]( httpClient, baseURL+ClairServiceGetVulnerabilityReportProcedure, - opts..., + connect.WithSchema(clairServiceGetVulnerabilityReportMethodDescriptor), + connect.WithClientOptions(opts...), ), - enableVulnerabilityScanning: connect_go.NewClient[v1.EnableVulnerabilityScanningRequest, v1.EnableVulnerabilityScanningResponse]( + enableVulnerabilityScanning: connect.NewClient[v1.EnableVulnerabilityScanningRequest, v1.EnableVulnerabilityScanningResponse]( httpClient, baseURL+ClairServiceEnableVulnerabilityScanningProcedure, - opts..., + connect.WithSchema(clairServiceEnableVulnerabilityScanningMethodDescriptor), + connect.WithClientOptions(opts...), ), } } // clairServiceClient implements ClairServiceClient. type clairServiceClient struct { - submitManifestToScan *connect_go.Client[v1.SubmitManifestToScanRequest, v1.SubmitManifestToScanResponse] - getVulnerabilityReport *connect_go.Client[v1.GetVulnerabilityReportRequest, v1.GetVulnerabilityReportResponse] - enableVulnerabilityScanning *connect_go.Client[v1.EnableVulnerabilityScanningRequest, v1.EnableVulnerabilityScanningResponse] + submitManifestToScan *connect.Client[v1.SubmitManifestToScanRequest, v1.SubmitManifestToScanResponse] + getVulnerabilityReport *connect.Client[v1.GetVulnerabilityReportRequest, v1.GetVulnerabilityReportResponse] + enableVulnerabilityScanning *connect.Client[v1.EnableVulnerabilityScanningRequest, v1.EnableVulnerabilityScanningResponse] } // SubmitManifestToScan calls services.yor.clair.v1.ClairService.SubmitManifestToScan. -func (c *clairServiceClient) SubmitManifestToScan(ctx context.Context, req *connect_go.Request[v1.SubmitManifestToScanRequest]) (*connect_go.Response[v1.SubmitManifestToScanResponse], error) { +func (c *clairServiceClient) SubmitManifestToScan(ctx context.Context, req *connect.Request[v1.SubmitManifestToScanRequest]) (*connect.Response[v1.SubmitManifestToScanResponse], error) { return c.submitManifestToScan.CallUnary(ctx, req) } // GetVulnerabilityReport calls services.yor.clair.v1.ClairService.GetVulnerabilityReport. -func (c *clairServiceClient) GetVulnerabilityReport(ctx context.Context, req *connect_go.Request[v1.GetVulnerabilityReportRequest]) (*connect_go.Response[v1.GetVulnerabilityReportResponse], error) { +func (c *clairServiceClient) GetVulnerabilityReport(ctx context.Context, req *connect.Request[v1.GetVulnerabilityReportRequest]) (*connect.Response[v1.GetVulnerabilityReportResponse], error) { return c.getVulnerabilityReport.CallUnary(ctx, req) } // EnableVulnerabilityScanning calls services.yor.clair.v1.ClairService.EnableVulnerabilityScanning. -func (c *clairServiceClient) EnableVulnerabilityScanning(ctx context.Context, req *connect_go.Request[v1.EnableVulnerabilityScanningRequest]) (*connect_go.Response[v1.EnableVulnerabilityScanningResponse], error) { +func (c *clairServiceClient) EnableVulnerabilityScanning(ctx context.Context, req *connect.Request[v1.EnableVulnerabilityScanningRequest]) (*connect.Response[v1.EnableVulnerabilityScanningResponse], error) { return c.enableVulnerabilityScanning.CallUnary(ctx, req) } // ClairServiceHandler is an implementation of the services.yor.clair.v1.ClairService service. type ClairServiceHandler interface { - SubmitManifestToScan(context.Context, *connect_go.Request[v1.SubmitManifestToScanRequest]) (*connect_go.Response[v1.SubmitManifestToScanResponse], error) - GetVulnerabilityReport(context.Context, *connect_go.Request[v1.GetVulnerabilityReportRequest]) (*connect_go.Response[v1.GetVulnerabilityReportResponse], error) - EnableVulnerabilityScanning(context.Context, *connect_go.Request[v1.EnableVulnerabilityScanningRequest]) (*connect_go.Response[v1.EnableVulnerabilityScanningResponse], error) + SubmitManifestToScan(context.Context, *connect.Request[v1.SubmitManifestToScanRequest]) (*connect.Response[v1.SubmitManifestToScanResponse], error) + GetVulnerabilityReport(context.Context, *connect.Request[v1.GetVulnerabilityReportRequest]) (*connect.Response[v1.GetVulnerabilityReportResponse], error) + EnableVulnerabilityScanning(context.Context, *connect.Request[v1.EnableVulnerabilityScanningRequest]) (*connect.Response[v1.EnableVulnerabilityScanningResponse], error) } // NewClairServiceHandler builds an HTTP handler from the service implementation. It returns the @@ -113,21 +124,24 @@ type ClairServiceHandler interface { // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. -func NewClairServiceHandler(svc ClairServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { - clairServiceSubmitManifestToScanHandler := connect_go.NewUnaryHandler( +func NewClairServiceHandler(svc ClairServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + clairServiceSubmitManifestToScanHandler := connect.NewUnaryHandler( ClairServiceSubmitManifestToScanProcedure, svc.SubmitManifestToScan, - opts..., + connect.WithSchema(clairServiceSubmitManifestToScanMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - clairServiceGetVulnerabilityReportHandler := connect_go.NewUnaryHandler( + clairServiceGetVulnerabilityReportHandler := connect.NewUnaryHandler( ClairServiceGetVulnerabilityReportProcedure, svc.GetVulnerabilityReport, - opts..., + connect.WithSchema(clairServiceGetVulnerabilityReportMethodDescriptor), + connect.WithHandlerOptions(opts...), ) - clairServiceEnableVulnerabilityScanningHandler := connect_go.NewUnaryHandler( + clairServiceEnableVulnerabilityScanningHandler := connect.NewUnaryHandler( ClairServiceEnableVulnerabilityScanningProcedure, svc.EnableVulnerabilityScanning, - opts..., + connect.WithSchema(clairServiceEnableVulnerabilityScanningMethodDescriptor), + connect.WithHandlerOptions(opts...), ) return "/services.yor.clair.v1.ClairService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { @@ -146,14 +160,14 @@ func NewClairServiceHandler(svc ClairServiceHandler, opts ...connect_go.HandlerO // UnimplementedClairServiceHandler returns CodeUnimplemented from all methods. type UnimplementedClairServiceHandler struct{} -func (UnimplementedClairServiceHandler) SubmitManifestToScan(context.Context, *connect_go.Request[v1.SubmitManifestToScanRequest]) (*connect_go.Response[v1.SubmitManifestToScanResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.SubmitManifestToScan is not implemented")) +func (UnimplementedClairServiceHandler) SubmitManifestToScan(context.Context, *connect.Request[v1.SubmitManifestToScanRequest]) (*connect.Response[v1.SubmitManifestToScanResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.SubmitManifestToScan is not implemented")) } -func (UnimplementedClairServiceHandler) GetVulnerabilityReport(context.Context, *connect_go.Request[v1.GetVulnerabilityReportRequest]) (*connect_go.Response[v1.GetVulnerabilityReportResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.GetVulnerabilityReport is not implemented")) +func (UnimplementedClairServiceHandler) GetVulnerabilityReport(context.Context, *connect.Request[v1.GetVulnerabilityReportRequest]) (*connect.Response[v1.GetVulnerabilityReportResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.GetVulnerabilityReport is not implemented")) } -func (UnimplementedClairServiceHandler) EnableVulnerabilityScanning(context.Context, *connect_go.Request[v1.EnableVulnerabilityScanningRequest]) (*connect_go.Response[v1.EnableVulnerabilityScanningResponse], error) { - return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.EnableVulnerabilityScanning is not implemented")) +func (UnimplementedClairServiceHandler) EnableVulnerabilityScanning(context.Context, *connect.Request[v1.EnableVulnerabilityScanningRequest]) (*connect.Response[v1.EnableVulnerabilityScanningResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("services.yor.clair.v1.ClairService.EnableVulnerabilityScanning is not implemented")) } diff --git a/services/yor/clair/v1/server/clair.go b/services/yor/clair/v1/server/clair.go index 039439d0..fbb3b737 100644 --- a/services/yor/clair/v1/server/clair.go +++ b/services/yor/clair/v1/server/clair.go @@ -8,7 +8,7 @@ import ( "io" "net/http" - "github.com/bufbuild/connect-go" + "connectrpc.com/connect" "github.com/golang-jwt/jwt/v5" "google.golang.org/protobuf/encoding/protojson" diff --git a/services/yor/clair/v1/server/interceptors.go b/services/yor/clair/v1/server/interceptors.go index 899eced5..9a1c54ca 100644 --- a/services/yor/clair/v1/server/interceptors.go +++ b/services/yor/clair/v1/server/interceptors.go @@ -8,11 +8,12 @@ import ( "net/url" "strings" - "github.com/bufbuild/connect-go" - "github.com/containerish/OpenRegistry/auth" - "github.com/containerish/OpenRegistry/store/v1/types" + "connectrpc.com/connect" "github.com/golang-jwt/jwt/v5" "github.com/google/uuid" + + "github.com/containerish/OpenRegistry/auth" + "github.com/containerish/OpenRegistry/store/v1/types" ) // NewJWTInterceptor is a UnaryInterceptorFunc that inspects and tries to parse a JWT from the request. diff --git a/services/yor/clair/v1/server/server.go b/services/yor/clair/v1/server/server.go index 28ab1bf8..e592c30b 100644 --- a/services/yor/clair/v1/server/server.go +++ b/services/yor/clair/v1/server/server.go @@ -6,7 +6,8 @@ import ( "sync" "time" - "github.com/bufbuild/connect-go" + "connectrpc.com/connect" + "github.com/containerish/OpenRegistry/config" connect_v1 "github.com/containerish/OpenRegistry/services/yor/clair/v1/clairconnect" "github.com/containerish/OpenRegistry/store/v1/types"