"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugin/converter/starlark.go" between
drone-2.15.0.tar.gz and drone-2.16.0.tar.gz

About: Drone is a Continuous Delivery system built on (docker) container technology.

starlark.go  (drone-2.15.0):starlark.go  (drone-2.16.0)
skipping to change at line 29 skipping to change at line 29
import ( import (
"context" "context"
"strings" "strings"
"github.com/drone/drone/core" "github.com/drone/drone/core"
"github.com/drone/drone/plugin/converter/starlark" "github.com/drone/drone/plugin/converter/starlark"
) )
// Starlark returns a conversion service that converts the // Starlark returns a conversion service that converts the
// starlark file to a yaml file. // starlark file to a yaml file.
func Starlark(enabled bool, stepLimit uint64) core.ConvertService { func Starlark(enabled bool, stepLimit uint64, sizeLimit uint64) core.ConvertServ ice {
return &starlarkPlugin{ return &starlarkPlugin{
enabled: enabled, enabled: enabled,
stepLimit: stepLimit, stepLimit: stepLimit,
sizeLimit: sizeLimit,
} }
} }
type starlarkPlugin struct { type starlarkPlugin struct {
enabled bool enabled bool
stepLimit uint64 stepLimit uint64
sizeLimit uint64
} }
func (p *starlarkPlugin) Convert(ctx context.Context, req *core.ConvertArgs) (*c ore.Config, error) { func (p *starlarkPlugin) Convert(ctx context.Context, req *core.ConvertArgs) (*c ore.Config, error) {
if p.enabled == false { if p.enabled == false {
return nil, nil return nil, nil
} }
// if the file extension is not jsonnet we can // if the file extension is not jsonnet we can
// skip this plugin by returning zero values. // skip this plugin by returning zero values.
switch { switch {
case strings.HasSuffix(req.Repo.Config, ".script"): case strings.HasSuffix(req.Repo.Config, ".script"):
case strings.HasSuffix(req.Repo.Config, ".star"): case strings.HasSuffix(req.Repo.Config, ".star"):
case strings.HasSuffix(req.Repo.Config, ".starlark"): case strings.HasSuffix(req.Repo.Config, ".starlark"):
default: default:
return nil, nil return nil, nil
} }
file, err := starlark.Parse(req, nil, nil, p.stepLimit) file, err := starlark.Parse(req, nil, nil, p.stepLimit, p.sizeLimit)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &core.Config{ return &core.Config{
Data: file, Data: file,
}, nil }, nil
} }
 End of changes. 4 change blocks. 
2 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)