Search code examples
node.jsazure-devopsyamlazure-pipelines

Release failing due to incorrect path in Azure DevOps


Release failing for NodeJS app in Azure DevOps which appears to be due to incorrect path. Attached yaml and error

YAML:-

steps:
- task: ExtractFiles@1
  displayName: 'Extract files '
  inputs:
    archiveFilePatterns: '$(System.DefaultWorkingDirectory)/_NodeJS-Node.js With Grunt-CI/drop/$(Build.BuildId).zip'
    destinationFolder: .

Error:-

Error


Solution

  • I can reproduce the same issue when using the same task settings of the Extract Files task.

    enter image description here

    The cause of the issue is that the option: cleanDestinationFolder in the Extract Files task is set to true by default.

    When you set the destinationFolder to ., it will clean all files in the $(System.DefaultWorkingDirectory) folder(including zip file) before unzipping the files.

    In this case, the zip file will not be found by the task.

    To solve this issue, you need to set cleanDestinationFolder to false in the Extract Files task.

    For example:

    steps:
    - task: ExtractFiles@1
      displayName: 'Extract files '
      inputs:
        archiveFilePatterns: '$(System.DefaultWorkingDirectory)/_NodeJS-Node.js With Grunt-CI/drop/$(Build.BuildId).zip'
        destinationFolder: .
        cleanDestinationFolder: false
    

    Classic Editor:

    enter image description here

    Result:

    enter image description here

    For more detailed info, you can refer to this doc: ExtractFiles@1 - Extract files v1 task