aspect-cli icon indicating copy to clipboard operation
aspect-cli copied to clipboard

Go into setup mode if running outside a Bazel workspace

Open f0rmiga opened this issue 4 years ago • 3 comments

note for later (maybe a TODO?) we should offer to help if the user actually meant the cwd to be a workspace - go interactive and into a setup mode

Originally posted by @alexeagle in https://github.com/aspect-build/aspect-cli/pull/83#discussion_r767176209

f0rmiga avatar Dec 11 '21 19:12 f0rmiga

It's sometimes useful to just run an executable to ensure it's been installed and is working properly, but as of v0.5.0, there's no command that simply runs and succeeds without being inside of a Bazel workspace. It would be nice if aspect version, aspect help, or really any command would return a success code when run from any folder.

stabai avatar Jun 20 '22 18:06 stabai

@stabai I can see that those commands should not depend on being inside a valid Bazel workspace. On the other hand, if you want to check if an executable is installed correctly, the canonical way is to verify its checksum hash. You can additionally call which <program>, which (no pun intended) would tell you the program also got the right permission flags.

f0rmiga avatar Jun 20 '22 19:06 f0rmiga

True, but those sorts of checks can't answer a few things:

  • Is the executable permission set on the file (often not right after download)?
  • Is the file in quarantine by macOS (often true right after download)?
  • Is the application able to access any dependent libraries that are required?

The reason I'm thinking about it this way is that I need to automate this check. Currently, the best way seems to be the following:

  1. Create a WORKSPACE file in a directory
  2. Run aspect version from that directory
  3. Delete the WORKSPACE file

This is in some ways the most realistic way to verify the application is working, since it tests it against a valid environment. However, I'm not in love with creating and deleting files to do it.

stabai avatar Jun 21 '22 00:06 stabai