0
votes

In one of stage I am downloading artifacts for (win,linux and mac agent) to my Blob storage using Azure CLI and I have the folder structure like this in Azure blob container after I download. In the bin folders I have files and folders and few dlls.

MyBlobContainer --> Project_x64-linux-->bin
               ---> Project_x64-mac--> bin
               ---> project_x4-win--> bin

Downloading is done by this inline script in an YAML AZure Cli Task:

 inlineScript: az storage blob upload-batch -d "$(BlobContainer)/ProjectName/$(DeploymentVersion)/Project_x64-$(osSuffix)" --account-name "myStorageAccount" -s "$(Build.SourcesDirectory)/Project_x64-$(osSuffix)"
    

In the same stage when I debug my Build.SourceDirectory by calling Get-ChildItem $(Build.SourcesDirectory) -Recurse

I get all the child directories and files. One of the file I see in debug is in this directory:

Directory: D:\a\1\s\packages\KinectSDK\windows-desktop\amd64\release\bin

-a----        3/16/2021   8:57 PM       24038776 onnxruntime.dll  

I am interested in copying this dll in the bin folder of my downloaded artifacts above. How can I do it?

1

1 Answers

1
votes

You can add a Copy files task before the Azure Cli Task to copy the onnxruntime.dll file to the bin folder of the artfacts. See below:

steps:
- task: CopyFiles@2
  displayName: 'Copy Files to: $(Build.SourcesDirectory)/Project_x64-$(osSuffix)/bin'
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)/packages/KinectSDK/windows-desktop/amd64/release/bin'
    Contents: onnxruntime.dll
    TargetFolder: '$(Build.SourcesDirectory)/Project_x64-$(osSuffix)/bin'
    flattenFolders: true
  condition: eq(variables['osSuffix'], 'win')

You can also copy the onnxruntime.dll file in the Azure CLI task using Copy-Item command. See below:

- task: AzureCLI@2
  displayName: 'Azure CLI '
  inputs:
    azureSubscription: 'Subscription-Azure'
    scriptType: ps
    scriptLocation: inlineScript
    inlineScript: |
    
     Copy-Item "$(Build.SourcesDirectory)/packages/KinectSDK/windows-desktop/amd64/release/bin/onnxruntime.dll" -Destination "$(Build.SourcesDirectory)/Project_x64-$(osSuffix)/bin"
      
     az storage blob upload-batch ....

You can also using Az Cli command to copy the onnxruntime.dll to your Blob storage directly.

AzCopy command:

azcopy copy '$(Build.SourcesDirectory)/packages/KinectSDK/windows-desktop/amd64/release/bin/onnxruntime.dll' 'https://mystorageaccount.dfs.core.windows.net/mycontainer/ProjectName/$(DeploymentVersion)/Project_x64-$(osSuffix)/bin/onnxruntime.dll'