I'm running into problems with a build pipeline I'm defining in Azure DevOps. The issue is similar to what is described in this post but the fix cited isn't working for me. The build job Get Source task runs but the Powershell I have defined is failing because of the agent using a detached HEAD. I'm new to Git and Azure DevOps (lots of experience with SVN and TeamCity/CruiseControl.NET/NANT) so between the different commands and permissions I'm pretty stymied.
I was able to create two test repos and made one a submodule of the other. I built a process that updates the submodule to HEAD using a Powershell task:
Write-Host
Write-Host "RUNNING: git status"
git status
Write-Host
Write-Host "RUNNING: git checkout SubmoduleExperiment"
git checkout SubmoduleExperiment
Write-Host
Write-Host "RUNNING: git submodule update --remote --merge"
git submodule update --remote --merge
Write-Host
Write-Host "RUNNING: git commit -am ""updated submodule"""
git commit -am "updated submodule"
Write-Host
Write-Host "RUNNING: git push"
git push https://$($env:PatForGitPushes):PAT@myTeam.visualstudio.com/MyTeam/_git/my-test HEAD:SubmoduleExperiment
When I apply the same task to my actual project/build, however, it fails because when I git checkout master
it tells me I'm behind 'origin/master' by 1 commit
even though the detached HEAD is pointing to the same commit as origin/master.
I've set up the Get Source task between my test and the "real" build to be identical. I've set the submodule's URL to use a PAT in both.
Any suggestions on how to fix this situation?