azure-pipelines-tasks: Publish Pipeline Artifact (Preview): Cannot upload to a pipeline artifact from release environment.

Environment

Azure Pipelines Release Agent Version: 2.141.1 OS: Hosted Ubuntu 1604 and Hosted VS2017

Issue Description

Pipeline artifact cannot be uploaded from release pipeline.

From documentation: Use this task in a build or release pipeline to publish pipeline artifacts to Azure Pipelines.

I try to combine multiple build artifacts into a single pipeline artifact, that can be used by later stages. All files are copied into $(System.DefaultWorkingDirectory)/application, which is also set as “path to publish”. I also tried other directories under $(Agent.WorkFolder), same result.

Task logs

2018-11-09T12:58:37.0965386Z ==============================================================================
2018-11-09T12:58:37.0965460Z Task         : Publish Pipeline Artifact
2018-11-09T12:58:37.0965719Z Description  : Publish Pipeline Artifact
2018-11-09T12:58:37.0965769Z Version      : 0.139.0
2018-11-09T12:58:37.0965802Z Author       : Microsoft Corporation
2018-11-09T12:58:37.0966013Z Help         : Publish a local directory or file as a named artifact for the current pipeline.
2018-11-09T12:58:37.0966068Z ==============================================================================
2018-11-09T12:58:37.5744150Z ##[error]System.InvalidOperationException: Cannot upload to a pipeline artifact from release environment.
   at Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTask.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, String targetPath, String artifactName, CancellationToken token)
   at Agent.Plugins.PipelineArtifact.PipelineArtifactTaskPluginBase.RunAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
   at Agent.PluginHost.Program.Main(String[] args)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 26 (3 by maintainers)

Most upvoted comments

Closing this issue for now since not being able to publish artifacts in a Release pipeline is by design. We do have a bug around auto-injecting the download task into an RM pipeline (it injects, but the path defaults are wrong) - but that is a separate issue.

Why doesn’t this work in a Release? The documentation here https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact?view=vsts clearly states:

Use this task in a build or release pipeline to publish pipeline artifacts to Azure Pipelines.

I need this feature. I think everyone who knows CI will need this.

Hi @rstabenow, @koreyba, if you check directly code that is executed, then you can see the Publish Pipeline Artifact task works only for Build pipelines.

I was a bit sad after this discovery, as we are waiting for publish artifact from release pipeline for ages.

Just put your build and release in your Pipeline build. You can always download your artifacts after the build.

I thought that this was an improvement over the previous publish task… Still not able to create artifacts from releases, which I need to create installers and setup scripts with specific configuration for environments.

I am also looking forward to seeing this happening. We have many customers who want to publish artifacts at release time.

We need to be able publish functional test results from release pipelines, how do we go about doing that?

I also have this need. As a workaround for copying artifact files from stage (1) to stage (2), I added Azure CLI tasks to my stages, running these “scripts”:

# Upload in stage (1):
az storage blob upload -f $(Build.BuildNumber).file --container-name something --name $(Build.BuildNumber).file --account-name storageaccount

And in the later stage(s):

# Download in stage (2):
az storage blob download -f $(Build.BuildNumber).file --container-name something --name $(Build.BuildNumber).file --account-name storageaccount

@petenorth if it is just a place to store your test results (given that you can’t import them using the Publish Test Results task), maybe the ##vso[task.uploadfile] command is something for you. More information in this stackoverflow question.

@fleed unfortunately Release pipelines don’t have the ability to have artifacts associated with them in general (other than artifacts that you feed in as inputs to a pipeline).

Hi folks - we’ll correct the documentation. We would also like to be able to associate artifacts with the release pipeline but it doesn’t have the necessary APIs to associate artifacts (of any type).