无法创建发布工件目录(拒绝访问路径'C:\ agent \ _work \ r1 \ a \ NUL'。)

时间:2018-02-07 07:41:52

标签: build azure-devops nul build-agent azure-devops-self-hosted-agent

最近,我们的构建代理程序(运行Windows 2016的2台单独安装的计算机)安装了VSTS构建代理程序时遇到了烦人的问题。当我们运行del "\\?\%CD%\nul" (see Super User)时,它适用于几个版本,然后再次显示。

如何以及为何创建此文件以及如何确保构建代理不会中断?

下面的Stacktrace:

Failed to create Release artifact directory C:\agent\_work\r1\a with an exception
Microsoft.VisualStudio.Services.Agent.Worker.Release.Artifacts.ArtifactDirectoryCreationFailedException: Failed to create Release artifact directory 'C:\agent\_work\r1\a'. ---> System.UnauthorizedAccessException: Access to the path 'C:\agent\_work\r1\a\NUL' is denied.
   at System.IO.Win32FileSystem.DeleteFile(String fullPath)
   at System.IO.FileInfo.Delete()
   at Microsoft.VisualStudio.Services.Agent.Util.IOUtil.c__DisplayClass26_1.b__0(FileSystemInfo item)
   at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput& currentElement, Int32& currentKey)
   at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.RunTaskSynchronously(Object o)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.ReleaseFileSystemManager.EnsureEmptyDirectory(String directoryPath, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Release.RetryExecutor.Execute(Action action). Retrying the creation of Release artifact directory.

1 个答案:

答案 0 :(得分:5)

在我们的案例中,此问题的原因与构建代理无关。它是我们使用(testcafe)创建文件的测试运行器的子模块。调用此模块的包装器将NUL作为日志文件的名称传递...并且在下一行中无法正确处理。