From e239c2fe74de1b88221f43c997846e69e3ebd3b7 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Mon, 24 Jun 2019 11:19:12 +0200 Subject: [PATCH] Supporting skip_clone --- cncd/pipeline/pipeline/frontend/yaml/compiler/compiler.go | 4 ++-- cncd/pipeline/pipeline/frontend/yaml/config.go | 1 + cncd/pipeline/pipeline/frontend/yaml/config_test.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cncd/pipeline/pipeline/frontend/yaml/compiler/compiler.go b/cncd/pipeline/pipeline/frontend/yaml/compiler/compiler.go index d21311d36..4049a10f9 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/compiler/compiler.go +++ b/cncd/pipeline/pipeline/frontend/yaml/compiler/compiler.go @@ -97,7 +97,7 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config { } // add default clone step - if c.local == false && len(conf.Clone.Containers) == 0 { + if c.local == false && len(conf.Clone.Containers) == 0 && !conf.SkipClone { container := &yaml.Container{ Name: "clone", Image: "plugins/git:latest", @@ -118,7 +118,7 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config { stage.Steps = append(stage.Steps, step) config.Stages = append(config.Stages, stage) - } else if c.local == false { + } else if c.local == false && !conf.SkipClone { for i, container := range conf.Clone.Containers { if !container.Constraints.Match(c.metadata) { continue diff --git a/cncd/pipeline/pipeline/frontend/yaml/config.go b/cncd/pipeline/pipeline/frontend/yaml/config.go index afa8e0512..9893dbf26 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/config.go +++ b/cncd/pipeline/pipeline/frontend/yaml/config.go @@ -24,6 +24,7 @@ type ( Labels libcompose.SliceorMap DependsOn []string `yaml:"depends_on,omitempty"` RunsOn []string `yaml:"runs_on,omitempty"` + SkipClone bool `yaml:"skip_clone"` } // 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 afe9dcb3b..79c360d19 100644 --- a/cncd/pipeline/pipeline/frontend/yaml/config_test.go +++ b/cncd/pipeline/pipeline/frontend/yaml/config_test.go @@ -42,6 +42,7 @@ func TestParse(t *testing.T) { g.Assert(out.DependsOn[1]).Equal("test") g.Assert(out.RunsOn[0]).Equal("success") g.Assert(out.RunsOn[1]).Equal("failure") + g.Assert(out.SkipClone).Equal(false) }) // Check to make sure variable expansion works in yaml.MapSlice // g.It("Should unmarshal variables", func() {