Error parsing source location in yaml pipeline

1

I am getting the below error while running the Azure DevOps pipeline:

[ERROR] Error parsing source location "D:\a\1\drop": Failed to enumerate directory D:\a\1\drop\ with file pattern *. The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

yaml code:

steps:
     - task: CopyFiles@2
       inputs:
        Contents: 
            test/templates/templatev.json
        TargetFolder: '$(build.artifactstagingdirectory)'

     - task: PublishBuildArtifacts@1
       displayName: 'Publish ARM Templates: templates'
       inputs:
          PathtoPublish: '$(Build.ArtifactStagingDirectory)'
          ArtifactName: drop

    - task: AzureFileCopy@3
           inputs:
              SourcePath: '$(Pipeline.Workspace)/drop'
              azureSubscription: '$(azureSubscription)'
              Destination: 'AzureBlob'
              storage: 'testblob'
              ContainerName: 'testfolder'
              BlobPrefix: '$(Build.BuildId)'
              outputStorageUri: 'testUrl'

in the last step, it is not able find the source path.

azure-devops
asked on Stack Overflow Dec 1, 2020 by Lakshmi Prasanna • edited Dec 2, 2020 by Cătălina Sîrbu

1 Answer

0

The Azure file copy task generally is used to copy files or directly from the agent machine to a Azure blob or Azure VMs.

The source files or directly you want to copy must be existing on the agent machine when executing this task.

In the steps you shared, I do not see any step to create the directory "$(Pipeline.Workspace)/drop" on the agent machine, and copy or generate the artifacts into this directory. This directory is not automatically generated by default during the pipeline run. So, this directory is not existing.

NOTE: the Publish Build Artifacts task will not generate the drop folder into $(Pipeline.Workspace) on the agent machine. It just generates the drop folder on the details page of each pipeline run to store the published artifacts of the run. enter image description here

In your case, I noticed that you have copy the build artifacts into the $(build.artifactstagingdirectory) directory on the agent machine. If you want to copy the build artifacts to the Azure blob, you can directory set the source path as $(build.artifactstagingdirectory) on the Azure file copy task.

answered on Stack Overflow Dec 1, 2020 by Bright Ran-MSFT • edited Dec 1, 2020 by Bright Ran-MSFT

User contributions licensed under CC BY-SA 3.0