Misc refactors
What does this MR do?
See individual commits.
Why was this MR needed?
- To improve the code.
- To unblock further work I need to do. There will be more refactoring on top of this and then new functionality.
What's the best way to test this MR?
What are the relevant issue numbers?
Relates to Implement Runner job proxying (gitlab-org/cluster-integration/gitlab-agent#771 - closed).
Edited by Mikhail Mazurskiy