grim/local-pipelines

Closing the golang branch since rewriting in golang doesn't gain us much now that we're on pypi
package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Step struct {
Image string `yaml:"image"`
Script []string `yaml:"script"`
}
type Pipelines struct {
Default []Step `yaml:"default"`
Branches map[string][]Step `yaml:"branches"`
}
type Plan struct {
Image string `yaml:"image"`
Pipelines Pipelines `yaml:"pipelines"`
}
func load(data []byte) (*Plan, error) {
p := new(Plan)
err := yaml.Unmarshal(data, p)
if err != nil {
return nil, err
}
return p, nil
}
func loadFile(filename string) (*Plan, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
p, err := load(data)
return p, err
}