mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-16 05:26:31 +00:00
fix: addon JSON pointers (#4508)
Signed-off-by: jolheiser <git@jolheiser.com>
This commit is contained in:
parent
db45794091
commit
9f0611d1a1
4 changed files with 11 additions and 11 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -140,9 +140,9 @@ 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
|
||||
log.Trace().Msgf("fetching %s from forge", fileOrFolder)
|
||||
files, err := f.forge.Dir(c, f.user, f.repo, f.pipeline, strings.TrimSuffix(fileOrFolder, "/"))
|
||||
// if folder is not supported we will get a "Not implemented" error and continue
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue