Description
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
ArchiveFiles@2
Task version
2.256.0
Issue Description
I suspect that in the latest version where task-lib has been update to the ;atest version in ArchiveFilesV2 task there is a bug.
https://github.com/microsoft/azure-pipelines-tasks/releases/tag/v256
In our case, we create a zip file and then add files or folders to it.
- task: ArchiveFiles@2
name: PackageFolder
displayName: 'Package Templates Folder'
inputs:
rootFolderOrFile: '$(packagePath)/templates'
includeRootFolder: true
archiveFile: '${zipFileName).zip'
replaceExistingArchive: false
- task: ArchiveFiles@2
name: PackageFile
displayName: 'Package Manifest File'
inputs:
rootFolderOrFile: '$(packagePath)/package-manifest.json'
includeRootFolder: false
archiveFile: '$(zipFileName).zip'
replaceExistingArchive: false
When rootFolderOrFile points to a folder everything works fine, but an error occurs when a single file needs to be added to the archive. Worth to check is there only issue with adding to archive or also with creating one from a single file.
Due to documentation rootFolderOrFile should support folder or single file:
https://learn.microsoft.com/pl-pl/azure/devops/pipelines/tasks/reference/archive-files-v2?view=azure-pipelines#inputs
I have reverted our pipelines to use version [email protected] and it's working fine now, but I would like to work on the latest version.
AC:
- ArchiveFiles@2 should work also when rootFolderOrFile variable is pointing to a single file.
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
ubuntu-22.04
Relevant log output
2025-05-19T13:20:14.0589786Z ##[section]Starting: Package Manifest File
2025-05-19T13:20:14.0594411Z ==============================================================================
2025-05-19T13:20:14.0594540Z Task : Archive files
2025-05-19T13:20:14.0594618Z Description : Compress files into .7z, .tar.gz, or .zip
2025-05-19T13:20:14.0594718Z Version : 2.256.0
2025-05-19T13:20:14.0594790Z Author : Microsoft Corporation
2025-05-19T13:20:14.0594879Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/archive-files
2025-05-19T13:20:14.0594982Z ==============================================================================
2025-05-19T13:20:14.1708346Z Archive file: zipfile.zip already exists. Attempting to add files to it.
2025-05-19T13:20:14.1715334Z Found 1 files
2025-05-19T13:20:14.1715995Z Archiving file:
2025-05-19T13:20:14.1726063Z files=
2025-05-19T13:20:14.1730782Z [command]/usr/bin/zip -r -v zipfile.zip
2025-05-19T13:20:14.1819328Z
2025-05-19T13:20:14.1821544Z zip error: Nothing to do! (zipfile.zip)
2025-05-19T13:20:14.1824509Z ##[error]Error: Archive creation failed for archive file: zipfile.zip
code: 12
stdout:
zip error: Nothing to do! (zipfile.zip)
stderr:
error: undefined;
2025-05-19T13:20:14.1826046Z ##[error]Archive creation failed for archive file: zipfile.zip
code: 12
stdout:
zip error: Nothing to do! (zipfile.zip)
stderr:
error: undefined;
2025-05-19T13:20:14.1837545Z ##[section]Finishing: Package Manifest File
Full task logs with system.debug enabled
[REPLACE THIS WITH YOUR INFORMATION]