diff --git a/docs/docs/30-administration/11-forges/100-addon.md b/docs/docs/30-administration/11-forges/100-addon.md index e280ed4202..fca20ac955 100644 --- a/docs/docs/30-administration/11-forges/100-addon.md +++ b/docs/docs/30-administration/11-forges/100-addon.md @@ -38,7 +38,7 @@ Addons use RPC to communicate to the server and are implemented using the [`go-p This example will use the Go language. -Directly import Woodpecker's Go packages (`go.woodpecker-ci.org/woodpecker/woodpecker/v2`) and use the interfaces and types defined there. +Directly import Woodpecker's Go packages (`go.woodpecker-ci.org/woodpecker/v2`) and use the interfaces and types defined there. In the `main` function, just call `"go.woodpecker-ci.org/woodpecker/v2/server/forge/addon".Serve` with a `"go.woodpecker-ci.org/woodpecker/v2/server/forge".Forge` as argument. This will take care of connecting the addon forge to the server. diff --git a/server/forge/addon/client.go b/server/forge/addon/client.go index 46d600e6e3..ba44c05aad 100644 --- a/server/forge/addon/client.go +++ b/server/forge/addon/client.go @@ -139,8 +139,8 @@ func (g *RPC) Repo(_ context.Context, u *model.User, remoteID model.ForgeRemoteI return nil, err } - var resp *modelRepo - err = json.Unmarshal(jsonResp, resp) + var resp modelRepo + err = json.Unmarshal(jsonResp, &resp) if err != nil { return nil, err } diff --git a/server/forge/addon/server.go b/server/forge/addon/server.go index a65967eaab..fc810ae23e 100644 --- a/server/forge/addon/server.go +++ b/server/forge/addon/server.go @@ -54,8 +54,8 @@ func (s *RPCServer) URL(_ []byte, resp *string) error { } func (s *RPCServer) Teams(args []byte, resp *[]byte) error { - var a *modelUser - err := json.Unmarshal(args, a) + var a modelUser + err := json.Unmarshal(args, &a) if err != nil { return err } @@ -82,8 +82,8 @@ func (s *RPCServer) Repo(args []byte, resp *[]byte) error { } func (s *RPCServer) Repos(args []byte, resp *[]byte) error { - var a *modelUser - err := json.Unmarshal(args, a) + var a modelUser + err := json.Unmarshal(args, &a) if err != nil { return err } @@ -261,12 +261,12 @@ func (s *RPCServer) Hook(args []byte, resp *[]byte) error { } func (s *RPCServer) Login(args []byte, resp *[]byte) error { - var a *types.OAuthRequest - err := json.Unmarshal(args, a) + var a types.OAuthRequest + err := json.Unmarshal(args, &a) if err != nil { return err } - user, red, err := s.Impl.Login(mkCtx(), a) + user, red, err := s.Impl.Login(mkCtx(), &a) if err != nil { return err } diff --git a/server/services/config/forge.go b/server/services/config/forge.go index e7b87a464e..e50bf07f8a 100644 --- a/server/services/config/forge.go +++ b/server/services/config/forge.go @@ -140,6 +140,7 @@ func (f *forgeFetcherContext) checkPipelineFile(c context.Context, config string func (f *forgeFetcherContext) getFirstAvailableConfig(c context.Context, configs []string) ([]*types.FileMeta, error) { var forgeErr []error for _, fileOrFolder := range configs { + log.Trace().Msgf("fetching %s from forge", fileOrFolder) if strings.HasSuffix(fileOrFolder, "/") { // config is a folder files, err := f.forge.Dir(c, f.user, f.repo, f.pipeline, strings.TrimSuffix(fileOrFolder, "/"))