Henrik
Henrik

Reputation: 525

TFS (vNext) build randomly fails in step 'Publish Artifacts'

Since some time already, our TFS 2015 builds fail randomly in Publish Artifacts step. The upload starts properly and after some uploaded files the process stops with this message: ##[error]A task was canceled. (see below).

Normally we can work around that issue by simply re-queue another build. However this is annoying and contradict the idea of CI/CD.

The generic error message give me no clue where to look for the problem. Any ideas?

  2016-10-26T12:47:47.8071677Z Files found locally 1772, 
  2016-10-26T12:47:47.8071677Z Files evaluated 1772, 
  2016-10-26T12:47:47.8071677Z Files left to evaluate 0., 
  2016-10-26T12:47:47.8071677Z Files created without upload 0, 
  2016-10-26T12:47:47.8071677Z Files uploaded 796 
  2016-10-26T12:47:47.8071677Z Files left to process 976 
  2016-10-26T12:47:47.8071677Z --------------------------- 
  2016-10-26T12:47:49.0421524Z Start: UploadArtifact 
  2016-10-26T12:47:49.0577804Z ##[error]A task was canceled. 
  2016-10-26T12:47:49.0577804Z End: UploadArtifact

Update

As proposed by @Patrick-MSFT, I enabled system.debug and got some more error details:

   ---------------------------
   Files found locally 1852,
   Files evaluated 1852,
   Files left to evaluate 0.,
   Files created without upload 0,
   Files uploaded 1316
   Files left to process 536
   ---------------------------
   Start: UploadArtifact
   System.Threading.Tasks.TaskCanceledException: A task was canceled.
   End: UploadArtifact
   ******************************************************************************
   Finishing task: PublishBuildArtifacts
   ******************************************************************************
   System.Exception: Task PublishBuildArtifacts failed. This caused the job to fail. Look at the logs for the task for more details.
   at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)
   ******************************************************************************
   Finishing Build
   ******************************************************************************
   Worker Worker-89de22b8-0ad4-4541-ad73-a758c9783464 finished running job 89de22b8-0ad4-4541-ad73-a758c9783464

Upvotes: 3

Views: 467

Answers (2)

Henrik
Henrik

Reputation: 525

Finally, I solved the problem by simply updating the build agent to the latest version. The old version in use was 1.105.7. Now I updated to 2.105.6.

Upvotes: 1

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51073

For the troubleshooting with a special build task, you can try this:

  1. On the variables tab, add system.debug and set it to true. Select to allow at queue time.
  2. In the explorer tab, view your completed build and click the build step to view its output.

The control options arguments described above can also be useful when you're trying to isolate a problem.

Please double check if you have set the Timeout in Control options of 'Publish Artifacts' which stands for this task in minutes. This may cause the fail.

And also create a new build definition with the same settings and try to reproduce your issue.

Upvotes: 0

Related Questions