Ensure we run installation Rake tasks in a clean env in TestEnv
What does this MR do?
I've also improved the error message and the components dir is removed in the case of a failure, so that a retry will start from a clean slate.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
What are the relevant issue numbers?
Fixes #35859 (closed).