I've set up an Azure DevOps build pipeline. Everything is working fine, except for the ArchiveFiles step that should generate the artifact to be published to Azure afterwards.
I'm using the following YAML configuration:
- script: |
call dist.bat
tree /A /F
displayName: 'build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.BinariesDirectory)
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
verbose: true
The dist.bat is building the project and placing the resulting archives at dist/ in the local directory. The tree command shows that the files are correctly generated and located in the folder.
Finished building distributable exe including resources and dependencies
Final distributable folder is dist\
Folder PATH listing for volume Temporary Storage
Volume serial number is 000000F9 5455:3543
D:.
| .gitignore
| azure-pipelines.yml
| dist.bat
| Main.py
| Main.spec
| Pipfile
| Pipfile.lock
| __init__.py
|
+---dist
| | MyApp.exe
| | default.ini
| | User Guide.pptx
| |
| \---resources
| | default-german.ini
| |
| +---configurations
| \---templates
| Template_InputData_English.xlsx
|
When it comes to the ArchiveFiles task, $(Build.BinariesDirectory) is set to dist/. According to the output log, this folder is found. However, it's only an empty directory with 0 files and 0 bytes in it:
[command]d:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.159.0\7zip\7z.exe a -tzip -bb3 -mx=5 d:\a\1\a\1487.zip @d:\a\_temp\bfoix61oaayw7eqhcvclahsemi
7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10
Scanning the drive:
1 folder, 0 files, 0 bytes
Creating archive: d:\a\1\a\1487.zip
Items to compress: 1
Files read from disk: 0
Archive size: 138 bytes (1 KiB)
Everything is Ok
Is there possibly some configuration error I'm missing? I think it might be related to some path mixup, but it's hard to debug based on the shortened filepaths and missing context information. The following is shown in the debug log for the ArchiveFiles task:
##[debug]agent.workFolder=d:\a
[...]
##[debug]System.DefaultWorkingDirectory=d:\a\1\s
##[debug]rootFolderOrFile=d:\a\1\b
##[debug]makeAbsolute:d:\a\1\b
##[debug]includeRootFolder=true
##[debug]archiveType=zip
##[debug]archiveFile=d:\a\1\a\1487.zip
##[debug]replaceExistingArchive=true
[...]
##[debug]Listing all 1 files to archive:
##[debug]b
##[debug]Checking for archive destination folder:d:\a\1\a
##[debug]Creating archive with 7-zip: d:\a\1\a\1487.zip
[...]
##[debug]exec tool: d:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.159.0\7zip\7z.exe
##[debug]Arguments:
##[debug] a
##[debug] -tzip
##[debug] -bb3
##[debug] -mx=5
##[debug] d:\a\1\a\1487.zip
##[debug] @d:\a\_temp\bfoix61oaayw7eqhcvclahsemi
Thank you for your help!
Build.BinariesDirectory? You don't set that variable, that variable is system-assigned and points to a specific location in your agent's working folder. Check your build process and validate that the files are being output to the location you think they are. - Daniel Mann