You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-06-03 16:35:37 +02:00
Fix workflow serialize to omit skip_clone if false (#6319)
This commit is contained in:
@@ -48,8 +48,7 @@ func TestParse(t *testing.T) {
|
|||||||
assert.Equal(t, "build", out.Labels["com.example.type"])
|
assert.Equal(t, "build", out.Labels["com.example.type"])
|
||||||
assert.Equal(t, "lint", out.DependsOn[0])
|
assert.Equal(t, "lint", out.DependsOn[0])
|
||||||
assert.Equal(t, "test", out.DependsOn[1])
|
assert.Equal(t, "test", out.DependsOn[1])
|
||||||
assert.Equal(t, ("success"), out.RunsOn[0]) //nolint:staticcheck
|
assert.EqualValues(t, []string{"success", "failure"}, out.When.Constraints[0].Status)
|
||||||
assert.Equal(t, ("failure"), out.RunsOn[1]) //nolint:staticcheck
|
|
||||||
assert.False(t, out.SkipClone)
|
assert.False(t, out.SkipClone)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -171,8 +170,10 @@ when:
|
|||||||
- event:
|
- event:
|
||||||
- tester
|
- tester
|
||||||
- tester2
|
- tester2
|
||||||
|
status: [ success, failure ]
|
||||||
- branch:
|
- branch:
|
||||||
- tester
|
- tester
|
||||||
|
status: [ success, failure ]
|
||||||
workspace:
|
workspace:
|
||||||
path: src/github.com/octocat/hello-world
|
path: src/github.com/octocat/hello-world
|
||||||
base: /go
|
base: /go
|
||||||
@@ -204,9 +205,6 @@ labels:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
runs_on:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
`
|
`
|
||||||
|
|
||||||
var simpleYamlAnchors = `
|
var simpleYamlAnchors = `
|
||||||
@@ -278,7 +276,6 @@ func TestReSerialize(t *testing.T) {
|
|||||||
environment:
|
environment:
|
||||||
DRIVER: next
|
DRIVER: next
|
||||||
PLATFORM: linux
|
PLATFORM: linux
|
||||||
skip_clone: false
|
|
||||||
`, string(work1Bin))
|
`, string(work1Bin))
|
||||||
|
|
||||||
work2, err := ParseString(sampleYaml)
|
work2, err := ParseString(sampleYaml)
|
||||||
@@ -289,10 +286,16 @@ skip_clone: false
|
|||||||
|
|
||||||
// TODO: fix "steps.[1].depends_on: []" to be re-serialized!
|
// TODO: fix "steps.[1].depends_on: []" to be re-serialized!
|
||||||
assert.EqualValues(t, `when:
|
assert.EqualValues(t, `when:
|
||||||
- event:
|
- status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
event:
|
||||||
- tester
|
- tester
|
||||||
- tester2
|
- tester2
|
||||||
- branch: tester
|
- branch: tester
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
workspace:
|
workspace:
|
||||||
base: /go
|
base: /go
|
||||||
path: src/github.com/octocat/hello-world
|
path: src/github.com/octocat/hello-world
|
||||||
@@ -322,10 +325,6 @@ labels:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
skip_clone: false
|
|
||||||
runs_on:
|
|
||||||
- success
|
|
||||||
- failure
|
|
||||||
`, string(workBin2))
|
`, string(workBin2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type (
|
|||||||
Services ContainerList `yaml:"services,omitempty"`
|
Services ContainerList `yaml:"services,omitempty"`
|
||||||
Labels map[string]string `yaml:"labels,omitempty"`
|
Labels map[string]string `yaml:"labels,omitempty"`
|
||||||
DependsOn []string `yaml:"depends_on,omitempty"`
|
DependsOn []string `yaml:"depends_on,omitempty"`
|
||||||
SkipClone bool `yaml:"skip_clone"`
|
SkipClone bool `yaml:"skip_clone,omitempty"`
|
||||||
// Deprecated: use when.status. TODO remove in next major.
|
// Deprecated: use when.status. TODO remove in next major.
|
||||||
RunsOn []string `yaml:"runs_on,omitempty"`
|
RunsOn []string `yaml:"runs_on,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user