Ultra GC
Ultra GC

Reputation: 351

Azure Build Pipeline Failed

Need help figuring why we are getting the below error when trying to perform a build:

    stderr:  
error: Error: spawnSync /usr/bin/zip ENOBUFS
    at Object.spawnSync (node:internal/child_process:1111:20)
    at Object.spawnSync (node:child_process:814:24)
    at ToolRunner.execSync (/home/vsts/work/_tasks/ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0/2.211.0/node_modules/azure-pipelines-task-lib/toolrunner.js:879:23)
    at zipArchive (/home/vsts/work/_tasks/ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0/2.211.0/archivefiles.js:152:33)
    at createArchive (/home/vsts/work/_tasks/ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0/2.211.0/archivefiles.js:278:13)
    at doWork (/home/vsts/work/_tasks/ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0/2.211.0/archivefiles.js:338:9)
    at Object.<anonymous> (/home/vsts/work/_tasks/ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0/2.211.0/archivefiles.js:347:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  errno: -105,
  code: 'ENOBUFS',
  syscall: 'spawnSync /usr/bin/zip',
  path: '/usr/bin/zip',
  spawnargs: [Array]
};
##[error]Error: Archive creation failed for archive file: /home/vsts/work/1/a/release/53059.zip 

The above is from the ArchiveFiles@2 task within our Azure DevOps build pipeline. Here's the task:

- task: ArchiveFiles@2
  condition: eq(variables.IS_AFFECTED, 'true')
  inputs:
    rootFolderOrFile: $(Pipeline.Workspace)/dist/${{ folder }}
    includeRootFolder: false
    archiveType: zip
    archiveFile: $(Build.ArtifactStagingDirectory)/release/$(Build.BuildId).zip
    replaceExistingArchive: true

Upvotes: 4

Views: 1228

Answers (2)

Adam Welch
Adam Welch

Reputation: 86

I had the same issue with both ArchiveFiles@2 and ExtractFiles@1 tasks.

In my case it appeared to be the volume of files being archived and extracted. As a temp fix for the ArchiveFiles I set the properties "quiet: true" and "verbose: false" and it was fine. Unfortunately for the ExtractFiles I had to look at why I had so many files in the archive and trimmed it down to get that working.

Upvotes: 7

Mike P
Mike P

Reputation: 29

Same issue here. Started about 5 days ago without explanation.

I did some digging and it looks like Microsoft introduced the problem.

Anyway, you can replace the archive task with one of these options

Option 1

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      Compress-Archive -Path "$(System.DefaultWorkingDirectory)\*" -DestinationPath "$(Build.ArtifactStagingDirectory)\$(Build.BuildId).zip"
    pwsh: true

Option 2

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      cd $(Build.ArtifactStagingDirectory) && /usr/bin/zip -r $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip

Upvotes: 2

Related Questions