Search code examples
azure-devopsazure-web-app-serviceazure-devops-rest-apiallureazure-devops-extensions

How to deploy Build Artifact separately to AzureWebapp root directory using AzureDevops


We were trying to publish the Allure report generated as part of our AzureDevops build pipeline and it seems Azuredevops has some limitations to publish the report and get a tab to analyze as part of the build output. So as per the Allure Extensions document site saying, we tried alternate option to publish the report to Azure webapp and seems its working fine. We cant try the "FTP Upload" task to upload the artifact to the webapp as its restricted in our environment, so tried with direct "webap deployment" task. Below are the tasks which we tried as part o the pipeline.

  • task: CmdLine@2 condition: always() inputs: script: | mvn allure:report

  • task: AzureRmWebAppDeployment@4 condition: always()
    inputs: ConnectionType: 'AzureRM' azureSubscription: 'xxxxxxxxxxx' appType: 'webAppLinux' WebAppName: 'xxxxxxxxxxxxx' packageForLinux: '$(System.DefaultWorkingDirectory)/target/allure-report'

We need to publish the report for each pipeline build and by doing the above "AzureRmWebAppDeployment" task, this will replace the previous report artifact and will deploy new one. So we are not getting report for each build.

We dont have FTP connectivity enabled to publish the artifacts to the Appservices and its restricted as per the policy.

So looking for a way to achieve the below items

  • Should be able to Publish the Allure report of each build separately. ( looking for a solution to deploy the Allure reports seperately to the "wwwrroot" directory of webapp with bildnubmer as directory name.
  • Without using "FTP Upload" task, can we achieve this?
  • can we integrate the published result in azure webapp to the Build output interface as same as other results are showing in Azuredevops?

Solution

  • We found solution for our requirement by using az web app cli command

    az webapp deploy --resource-group 'rg' --name 'apss' --src-path '$(System.DefaultWorkingDirectory)/$(Build.BuildId)/$(Build.BuildId).zip' --type zip --clean false --target-path '$(Build.BuildId)
    

    Here the parameter "--clean false" will keep the existing folders there.