We have a secrets file that is injected via withCredentials, the pipeline script is below.
If this is run, it randomly succeeds or fails and is not consistent. When it fails, it appears that the directory it is using to reference the secrets file is not the primary workspace but a "tmp" directory.
I tried multiple variants including clearing the workspace, putting it in a sub directory etc. but it still intermittently fails. Is there something wrong in the snippet below?
I also noticed an (unanswered) stackoverflow post from 15 hours ago that appears to be something similar.