Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Pipeline/AZ Copy not copying to root directory in storage blob

I'm having issues with deploying my github code to azure storage via azure pipeline. It deploys via AZCopy, but it's going into a subdirectory, which I believe is the reason I'm getting a 404 since the index.html file isn't in the root directory. How can I get my pipeline to deploy storage blob for the root directory?

enter image description here

steps:
- task: AzureFileCopy@2
  displayName: 'AzureBlob File Copy'
  inputs:
    SourcePath: dist/
    azureSubscription: '<subscription was here>'
    Destination: AzureBlob
    storage: ivflowstorageaccount
    ContainerName: '$web'

The folder it copies to $web has my dist files in it so the previous steps seem fine, but I just don't know why it's not copying to root directory. I appreciate any help!

enter image description here

like image 898
JMooreWeb Avatar asked Oct 16 '22 01:10

JMooreWeb


2 Answers

I had the same problem. You need to replace SourcePath: dist/ with SourcePath: dist/*. Then the content of the subfolder will be copied to the root of $web instead of the subfolder itself.

like image 129
Dick Bos Avatar answered Oct 20 '22 16:10

Dick Bos


Usually, without specifying Blob Prefix, the content in the specified folder is copied to the root of the container by default.

According to the screenshot, It seems like the directory structure is as follows.

dist 

-ivflow 
 
  -index.html

The file index.html is in the folder ivflow, and you want to copy the index.html to root directory in storage blob, we can delete the index.html file and recopy the file to root directory via the task Azure file copy(SourcePath: dist/ivflow/ivflow).

If you want to remove all directory structure and only copy file to storage blob, we recommend that you copy the folder one by one from the bottom folder.

In addition, please try to use AzureFileCopy@3 instead of AzureFileCopy@2.

like image 43
Vito Liu Avatar answered Oct 20 '22 16:10

Vito Liu