Skip to content
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

Read output of actions.run from BXL #572

Closed
cbarrete opened this issue Feb 21, 2024 · 6 comments
Closed

Read output of actions.run from BXL #572

cbarrete opened this issue Feb 21, 2024 · 6 comments

Comments

@cbarrete
Copy link
Contributor

Is there a way to read the output of a command (or even an arbitrary file tracked by buck2) into BXL? I'd like to somehow get a string back that I could further process.

In case this is an XY problem, my use case is that I want to run the tests for the files touched in the current commit (for CI purposes). I intended to iterate over the output of git diff-tree -r --name-only --no-commit-id HEAD, find the owners of those files and build/test them, but I cannot figure out a way of getting the file names into BXL, either via stdout or a declared output that I dumped the output of git into.

Thanks!

@stepancheg
Copy link
Contributor

Is there a good reason to do it in BXL?

For CI purpose it looks more reasonable to find the files with git, then find file owners with buck2 cquery or something, and then build.

BXL is quite power tool, but it cannot replace everything.

(I think what you ask is not easily possible, but I can be wrong, and this feature could be added to buck2).

Also check https://github.com/facebookincubator/buck2-change-detector project. CC @ndmitchell

@cbarrete
Copy link
Contributor Author

It doesn't have to be I suppose, but I figured that getting the right targets to build and/or test afterwards would be easier from BXL.

That link is a 404 for me, but it sounds interesting, is it private?

@stepancheg
Copy link
Contributor

Sorry, the project is not published yet.

getting the right targets to build and/or test afterwards would be easier from BXL

Also, consider this issue: if build fails, and users want to reproduce it, it would be easier for them if there was buck2 build or buck2 test command in CI logs which users could just copy-paste.

Anyway, BXL cannot do it now easily, but may be able to do it one day if there's demand for it.

@cbarrete
Copy link
Contributor Author

Sorry, the project is not published yet.

That's too bad, do you know if there are plans to publish it? More out of curiosity really, I'm going to get this working on our side now either way.

Also, consider this issue: if build fails, and users want to reproduce it, it would be easier for them if there was buck2 build or buck2 test command in CI logs which users could just copy-paste.

That's a good point.

Anyway, BXL cannot do it now easily, but may be able to do it one day if there's demand for it.

Thanks for the clarification!

@stepancheg
Copy link
Contributor

@cbarrete buck2-change-detector is public now.

@cbarrete
Copy link
Contributor Author

Thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants