tech qa refactor for looping through data inputs
This commit is contained in:
parent
61356c4344
commit
6cec8b3ee0
1 changed files with 4 additions and 5 deletions
|
@ -2,6 +2,7 @@ package jsonnet
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/drone/drone/core"
|
"github.com/drone/drone/core"
|
||||||
|
|
||||||
|
@ -27,11 +28,9 @@ func Parse(req *core.ConvertArgs, template *core.Template, templateData map[stri
|
||||||
// map external inputs
|
// map external inputs
|
||||||
if len(templateData) != 0 {
|
if len(templateData) != 0 {
|
||||||
for k, v := range templateData {
|
for k, v := range templateData {
|
||||||
if s, ok := v.(string); ok {
|
key := fmt.Sprintf("input." + k)
|
||||||
key := "input." + k
|
val := fmt.Sprint(v)
|
||||||
vm.ExtVar(key, s)
|
vm.ExtVar(key, val)
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// convert the jsonnet file to yaml
|
// convert the jsonnet file to yaml
|
||||||
|
|
Loading…
Reference in a new issue