I'm working on a multibranch pipeline in Jenkins for building a .Net application and creating ms test results using msbuild on a windows server. I've written a jenkinsfile for the same.
Now the issue is, I need to commit and push the mstest results file to the same branch on git. I've tried to do the same using 'bat' in jenkinsfile, but it gives me Detached head state
. Below is the jenkinsfile configuration:-
node ('windows') {
stage 'Checkout'
checkout scm
stage 'Build'
bat '"Path to MSBuild.exe" ProjectFile.proj'
bat '"Path to git.exe" add mstest/output.trx'
bat '"Path to git.exe" commit -am "adding test results"'
bat '"Path to git.exe" push origin Develop'
}