build - 创建发布工件目录失败(访问路径 'C:\agent\_work\r1\a\NUL' 被拒绝。)

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

最近,安装了 VSTS 构建代理的构建代理(2 台单独安装的运行 Windows 2016 的机器)遇到了一个恼人的问题。当我们运行 del "\\?\%CD%\nul" (see Super User)它适用于几个构建,然后再次出现。

这个文件是如何以及为什么创建的,我们如何确保构建代理不会中断?

下面的堆栈跟踪:

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.

最佳答案

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

关于build - 创建发布工件目录失败(访问路径 'C:\agent\_work\r1\a\NUL' 被拒绝。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48658367/

相关文章:

.net - TeamCity 不会复制所有引用的库

build - 在命令行上编译C++ Builder项目

git - Azure Devops Git 分支区分大小写

python - 无法在 vscode 中导入 azureml

bash - 如何在 bash 中使用 AWK 添加 NUL 字符分隔符?

security - Nexus Pro 如何自动验证下载 Artifact 的真实性?

django - Docker:从Web容器内部执行将django迁移到db容器

azure-devops - 允许所有用户查看添加到错误/任务的图像的 VSTS 权限

c - 为什么我使用 fopen fclose c++ linux 在我的书面文件中有 NUL 行?