mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-23 17:53:23 +02:00
Handling zero-steps as transitive dependencies
This commit is contained in:
parent
6879bf62cb
commit
3bb0f64025
@ -156,7 +156,8 @@ func filterItemsWithMissingDependencies(items []*buildItem) []*buildItem {
|
||||
filtered = append(filtered, item)
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
// Recursive to handle transitive deps
|
||||
return filterItemsWithMissingDependencies(filtered)
|
||||
}
|
||||
|
||||
return items
|
||||
|
@ -288,6 +288,58 @@ depends_on: [ zerostep ]
|
||||
}
|
||||
}
|
||||
|
||||
func TestZeroStepsAsMultiPipelineTransitiveDeps(t *testing.T) {
|
||||
build := &model.Build{Branch: "dev"}
|
||||
|
||||
b := procBuilder{
|
||||
Repo: &model.Repo{},
|
||||
Curr: build,
|
||||
Last: &model.Build{},
|
||||
Netrc: &model.Netrc{},
|
||||
Secs: []*model.Secret{},
|
||||
Regs: []*model.Registry{},
|
||||
Link: "",
|
||||
Yamls: []*remote.FileMeta{
|
||||
&remote.FileMeta{Name: "zerostep", Data: []byte(`
|
||||
skip_clone: true
|
||||
pipeline:
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
`)},
|
||||
&remote.FileMeta{Name: "justastep", Data: []byte(`
|
||||
pipeline:
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
&remote.FileMeta{Name: "shouldbefiltered", Data: []byte(`
|
||||
pipeline:
|
||||
build:
|
||||
image: scratch
|
||||
depends_on: [ zerostep ]
|
||||
`)},
|
||||
&remote.FileMeta{Name: "shouldbefilteredtoo", Data: []byte(`
|
||||
pipeline:
|
||||
build:
|
||||
image: scratch
|
||||
depends_on: [ shouldbefiltered ]
|
||||
`)},
|
||||
},
|
||||
}
|
||||
|
||||
buildItems, err := b.Build()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(buildItems) != 1 {
|
||||
t.Fatal("Zerostep and the step that depends on it, and the one depending on it should not generate a build item")
|
||||
}
|
||||
if "justastep" != buildItems[0].Proc.Name {
|
||||
t.Fatal("justastep should have been generated")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTree(t *testing.T) {
|
||||
build := &model.Build{}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user