From 71f2486ae0ec7c0c3e6b9f602f6479c96854b207 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Wed, 12 Jun 2019 11:03:59 +0200 Subject: [PATCH] depend_on in yaml --- cncd/pipeline/pipeline/frontend/yaml/config.go | 1 + cncd/pipeline/pipeline/frontend/yaml/config_test.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 = `