mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 12:21:03 +00:00
27 lines
553 B
Go
27 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
|
||
|
}
|