@@ -5,18 +5,30 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/drone/drone-go/plugin/config"
|
||||
|
||||
"github.com/drone/drone-go/drone"
|
||||
"github.com/drone/drone-go/plugin/converter"
|
||||
)
|
||||
|
||||
const defaultPipeline = `
|
||||
kind: pipeline
|
||||
name: default
|
||||
steps:
|
||||
- name: build
|
||||
image: golang
|
||||
commands:
|
||||
- go build
|
||||
- go test -v
|
||||
`
|
||||
|
||||
// New returns a new conversion plugin.
|
||||
func New() converter.Plugin {
|
||||
func New() config.Plugin {
|
||||
return &plugin{}
|
||||
}
|
||||
|
||||
type plugin struct{}
|
||||
|
||||
func (p *plugin) Convert(ctx context.Context, req *converter.Request) (*drone.Config, error) {
|
||||
func (p *plugin) Find(ctx context.Context, req *config.Request) (*drone.Config, error) {
|
||||
resp, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
fmt.Printf("%+v", err)
|
||||
@@ -24,6 +36,6 @@ func (p *plugin) Convert(ctx context.Context, req *converter.Request) (*drone.Co
|
||||
}
|
||||
fmt.Printf("%s", string(resp))
|
||||
return &drone.Config{
|
||||
Data: req.Config.Data,
|
||||
Data: defaultPipeline,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user