Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PublishPipelineArtifact is deprecated - Publish a local directory or file as a named artifact for the current pipeline

I have the following Azure Pipelines job:

- stage: Production
  dependsOn: Test
  jobs:
  - job: Publish
    pool:
      vmImage: 'Ubuntu 16.04'
    steps:
    - task: UseDotNet@2
      displayName: Setup
      inputs:
        packageType: sdk
        version: 3.1.x
    - task: DotNetCoreCLI@2
      displayName: Publish
      inputs:
        command: publish
        publishWebProjects: false
        projects: 'src/**/*.csproj'
        arguments: '--configuration production --output $(Build.ArtifactStagingDirectory)'
        zipAfterPublish: true
    - task: PublishPipelineArtifact@0
      displayName: Export
      inputs:
        artifactName: Production
        targetPath: '$(Build.ArtifactStagingDirectory)'
  - deployment: Deploy
    dependsOn: Publish
    pool:
      vmImage: Ubuntu-16.04
    environment: Production
    strategy:
      runOnce:
        deploy:
          steps:
          - task: DownloadPipelineArtifact@1
            displayName: Import
            inputs:
              artifactName: Production
          - task: AzureRmWebAppDeployment@3
            displayName: Web
            inputs:
              package: '$(Build.ArtifactStagingDirectory)/MyApp.Web.zip'
              azureSubscription: '$(azure.subscription)'
              appType: 'Web App on Windows'
              webAppName: 'my app'   

But now I am getting the error:

PublishPipelineArtifact is deprecated - Publish a local directory or file as a named artifact for the current pipeline

I have been searching for a solution but can't find any.

How to fix this?

like image 528
Miguel Moura Avatar asked Aug 31 '20 16:08

Miguel Moura


People also ask

How do I publish a pipeline artifact?

Display name: artifact display name. File or directory path: the path of the file or directory to publish. Artifact name: name of the artifact to publish. Artifact publish location: choose whether to store the artifact in Azure Pipelines, or to copy it to a file share that must be accessible from the pipeline agent.

What are pipeline artifacts?

Pipeline artifacts are files created by GitLab after a pipeline finishes. Pipeline artifacts are different to job artifacts because they are not explicitly managed by . gitlab-ci. yml definitions. Pipeline artifacts are used by the test coverage visualization feature to collect coverage information.


1 Answers

Update the PublishPipelineArtifact task version from @0 to @1. I added all updated input parameters in the screenshot below.

Your task from the provided example should look like this:

  - task: PublishPipelineArtifact@1
    displayName: Export
    inputs:
      artifact: Production
      targetPath: '$(Build.ArtifactStagingDirectory)'

enter image description here

like image 111
LJ. Avatar answered Oct 16 '22 13:10

LJ.