| The pipeline from SCM job checks out the repo on the master first in order to get the jenkinsfile, then the agent checks out the repo again in order to execute the jenkinsfile. The master is always about to check out while the slave is unable to check out using Vault username/password. On further investigation, I suspect that on the agent, GIT_ASKPASS doesn't get configured correctly when using Vault. If I use a pipeline script defined in the job rather than from SCM, I can set my Git credentials to environment variables GITUSER and GITPASS and execute the following steps to manually configure GIT_ASKPASS before checking out a repository.
sh "git config credential.helper '!f() { sleep 1; echo \"username=${GITUSER}\"; echo \"password=${GITPASS}\"; }; f'"
git url: 'https://bitbucket.org/<username>/<repository>.git'
This runs successfully on a Linux agent. I haven't figured out how to replicate the git config credential.helper function on Windows so my Windows workaround instead is
|