diff --git a/cncd/pipeline/pipeline/frontend/yaml/config.go b/cncd/pipeline/pipeline/frontend/yaml/config.go index e5d52f8c2..281e99908 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/config.go +++ b/cncd/pipeline/pipeline/frontend/yaml/config.go @@ -22,6 +22,7 @@ type ( Networks Networks Volumes Volumes Labels libcompose.SliceorMap + DependsOn []string `yaml:"depends_on,omitempty"` } // Workspace defines a pipeline workspace. diff --git a/cncd/pipeline/pipeline/frontend/yaml/config_test.go b/cncd/pipeline/pipeline/frontend/yaml/config_test.go index 54549ffda..ce9cadfc6 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/config_test.go +++ b/cncd/pipeline/pipeline/frontend/yaml/config_test.go @@ -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 = `