Cache-only execution
What is this?
This adds cache-only execution mode (part of #68 (closed)).
It slightly changes what happens when recc tries to execute a build from:
- Check if our command is a (valid) build action
- If not, execute the build locally (exit)
- Check if the action and its result are already remotely cached
- If so, return the result of the cached build (exit)
- Upload the action and wait for the remote to execute it (exit)
to:
- Check if our command is a (valid) build action
- If not, execute the build locally (exit)
- Check if the action and its result are already remotely cached
- If so, return the result of the cached build (exit)
- Check if cache only mode is active
- If not, upload the action and wait for the remote to execute it (exit)
- Otherwise, execute the build locally (exit)
Cache only mode will be active if:
- The user sets
RECC_CACHE_ONLY
- A
RECC_CACHE_SERVER
is set, butRECC_SERVER
is not
Comments
- Currently, even if
RECC_CACHE_ONLY
is set to 0 explicitly by the user (i.e.,RECC_CACHE_ONLY=0
in env), recc will still enter cache-only mode on the second condition. This is the test failure. I'm not sure what the expected behavior should be here, or ifRECC_CACHE_ONLY
should even be supported. Since it's a bit of effort to actually get it to work the behavior I wanted when designing this, I'd appreciate some comments on what others think. - The main function is a bit bloated with complex flow, and this patch makes it worse. Would you expect a refactor with this?
- The first commit is a refactor of something I thought I'd need to change but didn't. Do tell if I should break this out.
- I don't think the main path is currently tested, so I didn't add an explicit test to go through the
RECC_CACHE_ONLY
path; only checking if the environment settings will behave correctly. Do tell if I'm missing a test.
Edited by Tristan Maat