1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-24 08:02:18 +02:00
woodpecker/yaml/build.go

27 lines
553 B
Go
Raw Normal View History

2016-05-08 09:01:45 +02:00
package yaml
// Build represents Docker image build instructions.
type Build struct {
Context string
Dockerfile string
Args map[string]string
}
// UnmarshalYAML implements custom Yaml unmarshaling.
func (b *Build) UnmarshalYAML(unmarshal func(interface{}) error) error {
err := unmarshal(&b.Context)
if err == nil {
return nil
}
out := struct {
Context string
Dockerfile string
Args map[string]string
}{}
err = unmarshal(&out)
b.Context = out.Context
b.Args = out.Args
b.Dockerfile = out.Dockerfile
return err
}