works fine if you are only using only slave, or even if you have several but are using them serially. But it would not work when running things in parallel on several slaves (with different installation locations).
For that case it would be better to write something like
where the block step would temporarily override one (or more?) environment variables, but only in that thread. (These would presumably not be exposed via the REST API.)
The workaround is to define the environment variable in each sh or similar step, or do without it (in this example by giving an absolute executable name).