Azure-pipelines-tasks: Release Definition 'Publish Build Artifacts' fails

Created on 26 Oct 2018  路  6Comments  路  Source: microsoft/azure-pipelines-tasks

Environment

TFS on-premises, provide the version: Version 16.131.28106.2

  • Agent Private:

    • If using private agent, provide the OS of the machine running the agent and the agent version:

      Windows 10, Visual Studio Professional 15.8, Agent.Version | 2.122.1

Issue Description

Release Definition 'Publish Build Artifacts' keeps failing

When published to shared folder:

2018-10-26T15:07:44.1432264Z ##[error]Unable to process command '##vso[artifact.associate artifacttype=filepath;artifactname=TestRelease_Release-15;artifactlocation=\\cmpny\data;]\\cmpny\data' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
2018-10-26T15:07:44.1432264Z ##[error]Value cannot be null.
Parameter name: buildId
2018-10-26T15:07:44.1901114Z ##[debug]System.ArgumentNullException: Value cannot be null.
Parameter name: buildId
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.ArtifactCommandExtension.ProcessArtifactAssociateCommand(IExecutionContext context, Dictionary`2 eventProperties, String data)
   at Microsoft.VisualStudio.Services.Agent.Worker.WorkerCommandManager.TryProcessCommand(IExecutionContext context, String input)

When published to TFS:
2018-10-26T15:05:22.4400661Z ##[error]This task must run in a build to publish artifacts to Visual Studio Team Services/TFS.

Release Definition Provided
I have attached the exported json file from the release definition. Although I have removed/replace sensitive information. So you may need to patch it properly before importing. It is in txt format as github won't allow json upload.

I am new to TFS and hence might lack the understanding as to how the release definition works.
Is there a different mechanism to publish released items ideally to TFS (and not file share) ?

TestRelease.txt

Most helpful comment

Copy it to somewhere on a folder/network.

If you want it to be an artifact you need to create it in a build, publish as artifact in the build and then copy that artifact to a folder/network from within a release-process.

Pls checkout the concepts/guids here -> https://docs.microsoft.com/en-us/azure/devops/pipelines/release/artifacts?view=vsts#sources

All 6 comments

The task 'Publish Artifact' can only run in a build process. You create Artifacts that are attached to the build. In your release the artifacts from the underlying are downloaded automatically. you can than use tasks like 'copy' etc to deploy the artifacts to where you want them to be

Does it mean we cannot have artifact (viz. released MSI) on the release task 'to be downloaded on click' on TFS?

You can, you just used the wrong task in the wrong context. A Release-Definition deploys the artifacts of a build-definition. You are creating a file in release-definition and try to publish it as artifact. The last part is supposed to run in a build-process. replace this with a copy-task to copy the file or artifact

One last thing to clarify before we close this issue.

The copy-task, you mean copy it to somewhere on a folder/network and not be an artifact on the Release? Or copy where?

I understand that publish build artifact shouldn't be on a release definition. Thanks for your reply.

Copy it to somewhere on a folder/network.

If you want it to be an artifact you need to create it in a build, publish as artifact in the build and then copy that artifact to a folder/network from within a release-process.

Pls checkout the concepts/guids here -> https://docs.microsoft.com/en-us/azure/devops/pipelines/release/artifacts?view=vsts#sources

Thanks a lot @JohannesDrexler

Was this page helpful?
0 / 5 - 0 ratings