我按照通过Pipelines Schema Docs设置池的文档进行操作
,并将其设置为这样pool: Default。这应该指示管道使用默认池:
但是,我不断收到此错误:
找不到名为“默认”的池。该池不存在或尚未获得使用授权。有关授权详细信息,请参阅https://aka.ms/yamlauthz。
据我所知,它应该得到授权。
我也尝试过:
pool:
name: Default
Run Code Online (Sandbox Code Playgroud)
完整的 azure-pipelines.yml
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
trigger:
batch: true
branches:
include:
- master
- develop
pool: Default
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)' …Run Code Online (Sandbox Code Playgroud) 我想查看预定义变量的路径值,就像$(System.DefaultWorkingDirectory)我想查看其中存储的值一样。我无法找到这个变量值,所以我在 Azure DevOps 中哪里可以找到它。
简而言之,我如何检查该特定发布管道中使用的 Build.SourcesDirectory 或 Build.Repository.LocalPath 是什么?
azure azure-devops azure-pipelines azure-devops-self-hosted-agent azure-pipelines-tasks
我有一个“构建”管道,它在我的 java 代码上运行 gradlew build,然后将 jar 作为工件导出。
它目前正在自托管代理上运行,因为我希望这将有助于加快编译速度。
我注意到,在每次运行开始时,它都会说它正在启动一个新的守护进程,因为停止的守护进程无法使用。
在“完成作业”步骤中,它显示“开始清理孤立进程”。然后“终止孤立进程:pid (17162) (java)”。在下图中,您可以看到它确实正在终止守护进程的进程。

我尝试在服务器上运行 gradlew build,然后运行 CI,然后 CI 使用 gradle 守护进程。但是,如果我同时运行两个构建,守护进程有时会在另一个进程处于活动状态时结束。
有什么方法可以停止清理孤立进程或保持守护进程运行吗?
我曾想过使用 cron 作业来构建一些小东西以保持其运行,但这感觉像是一种尴尬的做法。
gradle azure-devops gradle-daemon azure-devops-self-hosted-agent
是否可以创建一个自托管代理并将其分配给 azure devops 上的多个组织?
谢谢
我们的团队正在尝试实施 Azure DevOps 管道,但遇到了一些问题。作为背景,我们正在自托管 Windows 服务器上运行测试。我们对所有工作进行了前端测试,但现在我们在让后端通过方面遇到了问题。
虽然大多数测试都顺利通过,但我们还是有一些情况没有按预期工作。尽管它们应该能够并行运行,但我将其关闭以验证这不是问题。我还尝试过单独运行它们,没有任何明显的变化。
我们得到的错误只是简单的断言失败,如下所示,它没有给我们提供太多信息。
Error Message:
Assert.AreEqual failed. Expected:<True>. Actual:<False>.
Run Code Online (Sandbox Code Playgroud)
但行号指向一个模拟设置,如下所示,我不明白。
mockQueryHandler.Setup(x => x.Handle(It.IsAny<FindQuery>())).Returns(info);
Run Code Online (Sandbox Code Playgroud)
目前给我们带来最多问题的测试类是测试我们的事件警报功能的测试类。看起来第一个测试会通过,但后面的测试会失败。但是,我们的管道设置可以重新运行任何失败的测试三次,直到它放弃。因此,每次重新运行时,下一个测试都会通过。我唯一能想到的是我们的自动模拟由于某种原因给我们带来了麻烦。我们按照 AutoMock - 如何使用 Keyed Registrations 进行单元测试?
我们模拟如下:
var IAbstractEventFactoryMock = new Mock<IAbstractEventFactory>();
using (var mock = AutoMock.GetLoose(builder => builder.RegisterInstance(IAbstractEventFactoryMock.Object).Keyed<IAbstractEventFactory>("EventLogFactory").Keyed<IAbstractEventFactory>("ArpEventLogFactory"))) {
...
}
Run Code Online (Sandbox Code Playgroud)
下面是我们的 .runsettings 文件
<RunSettings>
<RunConfiguration>
<ResultsDirectory>.\TestResults</ResultsDirectory>
</RunConfiguration>
<MSTest>
</MSTest>
</RunSettings>
Run Code Online (Sandbox Code Playgroud)
下面是我们用来运行测试的 YAML
steps:
- task: VSTest@2
displayName: 'Run All Tests'
inputs:
testAssemblyVer2: |
**\*ID_Test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)/ID_Test'
runSettingsFile: 'ID_Test/.runsettings'
runInParallel: false
runTestsInIsolation: true
codeCoverageEnabled: false
testRunTitle: 'Unit Tests' …Run Code Online (Sandbox Code Playgroud) unit-testing azure-devops azure-devops-self-hosted-agent azure-devops-pipelines
我们在本地托管 TFS 2017 Update 2,并使用本地构建代理。NuGet.exe 的最新版本目前是 4.3.0,但我们的构建代理始终默认使用 v4.0.0。如何让我们的构建代理使用最新版本的 NuGet.exe?
我们需要更新,因为NuGet restore在使用 v4.0.0 时失败,但可以使用 v4.3.0,因为我们正在处理新的 .Net Standard 2.0 包。在我们的构建服务器上,我能够将NuGet.exe update -self在C:\Builds\_work\_tool\NuGet\4.0.0\x64\nuget.exe4.0.0 中找到的 NuGet.exe 更新到 4.3.0,但该C:\Builds\_work\_tool目录会定期被删除和重新创建,因此这不是一个持久的解决方法。
如何让我们的构建代理始终使用最新版本的 NuGet.exe,或者至少是 v4.3.0?
tfs nuget nuget-package-restore azure-devops azure-devops-self-hosted-agent
最近,我们在安装了VSTS构建代理的构建代理(运行Windows 2016的两台单独安装的计算机)上遇到了一个烦人的问题。当我们运行del "\\?\%CD%\nul" (请参阅超级用户)时,它会运行几个版本,然后再次出现。
如何以及为什么创建该文件,以及如何确保构建代理不会中断?
下面的堆栈跟踪:
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 …Run Code Online (Sandbox Code Playgroud) build build-agent nul azure-devops azure-devops-self-hosted-agent
我在 AzureDevOps 中有多个项目存储库,我在我们的构建服务器中创建了一个自托管代理。我已经为几个存储库定义了 CICD 管道,并且使用自托管代理可以正常工作。
但是,当我尝试为 AzureDevOps 中的新存储库设置 CICD 管道时,自托管代理未显示在此新存储库的代理池下拉列表下。
continuous-integration agent continuous-deployment azure-devops azure-devops-self-hosted-agent
我已经为 Linux 上的 Azure DevOps 安装并以交互方式运行了一个私有构建代理。
但是,当尝试按照文档设置为服务时,它无法运行。它通常会成功完成安装。但是,启动服务总是会返回错误。
配置:运行 Ubuntu 18.04LTS 的新 VM,使用 AAD 和 JIT 进行保护,使用 VM 管理员权限登录。
错误:
$ sudo ./svc.sh install
Creating launch agent in /etc/systemd/system/vsts.agent.xxx.linux-agent-01.service
Run as user: xxx@microsoft.com
Run as uid: 1613914
gid: 1613914
$ sudo ./svc.sh start
Failed to start vsts.agent.xxx.linux-agent-01.service: Unit vsts.agent.xxx.linux-agent-01.service is not loaded properly: Exec format error.
See system logs and 'systemctl status vsts.agent.xxx.linux-agent-01.service' for details.
Failed: failed to start vsts.agent.xxx.linux-agent-01.service
$
Run Code Online (Sandbox Code Playgroud)
尝试运行时,我得到了这个:
3$ sudo ./svc.sh status
/etc/systemd/system/vsts.agent.edgewebui.LinuxAgent03.service
? vsts.agent.edgewebui.LinuxAgent03.service …Run Code Online (Sandbox Code Playgroud) 我正在使用 Azure DevOps Server (TFS),并且我在我的测试和生产服务器中注册了部署池代理,现在我需要卸载或删除我的服务器和 UI 上的配置,我该怎么做才能运行脚本或只需删除文件或您能帮我做些什么。
tfs azure-devops azure-devops-self-hosted-agent azure-devops-server azure-devops-server-2019
azure-devops ×10
azure-devops-self-hosted-agent ×10
build-agent ×2
tfs ×2
agent ×1
azure ×1
build ×1
gradle ×1
nuget ×1
nul ×1
unit-testing ×1