3
votes

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:

enter image description here

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:

enter image description here

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.

enter image description here

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 different tasks, so you can't always trust they extract to the default working directory.jessehouwing
@jessehouwing thank you very much! That was exactly it.Pierre

1 Answers

4
votes

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.