harness-drone/plugin/converter/legacy.go
2019-09-02 23:05:30 -07:00

34 lines
699 B
Go

// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package converter
import (
"context"
"github.com/drone/drone/core"
)
// Legacy returns a conversion service that converts a
// legacy 0.8 yaml file to a yaml file.
func Legacy(enabled bool) core.ConvertService {
return &legacyPlugin{
enabled: enabled,
}
}
type legacyPlugin struct {
enabled bool
}
func (p *legacyPlugin) Convert(ctx context.Context, req *core.ConvertArgs) (*core.Config, error) {
if p.enabled == false {
return nil, nil
}
return &core.Config{
Data: req.Config.Data,
}, nil
}