Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
666 views
in Technique[技术] by (71.8m points)

Azure pipelines ArchiveFiles Archive creation failed

I'm trying to zip a Rust debug build folder using the ArchiveFiles task in my Azure pipeline. This fails with the error message:

##[error]Error: Archive creation failed for archive file: D:a1aMyProject-win-33.zip

This is the yaml for ArchiveFiles:

  - task: ArchiveFiles@2
    inputs:
      rootFolderOrFile: '$(Build.BinariesDirectory)/target/debug'
      includeRootFolder: true
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/MyProject-$(build)-$(Build.BuildId).zip'
      replaceExistingArchive: true
      verbose: true

And here are the full output of a verbose task log with System.Debug set to true:

2021-01-09T23:55:48.6172670Z ##[debug]Evaluating condition for step: 'ArchiveFiles'
2021-01-09T23:55:48.6174643Z ##[debug]Evaluating: SucceededNode()
2021-01-09T23:55:48.6175445Z ##[debug]Evaluating SucceededNode:
2021-01-09T23:55:48.6176652Z ##[debug]=> True
2021-01-09T23:55:48.6177228Z ##[debug]Result: True
2021-01-09T23:55:48.6178206Z ##[section]Starting: ArchiveFiles
2021-01-09T23:55:48.6303073Z ==============================================================================
2021-01-09T23:55:48.6303384Z Task         : Archive files
2021-01-09T23:55:48.6303616Z Description  : Compress files into .7z, .tar.gz, or .zip
2021-01-09T23:55:48.6304004Z Version      : 2.179.0
2021-01-09T23:55:48.6304379Z Author       : Microsoft Corporation
2021-01-09T23:55:48.6304683Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/archive-files
2021-01-09T23:55:48.6305000Z ==============================================================================
2021-01-09T23:55:48.6488004Z ##[debug]Using node path: C:agents2.179.0externals
ode10in
ode.exe
2021-01-09T23:55:49.0940866Z ##[debug]agent.TempDirectory=D:a\_temp
2021-01-09T23:55:49.0964617Z ##[debug]loading inputs and endpoints
2021-01-09T23:55:49.0983185Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2021-01-09T23:55:49.1093409Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2021-01-09T23:55:49.1096519Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2021-01-09T23:55:49.1099079Z ##[debug]loading INPUT_ARCHIVEFILE
2021-01-09T23:55:49.1101178Z ##[debug]loading INPUT_ARCHIVETYPE
2021-01-09T23:55:49.1103385Z ##[debug]loading INPUT_INCLUDEROOTFOLDER
2021-01-09T23:55:49.1105630Z ##[debug]loading INPUT_QUIET
2021-01-09T23:55:49.1108117Z ##[debug]loading INPUT_REPLACEEXISTINGARCHIVE
2021-01-09T23:55:49.1110533Z ##[debug]loading INPUT_ROOTFOLDERORFILE
2021-01-09T23:55:49.1112588Z ##[debug]loading INPUT_SEVENZIPCOMPRESSION
2021-01-09T23:55:49.1114939Z ##[debug]loading INPUT_TARCOMPRESSION
2021-01-09T23:55:49.1116869Z ##[debug]loading INPUT_VERBOSE
2021-01-09T23:55:49.1123273Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2021-01-09T23:55:49.1130786Z ##[debug]loaded 13
2021-01-09T23:55:49.1135334Z ##[debug]Agent.ProxyUrl=undefined
2021-01-09T23:55:49.1136491Z ##[debug]Agent.CAInfo=undefined
2021-01-09T23:55:49.1137088Z ##[debug]Agent.ClientCert=undefined
2021-01-09T23:55:49.1137595Z ##[debug]Agent.SkipCertValidation=undefined
2021-01-09T23:55:49.1143104Z ##[debug]System.DefaultWorkingDirectory=D:a1s
2021-01-09T23:55:49.1153711Z ##[debug]rootFolderOrFile=D:a1arget
elease
2021-01-09T23:55:49.1154416Z ##[debug]makeAbsolute:D:a1arget
elease
2021-01-09T23:55:49.1157283Z ##[debug]includeRootFolder=true
2021-01-09T23:55:49.1158804Z ##[debug]archiveType=zip
2021-01-09T23:55:49.1160944Z ##[debug]archiveFile=D:a1aMyProject-win-33.zip
2021-01-09T23:55:49.1162448Z ##[debug]replaceExistingArchive=true
2021-01-09T23:55:49.1163806Z ##[debug]verbose=true
2021-01-09T23:55:49.1165133Z ##[debug]quiet=false
2021-01-09T23:55:49.1165602Z ##[debug]repoRoot: D:a1s
2021-01-09T23:55:49.1172347Z ##[debug]win: Win
2021-01-09T23:55:49.1179483Z ##[debug]check path : D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.0ask.json
2021-01-09T23:55:49.1258869Z ##[debug]adding resource file: D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.0ask.json
2021-01-09T23:55:49.1260426Z ##[debug]system.culture=en-US
2021-01-09T23:55:49.1293980Z Found 1 files
2021-01-09T23:55:49.1296045Z Archiving file: release
2021-01-09T23:55:49.1296630Z ##[debug]Listing all 1 files to archive:
2021-01-09T23:55:49.1297020Z ##[debug]release
2021-01-09T23:55:49.1300320Z ##[debug]Checking for archive destination folder:D:a1a
2021-01-09T23:55:49.1305158Z ##[debug]Creating archive with 7-zip: D:a1aMyProject-win-33.zip
2021-01-09T23:55:49.1310775Z ##[debug]which 'D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe'
2021-01-09T23:55:49.1319604Z ##[debug]found: 'D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe'
2021-01-09T23:55:49.1321461Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: a
2021-01-09T23:55:49.1322527Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: -tzip
2021-01-09T23:55:49.1323687Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: -bb3
2021-01-09T23:55:49.1324510Z ##[debug]sevenZipCompression=5
2021-01-09T23:55:49.1325292Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: -mx=5
2021-01-09T23:55:49.1327334Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: D:a1aMyProject-win-33.zip
2021-01-09T23:55:49.1328387Z ##[debug]Agent.TempDirectory=D:a\_temp
2021-01-09T23:55:49.1329612Z ##[debug]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe arg: @D:a\_tempv0bycktans
2021-01-09T23:55:49.1330806Z ##[debug]cwd (include root folder)= D:a1arget
2021-01-09T23:55:49.1332246Z ##[debug]exec tool: D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe
2021-01-09T23:55:49.1332719Z ##[debug]arguments:
2021-01-09T23:55:49.1333379Z ##[debug]   a
2021-01-09T23:55:49.1333967Z ##[debug]   -tzip
2021-01-09T23:55:49.1334528Z ##[debug]   -bb3
2021-01-09T23:55:49.1335111Z ##[debug]   -mx=5
2021-01-09T23:55:49.1335728Z ##[debug]   D:a1aMyProject-win-33.zip
2021-01-09T23:55:49.1336381Z ##[debug]   @D:a\_tempv0bycktans
2021-01-09T23:55:49.1342541Z [command]D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe a -tzip -bb3 -mx=5 D:a1aMyProject-win-33.zip @D:a\_tempv0bycktans
2021-01-09T23:55:49.1396505Z ##[debug]execResult: {"code":null,"error":{"errno":"ENOENT","code":"ENOENT","syscall":"spawnSync D:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe","path":"D:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.179.0\7zip\7z.exe","spawnargs":["a","-tzip","-bb3","-mx=5","D:\a\1\a\MyProject-win-33.zip","@D:\a\_temp\v0bycktans"]},"stdout":"","stderr":""}
2021-01-09T23:55:49.1399073Z ##[debug]Archive creation failed for archive file: D:a1aMyProject-win-33.zip 
code: 0 
stdout:  
stderr:  
error: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1434709Z ##[error]Error: Archive creation failed for archive file: D:a1aMyProject-win-33.zip 
code: 0 
stdout:  
stderr:  
error: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1445687Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Archive creation failed for archive file: D:a1aMyProject-win-33.zip %0Acode: 0 %0Astdout:  %0Astderr:  %0Aerror: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1447274Z ##[debug]task result: Failed
2021-01-09T23:55:49.1448528Z ##[error]Archive creation failed for archive file: D:a1aMyProject-win-33.zip 
code: 0 
stdout:  
stderr:  
error: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1450183Z ##[debug]Processed: ##vso[task.issue type=error;]Archive creation failed for archive file: D:a1aMyProject-win-33.zip %0Acode: 0 %0Astdout:  %0Astderr:  %0Aerror: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1458570Z ##[debug]Processed: ##vso[task.complete result=Failed;]Archive creation failed for archive file: D:a1aMyProject-win-33.zip %0Acode: 0 %0Astdout:  %0Astderr:  %0Aerror: Error: spawnSync D:a\_tasksArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b02.179.07zip7z.exe ENOENT;
2021-01-09T23:55:49.1559430Z ##[section]Finishing: ArchiveFiles

I don't understand the error message, and I have made sure the folder exists.

question from:https://stackoverflow.com/questions/65649103/azure-pipelines-archivefiles-archive-creation-failed

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Azure pipelines ArchiveFiles Archive creation failed

There is an issue Extract Files task failed on x86 agent on github about it:

This is a real problems because there are x86 agents and all the tasks that include 7zip are created to work only for x64. This is because OS architecture is not taken into account when including resources. Problems until now with the following tasks ExtractFiles/ArchiveFiles.

To resolve this issue, you could try to use powershell scripts to achieve files:

- task: PowerShell@2
  displayName: 'Inline Powershell'
  inputs:
    TargetType: inline
    Script: |
     Compress-Archive -Path "$(Build.BinariesDirectory)argetdebug" -DestinationPath "$(Build.ArtifactStagingDirectory)MyProject-$(build)-$(Build.BuildId).zip"
    pwsh: true

Check the document Compress-Archive for some more details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...