I’m in the process of moving common code from my jenkinsfile into a shared library.
Everything went well until I tried to move code that uses ‘bat’ steps.
I understand you are not supposed to call Jenkins steps from shared libraries (doable if you insist well), so I tried using the ProcessBuilder class to run cmd.
But whatever I do, I always end up with a ‘No such file or directory’. Such as ‘Cannot run program “C:\Windows\System32\cmd.exe”: error=2, No such file or directory’ (and yes, the function is called in a windows agent)
Am I doing the right thing here ?
Is Jenkins preventing me from accessing programs on the node on purpose ?