-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rayci] support select & tag together as a filter #234
Conversation
Signed-off-by: can <[email protected]>
raycicmd/step_filter.go
Outdated
func newSelectAndTagsStepFilter( | ||
skipTags []string, selects []string, filterCmd []string, | ||
) (*stepFilter, error) { | ||
select_filter := newSelectStepFilter(skipTags, selects) | ||
tag_filter, err := newTagsStepFilter(skipTags, filterCmd) | ||
|
||
return &stepFilter{ | ||
skipTags: skipTags, | ||
selects: select_filter.selects, | ||
runAll: tag_filter.runAll, | ||
tags: tag_filter.tags, | ||
}, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, maybe just do this:
- have a
newStepFilter
that takes selects and tags - rename
newTagsStepFilter
intostepFilterFromCmd
, and when it gets the tags, callnewStepFilter()
?
raycicmd/step_filter.go
Outdated
@@ -22,12 +22,29 @@ func (f *stepFilter) reject(step *stepNode) bool { | |||
} | |||
|
|||
func (f *stepFilter) accept(step *stepNode) bool { | |||
if f.selects != nil && f.tags != nil { | |||
// in both key selection mode, hit when the step has both keys and tags | |||
return f.acceptSelectHit(step) && f.acceptTagHit(step) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that we can make this function always return:
f.acceptSelectHit(step) && f.acceptTagHit(step)
and treat missing selects
always as return true
?
probably needs to change the runAll
field in the stepFilter
into runAllTags
now, as it semantically only applies to tags selection.
Signed-off-by: can <[email protected]>
dec277f
to
ac6c079
Compare
@aslonnie's comments, combining both tag and select filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let this in to unblock your work. I might follow up with some more refactoring later for the code styling.
let's go! |
If both selects and tags are provided as a filter, select nodes based on both filtering. I need this for using select in microcheck, otherwise we will incur costs by saving all microcheck tests on PR. Let me know if there is a better alternative.
Test: