admin管理员组

文章数量:1400148

I've lot of SQL Scripts in Azure Repos and the size of each sql script is under 100MB, I'm just deploying them on to Azure SQL Database via release pipeline in ADO. But in release pipeline it's failing at download artifacts step with error message

error: unable to write file Folder/Folder01/insert.sql

Note: switching to '98a9aaca00......'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch. 
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
 Or undo this operation with:
 
   git switch -

 Turn off this advice by setting config variable advice.detachedHead to false
 
 HEAD is now at 98a9aac Merged PR 8679: Upload Test Data on <Repo Name>
 An error occurred during download: System.InvalidOperationException: Git checkout failed with exit code: 1
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.GetSourceAsync(IExecutionContext executionContext, ServiceEndpoint endpoint, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Agent.Worker\Build\GitSourceProvider.cs:line 869
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.TfsGitArtifact.DownloadAsync(IExecutionContext executionContext, ArtifactDefinition artifactDefinition, String downloadFolderPath) in D:\a\_work\1\s\src\Agent.Worker\Release\Artifacts\TfsGitArtifact.cs:line 54
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.<>c__DisplayClass40_2.<<DownloadArtifacts>b__3>d.MoveNext() in D:\a\_work\1\s\src\Agent.Worker\Release\ReleaseJobExtension.cs:line 295
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.ExecuteAsync(Func`1 action) in D:\a\_work\1\s\src\Agent.Worker\Release\RetryExecutor.cs:line 64
2025-03-21T12:05:37.3477405Z Retrying download...
2025-03-21T12:05:37.3486081Z Ensuring artifact folder D:\a\r1\a\_<RepoName> exists and is clean.
2025-03-21T12:05:38.3464462Z Syncing repository: c685c8a2-b563-4ef3-8cf1-2a3a43e4c385 (Git)

I've even enabled Checkout submodules to true, but still no luck.

Could someone help please ?

I've lot of SQL Scripts in Azure Repos and the size of each sql script is under 100MB, I'm just deploying them on to Azure SQL Database via release pipeline in ADO. But in release pipeline it's failing at download artifacts step with error message

error: unable to write file Folder/Folder01/insert.sql

Note: switching to '98a9aaca00......'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch. 
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
 Or undo this operation with:
 
   git switch -

 Turn off this advice by setting config variable advice.detachedHead to false
 
 HEAD is now at 98a9aac Merged PR 8679: Upload Test Data on <Repo Name>
 An error occurred during download: System.InvalidOperationException: Git checkout failed with exit code: 1
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.GetSourceAsync(IExecutionContext executionContext, ServiceEndpoint endpoint, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Agent.Worker\Build\GitSourceProvider.cs:line 869
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.TfsGitArtifact.DownloadAsync(IExecutionContext executionContext, ArtifactDefinition artifactDefinition, String downloadFolderPath) in D:\a\_work\1\s\src\Agent.Worker\Release\Artifacts\TfsGitArtifact.cs:line 54
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseJobExtension.<>c__DisplayClass40_2.<<DownloadArtifacts>b__3>d.MoveNext() in D:\a\_work\1\s\src\Agent.Worker\Release\ReleaseJobExtension.cs:line 295
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.ExecuteAsync(Func`1 action) in D:\a\_work\1\s\src\Agent.Worker\Release\RetryExecutor.cs:line 64
2025-03-21T12:05:37.3477405Z Retrying download...
2025-03-21T12:05:37.3486081Z Ensuring artifact folder D:\a\r1\a\_<RepoName> exists and is clean.
2025-03-21T12:05:38.3464462Z Syncing repository: c685c8a2-b563-4ef3-8cf1-2a3a43e4c385 (Git)

I've even enabled Checkout submodules to true, but still no luck.

Could someone help please ?

Share Improve this question edited Mar 24 at 12:46 surya Teja asked Mar 24 at 12:35 surya Tejasurya Teja 377 bronze badges 2
  • 1. Are you using a MS-hosted agent? If so, what's the result if you use Ubuntu-latest image? 2. Did your release pipeline work before? If so, what changes have you made to your repo recently? 3. Are you able to clone and checkout your affecter repo on your local machine? 4. Enable verbose log and share the detailed error in the debug log. – Ziyang Liu-MSFT Commented Mar 25 at 3:26
  • Yes - I'm using MS-Hosted agent, till today i'm using windows agent but after seeing your comment, I changed to ubuntu-latest and was able to download the whole artifacts. but I'm using powershell Invoke-Sqlcmd to deploy the SQL scripts on database. Now This powershell command is not working as agent is ubunut @ZiyangLiu-MSFT – surya Teja Commented Mar 25 at 13:44
Add a comment  | 

1 Answer 1

Reset to default 1

Based on the fact that it works on ubuntu-latest but fails on windows and the error related to the git, there are some issues in your repo related to git that can be handled by Ubuntu but not Windows. I have noticed similar issue, for example, this one.

As a workaround, you can use ubuntu-latest image to run your pipeline. For running Invoke-Sqlcmd command, add a command line task before your PowerShell task to install SqlServer module.

pwsh -Command "Install-Module -Name SqlServer -Scope CurrentUser -Force -AllowClobber"

Run Get-Module SqlServer -ListAvailable in a later PowerShell task to verify that the module has been installed successfully. Then you can run Invoke-Sqlcmd in your PowerShell task.

If you don't want to use Ubuntu-latest image, you should first identity and resolve the git issue in your repo.

本文标签: gitAzure DevOps if failing at download artifacts step in release pipelinesStack Overflow