0
votes

I am using azure devops multi staging pipelines and have the following YAML file. I can create a build and then publish the build artifact to drop. When I try to deploy, I get an error seen below.

I have tried many things but I want my deployment to be in the same pipeline as I know you can add it to the release pipeline. Am I missing something?

stages:
- stage: Build
jobs:
- job: Build
  pool:
    name: Hosted Windows 2019 with VS2019
    demands: azureps

  steps:

# Restore
  - task: DotNetCoreCLI@2
    displayName: Restore
    inputs:
      command: restore
      projects: '**/*.csproj'
      feedsToUse: select
      vstsFeed : myfeed
      includeNuGetOrg : true

# Build
  - task: DotNetCoreCLI@2
    displayName: Build
    inputs:
      command: build
      projects: '**/*.csproj'
      arguments: '--configuration Release' 

# Publish
  - task: DotNetCoreCLI@2
    displayName: Publish
    inputs:
      command: publish
      publishWebProjects: True
      arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
      zipAfterPublish: True

# Publish Artifact
  - task: PublishBuildArtifacts@1

- stage: Dev
  jobs:
  # track deployments on the environment
  - deployment: DeployWeb
   pool:
     vmImage: 'ubuntu-latest'
     # creates an environment if it doesn’t exist
   environment: 'my-dev'
   strategy:
     # default deployment strategy
     runOnce:
      deploy:
        steps:
         - task: DownloadBuildArtifacts@0
           inputs:
             buildType: 'current'
             downloadType: 'single'
             artifactName: 'drop'
             downloadPath: '$(build.ArtifactStagingDirectory)'

         - task: AzureWebApp@1
           displayName: Azure Web App Deploy
           inputs:
             appType: 'webapp'
             azureSubscription: '213456123'
             appName: mytestapp
         package:$(System.DefaultWorkingDirectory)/**/*.zip

Error I am getting enter image description here

2
In the release pipeline there is a Download artifact task - the logs output where the zip is being dropped to i.e. Downloading drop/ReleaseFiles.zip to C:\agents\release\1\_work\r9\a\Build\drop\\ReleaseFiles.zip which would confirm the location is correct in the deploy stage?MikeS
How do you get this error? There isn't Drop/DepartmentAPI.zip path in your yaml.starian chen-MSFT

2 Answers

1
votes

The artifact has been downloaded to artifact folder $(build.ArtifactStagingDirectory), so the package path could be: package:$(build.ArtifactStagingDirectory)/**/*.zip

1
votes

In my case, I simply copied artifact download path from DownloadBuildArtifacts@0 task after its implementation and pasted it in AzureWebApp@1 task's package property.

Yes, it required me to run a single fail so that I can find exact path where artifacts are downloaded. Can simply run DownloadBuildArtifacts@0 task only so that you can find exact download path of artifacts.