mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 18:31:00 +00:00
26 lines
553 B
Go
26 lines
553 B
Go
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
|
|
}
|