Azure-pipelines-tasks: PublishPipelineArtifact should allow 2 jobs from same stage to publish to same artifactPath

Created on 4 Mar 2020  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

Required Information

Question, Bug, or Feature?
Type: Feature

Enter Task Name:
PublishPipelineArtifact

Environment

Azure Pipelines
Org: AzureContainerUpstream
Project: Kubernetes
Build Defintion: Node Driver Registrar
Agent: Hosted, Upstream Pool

Issue Description

I have a pipeline that runs across both linux and windows. I would like to publish the artifacts to the same artifactName so they are in the same path when downloaded in another stage/step. This seems to work the way I expect with PublishBuildArtifacts.

Error logs

File upload succeed.
Upload 'C:\Users\azureuser\vsts-agent\_work\1\a' to file container: '#/347859/release'
Async Command End: Upload Artifact
##[error]Artifact release already exists for build 4572.
Finishing: Publish release
ArtifactsCore enhancement stale

Most helpful comment

Thanks for the feedback!

We're now tracking this request on our backlog to add functionality to the PublishBuildArtifacts task. No ETA right now but we can update when there is one.

All 4 comments

Thanks for the feedback!

We're now tracking this request on our backlog to add functionality to the PublishBuildArtifacts task. No ETA right now but we can update when there is one.

I'd like to add another use case to this request, simply to make sure it is captured. We are using parallel builds (i.e., strategy: parallel: N, where N > 1) to speed up our user interface testing. Each parallel run is producing a similar (but distinct) set of test result artifacts (as json files), one json file for each suite of tests (we are using Cypress.io for testing and orchestration). These files are all placed into the same folder for each parallel runner. So, for instance, the files look something like this:

- Agent 1
| -- $(Build.ArtifactStagingDirectory)/results/suite.1.json
| -- $(Build.ArtifactStagingDirectory)/results/suite.2.json
- Agent 2
| -- $(Build.ArtifactStagingDirectory)/results/suite.3.json
| -- $(Build.ArtifactStagingDirectory)/results/suite.4.json

We are currently using a task as follows in each build:

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)/results'
    artifactName: 'uiTestResults'

When we switch to using PublishBuildArtifacts@1 we arrive at the expected result of having all 4 files uploaded, however, like @jchauncey, if we switch to PublishPipelineArtifact@1 we get the following error:

No LastRequestResponse on exception ArtifactExistsException: Artifact uiTestResults already exists for build 26124. Microsoft.TeamFoundation.Build.WebApi.ArtifactExistsException: Artifact uiTestResults already exists for build 26124.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Agent.Plugins.PipelineArtifact.BuildServer.AssociateArtifactAsync(Guid projectId, Int32 pipelineId, String name, String jobId, String type, String data, Dictionary`2 propertiesDictionary, CancellationToken cancellationToken)
   at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.<>c__DisplayClass2_1.<<UploadAsync>b__2>d.MoveNext()

We have this ask in our backlog, unfortunately we do not have a date for delivery at this time.

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

Was this page helpful?
0 / 5 - 0 ratings