mirror of
https://github.com/drone-plugins/drone-manifest.git
synced 2026-06-04 10:15:14 +08:00
Merge pull request #28 from sh0rez/master
feat: allow to pass spec inline
This commit is contained in:
@@ -93,10 +93,16 @@ func (p *Plugin) Exec() error {
|
||||
args = append(args, "push")
|
||||
|
||||
if p.Config.Spec != "" {
|
||||
raw, err := ioutil.ReadFile(p.Config.Spec)
|
||||
var raw []byte
|
||||
// if spec is not a valid file, assume inlining
|
||||
if _, err := os.Stat(p.Config.Spec); os.IsNotExist(err) {
|
||||
raw = []byte(p.Config.Spec)
|
||||
} else { // otherwise read it
|
||||
raw, err = ioutil.ReadFile(p.Config.Spec)
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to read template")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to read template")
|
||||
}
|
||||
}
|
||||
|
||||
spec, err := template.RenderTrim(string(raw), p)
|
||||
|
||||
Reference in New Issue
Block a user