depend_on in yaml

This commit is contained in:
Laszlo Fogas 2019-06-12 11:03:59 +02:00
parent f9c5fcec0d
commit 71f2486ae0
2 changed files with 8 additions and 2 deletions

View file

@ -22,6 +22,7 @@ type (
Networks Networks
Volumes Volumes
Labels libcompose.SliceorMap
DependsOn []string `yaml:"depends_on,omitempty"`
}
// Workspace defines a pipeline workspace.

View file

@ -7,7 +7,7 @@ import (
"github.com/franela/goblin"
)
func xTestParse(t *testing.T) {
func TestParse(t *testing.T) {
g := goblin.Goblin(t)
g.Describe("Parser", func() {
@ -35,9 +35,11 @@ func xTestParse(t *testing.T) {
g.Assert(out.Pipeline.Containers[1].Commands).Equal(yaml.Stringorslice{"go build"})
g.Assert(out.Pipeline.Containers[2].Name).Equal("notify")
g.Assert(out.Pipeline.Containers[2].Image).Equal("slack")
g.Assert(out.Pipeline.Containers[2].NetworkMode).Equal("container:name")
// g.Assert(out.Pipeline.Containers[2].NetworkMode).Equal("container:name")
g.Assert(out.Labels["com.example.team"]).Equal("frontend")
g.Assert(out.Labels["com.example.type"]).Equal("build")
g.Assert(out.DependsOn[0]).Equal("lint")
g.Assert(out.DependsOn[1]).Equal("test")
})
// Check to make sure variable expansion works in yaml.MapSlice
// g.It("Should unmarshal variables", func() {
@ -94,6 +96,9 @@ volumes:
labels:
com.example.type: "build"
com.example.team: "frontend"
depends_on:
- lint
- test
`
var sampleVarYaml = `