Azure-pipelines-tasks: ArchiveFilesV2: "Replace existing archive" did not replace archive

Created on 7 Aug 2018  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

  • Server - VSTS or TFS on-premises?
    VSTS

  • Agent - Hosted or Private:
    private, 2012r2, agentversion=2.136.1

Issue Description

In a build a webApp is zipped into "$(build.binariesdirectory)\webApp.zip". The task has the "Replace"-option set but still the files get added to the existing zip instead of replacing the zip.

Error logs

One of the assemblies of the webApp changed its extension from dll to exe and the zip then contained the dll from last week. The app couldn't startup anymore so when i investigated i found some contents in the zip that should't be there if the "Replace"-option would have replaced the zip.
The clean-option of the definition was set to "sources".

In my case i simple updated the clean-option to "sources and output" to force that the $(build.binariesdirectory) gets recreated, but still an issue in some other build and release definitions.

Core bug

Most helpful comment

Can confirm this issue. Creating a zip archive with option "Replace existing archive" does not replace the the zip file in the destination.

All 4 comments

Can confirm this issue. Creating a zip archive with option "Replace existing archive" does not replace the the zip file in the destination.

Confirming this issue. My pipeline runs on Windows latest and has the following tasks:

  1. VSBuild task: Build an ASP.Net MVC 4 app into a package.
  2. Extract files task: extract contents of package .zip to pipeline workspace.
  3. Delete files task: delete a bunch of .dll and (dev) .config files from the pipeline workspace.
  4. Copy files task: copy some (production) .config files from repo to pipeline workspace.
  5. Archive files task: archive pipeline workspace, attempting to replace package .zip.

The result is that the old .zip file has been "merged" with the new .zip file. All .dll files and .config files that were deleted persisted, along with the .config files that were added.

Ran a test to save the archive as a different name and confirmed that the old .zip had only the old files. The new .zip had only the new files that were copied, none of the old files that were deleted.

Extract files task:
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(build.artifactStagingDirectory)/DevOpsTest.zip'
destinationFolder: '$(working_dir)'
cleanDestinationFolder: true

Archive files task:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(working_dir)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(build.artifactStagingDirectory)/DevOpsTest.zip'
replaceExistingArchive: true

Will "work around" this issue by using a Delete Files task to delete the old .zip file right after the Extract Files task.

This was opened in august 2018. Now is june 2020 and still open. i am closing this now as i am not expecting any fix for this in the near feature

I have this issue also, using macos-latest agent

Was this page helpful?
0 / 5 - 0 ratings