Supporting skip_clone

This commit is contained in:
Laszlo Fogas 2019-06-24 11:19:12 +02:00
parent f386c4fca3
commit e239c2fe74
3 changed files with 4 additions and 2 deletions

View file

@ -97,7 +97,7 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config {
} }
// add default clone step // 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{ container := &yaml.Container{
Name: "clone", Name: "clone",
Image: "plugins/git:latest", Image: "plugins/git:latest",
@ -118,7 +118,7 @@ func (c *Compiler) Compile(conf *yaml.Config) *backend.Config {
stage.Steps = append(stage.Steps, step) stage.Steps = append(stage.Steps, step)
config.Stages = append(config.Stages, stage) 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 { for i, container := range conf.Clone.Containers {
if !container.Constraints.Match(c.metadata) { if !container.Constraints.Match(c.metadata) {
continue continue

View file

@ -24,6 +24,7 @@ type (
Labels libcompose.SliceorMap Labels libcompose.SliceorMap
DependsOn []string `yaml:"depends_on,omitempty"` DependsOn []string `yaml:"depends_on,omitempty"`
RunsOn []string `yaml:"runs_on,omitempty"` RunsOn []string `yaml:"runs_on,omitempty"`
SkipClone bool `yaml:"skip_clone"`
} }
// Workspace defines a pipeline workspace. // Workspace defines a pipeline workspace.

View file

@ -42,6 +42,7 @@ func TestParse(t *testing.T) {
g.Assert(out.DependsOn[1]).Equal("test") g.Assert(out.DependsOn[1]).Equal("test")
g.Assert(out.RunsOn[0]).Equal("success") g.Assert(out.RunsOn[0]).Equal("success")
g.Assert(out.RunsOn[1]).Equal("failure") g.Assert(out.RunsOn[1]).Equal("failure")
g.Assert(out.SkipClone).Equal(false)
}) })
// Check to make sure variable expansion works in yaml.MapSlice // Check to make sure variable expansion works in yaml.MapSlice
// g.It("Should unmarshal variables", func() { // g.It("Should unmarshal variables", func() {