Azure DevOps yaml pipeline, downloaded artifact is empty

可紊 提交于 2021-01-27 16:45:25

问题


Converting a pipeline from classic to YAML (so I know it works).

I build and my publish artifact task looks like this:

  - task: PublishPipelineArtifact@1
    displayName: 'Publish Pipeline Artifact'
    inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)/MyArtifact'
      artifact: MyArtifact

The result when build looks like this:

I then want to deploy this to a webapp YAML:

- stage: Dev
  jobs: 
  - job: DeployApp
    displayName: Deploy Web App
    pool:
      name: myPrivate
      demands: msbuild
    steps:
    - task: DownloadPipelineArtifact@2
      inputs:
        artifact: MyArtifact
    - task: AzureRmWebAppDeployment@4
      displayName: 'Deploy App'
      inputs:
        WebAppKind: 'Web App On Windows'
        azureSubscription: 'edited out...'
        WebAppName: webAppName
        package: '$(System.ArtifactsDirectory)'
        enableXmlTransform: true

Which results in this output in Azure DevOps:

A difference in chunks but since size match very exactly I'm happy.

I then get error on the deployment so I started look in Kudo and can see that in SitePackages all my packages are 1 kb (or empty...). I expected 61.2 MB.

I took my working classic deployment, and there i had this row:

packageForLinux:'$(System.DefaultWorkingDirectory)/_MyArtifact/MyArtifact/MyApplication.zip'

But that path wasn't even found. And packageForLinux felt wrong but doesn't matter as I understand it.

So can someone please me in the right direction how to deploy a web app (on windows) using YAML?


回答1:


The folder that's used is $(Pipeline.Workspace), not $(System.DefaultWorkingDirectory), the default folder is different for each task type, so you can't always trust they extract to the default working directory.



来源:https://stackoverflow.com/questions/56805440/azure-devops-yaml-pipeline-downloaded-artifact-is-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!