Skip to content

Commit

Permalink
[rayci] support select+tag together as a filter
Browse files Browse the repository at this point in the history
Signed-off-by: can <[email protected]>
  • Loading branch information
can-anyscale committed May 8, 2024
1 parent 213f5bb commit dec277f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion raycicmd/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ func makePipeline(repoDir string, config *config, info *buildInfo) (

var filter *stepFilter
if len(info.selects) > 0 && len(config.TagFilterCommand) > 0 {
f, err := newSelectAndTagsStepFilter(config.SkipTags, info.selects, config.TagFilterCommand)
f, err := newSelectAndTagsStepFilter(
config.SkipTags,
info.selects,
config.TagFilterCommand,
)
if err != nil {
return nil, fmt.Errorf("run tag filter command: %w", err)
}
Expand Down
23 changes: 23 additions & 0 deletions raycicmd/step_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,26 @@ func TestStepFilter_selects(t *testing.T) {
}
}
}

func TestStepFilter_selectsAndTags(t *testing.T) {
filter, _ := newSelectAndTagsStepFilter([]string{"disabled"}, []string{"foo", "bar"}, []string{"echo", "tune"})
for _, node := range []*stepNode{
{key: "foo"},
{id: "foo", tags: []string{"tune"}},
{id: "bar"},
} {
if !filter.accept(node) {
t.Errorf("miss %+v", node)
}
}

for _, node := range []*stepNode{
{id: "foo", tags: []string{"not_tune"}},
{id: "bar", tags: []string{"tune_not"}},
{key: "w00t"},
} {
if filter.accept(node) {
t.Errorf("miss %+v", node)
}
}
}

0 comments on commit dec277f

Please sign in to comment.