harleybl
harleybl

Reputation: 959

Why is my Azure Devops Pipeline Artifact locked by another process after download?

I have a very simple release pipeline that only needs to do a few things:

  1. Download the artifact to be released.
  2. Use the Tokenize In Archive step to replace some configuration values.
  3. Deploy Azure App Function

The artifact is downloaded as a zip file as I expect. When the pipeline gets to step 2, the Tokenize in Archive step I get an error about another process having the file locked:

2019-12-05T18:46:30.3959242Z ==============================================================================
2019-12-05T18:46:30.3959351Z Task         : Tokenize in Archive
2019-12-05T18:46:30.3959415Z Description  : Allows you to tokenize within an archive without unpacking.
2019-12-05T18:46:30.3959494Z Version      : 1.1.2
2019-12-05T18:46:30.3960010Z Author       : Solidify Labs
2019-12-05T18:46:30.3960106Z Help         : [More Information](https://github.com/solidify/vsts-task-tokenize-in-archive)
2019-12-05T18:46:30.3960203Z ==============================================================================
2019-12-05T18:46:33.9236236Z Searching for all My.Functions.App.zip files at d:\a\r1\a\dist
2019-12-05T18:46:33.9236804Z Searching for local.settings.json inside MyFunctions.App.zip files
2019-12-05T18:46:34.0743681Z 
2019-12-05T18:46:34.0755112Z GAC    Version        Location                                                                                         
2019-12-05T18:46:34.0755702Z ---    -------        --------                                                                                         
2019-12-05T18:46:34.0801996Z True   v4.0.30319     C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.IO.Compression.FileSystem\v4.0_4.0.0.0__b77a...
2019-12-05T18:46:34.0843963Z Matched zip: D:\a\r1\a\dist\MyFunctions.App.zip
2019-12-05T18:46:34.4714977Z ##[error]System.Management.Automation.RuntimeException: Another process has locked the 'D:\a\r1\a\dist\MyFunctions.App.zip' file.

I have tried copying the zip file to another directory and doing the tokenize there. I also wrote some Powershell to see if the file was Read-only and it does not appear to be. The pipeline is running in the default Azure Pipelines Hosted Agent so I am not sure what other processes could be locking the file.

Has anyone seen this before or has a workaround for this condition?

Thanks.

Upvotes: 1

Views: 1207

Answers (1)

harleybl
harleybl

Reputation: 959

I figured this out by running some PowerShell to list the contents of the directory after the Pipeline artifact is downloaded.

The Pipeline artifact is unzipped automatically by the download step. The error message saying that another process has locked the file is misleading. It should say something like "Unable to unzip a directory". The other confusing part was that the directory still has a .zip file extension which made me think that I was still dealing with a zip file rather than a directory.

Upvotes: 0

Related Questions