Search code examples
tfstfs-2015azure-pipelines

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

Solution

  • 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.