2021-09-19 12:00:00 +00:00
|
|
|
// Copyright (c) 2019, Drone IO Inc.
|
|
|
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
2019-02-10 19:00:16 +00:00
|
|
|
|
2019-01-22 23:44:17 +00:00
|
|
|
package yaml
|
|
|
|
|
|
|
|
type (
|
|
|
|
// Push configures a Docker push.
|
|
|
|
Push struct {
|
|
|
|
Image string `json:"image,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// push is a tempoary type used to unmarshal
|
|
|
|
// the Push struct when long format is used.
|
|
|
|
push struct {
|
|
|
|
Image string `json:"image,omitempty"`
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
// UnmarshalYAML implements yaml unmarshalling.
|
|
|
|
func (p *Push) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
|
|
d := new(push)
|
2023-02-08 09:14:20 +00:00
|
|
|
|
2019-01-22 23:44:17 +00:00
|
|
|
err := unmarshal(&d.Image)
|
|
|
|
if err != nil {
|
|
|
|
err = unmarshal(d)
|
|
|
|
}
|
2023-02-08 09:14:20 +00:00
|
|
|
|
2019-01-22 23:44:17 +00:00
|
|
|
p.Image = d.Image
|
2023-02-08 09:14:20 +00:00
|
|
|
|
2019-01-22 23:44:17 +00:00
|
|
|
return err
|
|
|
|
}
|