brigadecore / brigade

Event-driven scripting for Kubernetes
https://brigade.sh/
Apache License 2.0
2.4k stars 247 forks source link

cli: should add option to list events filtered by source #1824

Closed krancour closed 2 years ago

krancour commented 2 years ago

Similar to how we can already filter by project.

karnatisrinivas commented 2 years ago

Hello @krancour , I would like to work on this! . Can I know more context about this?

krancour commented 2 years ago

@karnatisrinivas if you take a look at how the value of the --project flag in the CLI's event list command gets passed through the SDK to the API server, you'll easily learn how to do the same for the event source.

On the backend, look at the EventEndpoints to see how it picks that information out of the request and adds it to a selector object. Again, use the same approach.

The final modification would be in the DB query. There's a criteria object that would need to be conditionally modified if a source was specified. Again, just follow how it was done for the project filter.

karnatisrinivas commented 2 years ago

Hello @krancour , https://github.com/brigadecore/brigade/blob/main/v2/cli/event_commands.go https://github.com/brigadecore/brigade/blob/main/v2/apiserver/internal/api/rest/events_endpoints.go

Based on your comments, I think above are the files you are pointing to. If not would you please point out the folder where the edit is required?

krancour commented 2 years ago

Those plus sdk/v3/events.go and v2/apiserver/internal/mongodb/events.go

attreyee-muk commented 2 years ago

Can I work on this issue if anyone is currently not working on it?

krancour commented 2 years ago

@a-muk I didn't formally assign this to @karnatisrinivas, but since he asked some questions about it, let's find out from him if he has any work-in-progress here.

If he doesn't, then I would be happy to assign to you.

attreyee-muk commented 2 years ago

no issues @krancour

karnatisrinivas commented 2 years ago

Hello @a-muk and @krancour ,

I haven't worked on this yet and I am still processing the code base. I have no issues if @a-muk wants work on this!

Thanks

krancour commented 2 years ago

Thanks for being such a team player @karnatisrinivas! There will be plenty more issues for everyone!

@a-muk I am assigning to you as requested. It's all yous!

attreyee-muk commented 2 years ago

@krancour I am currently unassigning myself from this issue. I went through the code base, but as a beginner I think the issue is becoming a bit tough for me to solve.

krancour commented 2 years ago

Looking at this closer, it seems everything is already in place except for the flag in the CLI.