运行 以前工作的 TFS Mac Build Agent 时如何修复 'Crypto' 异常?
How to fix 'Crypto' exception when running previously working TFS Mac Build Agent?
我的 Mac 主机上的 TFS 构建代理一直在工作,直到我最近升级 Visual Studio 并使用自制软件安装了 PowerShell 6.2.3。 Visual Studio Enterprise 的版本现在是 8.4(Build 2535)。
根据 Visual Studio 升级要求,在我重新启动 Mac 主机之前,构建代理是 运行。我第一次尝试在命令行上使用 . run.sh
再次启动代理时,它不再起作用。我们试图在另一台 Mac 主机上安装具有最新版本的新代理,但遇到了类似的问题。有重大变化吗?
我已尝试按照以下链接中的建议修复 openssl:https://github.com/microsoft/azure-pipelines-agent/issues/232
我已经用 brew cask uninstall powershell
删除了 powershell
执行了所有这些步骤后,代理仍不会启动。
我在构建代理的 _diag 目录中找到了日志。好像加载RSA命令时出现异常:
[2020-01-09 01:01:15Z INFO CredentialManager] Creating type OAuth
[2020-01-09 01:01:15Z INFO CredentialManager] Creating credential
type: OAuth
[2020-01-09 01:01:15Z INFO RSAFileKeyManager] Loading RSA key parameters from file
/Users/Shared/tfsbuildagent/.credentials_rsaparams [2020-01-09
01:01:15Z ERR Terminal] WRITE ERROR: An error occurred: The type
initializer for 'Crypto' threw an exception. [2020-01-09 01:01:15Z
ERR AgentProcess] System.TypeInitializationException: The type
initializer for 'Crypto' threw an exception. --->
System.TypeInitializationException: The type initializer for
'CryptoInitializer' threw an exception. --->
System.DllNotFoundException: Unable to load DLL
'System.Security.Cryptography.Native.OpenSsl': The specified module
could not be found. (Exception from HRESULT: 0x8007007E) at
Interop.CryptoInitializer.EnsureOpenSslInitialized() at
Interop.CryptoInitializer..cctor() --- End of inner exception stack
trace --- at Interop.CryptoInitializer.Initialize() at
Interop.Crypto..cctor() --- End of inner exception stack trace ---
at Interop.Crypto.RsaCreate() at
System.Security.Cryptography.RSAImplementation.RSAOpenSsl.ImportParameters(RSAParameters
parameters) at
Microsoft.VisualStudio.Services.Agent.Listener.Configuration.RSAFileKeyManager.GetKey()
at
Microsoft.VisualStudio.Services.WebApi.VssSigningCredentials.Create(Func`1
factory) at
Microsoft.VisualStudio.Services.Agent.Listener.Configuration.OAuthCredential.GetVssCredentials(IHostContext
context) at
Microsoft.VisualStudio.Services.Agent.Listener.MessageListener.d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.VisualStudio.Services.Agent.Listener.Agent.d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.VisualStudio.Services.Agent.Listener.Agent.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.VisualStudio.Services.Agent.Listener.Program.d__1.MoveNext()
我们的本地 TFS 没有 OSX 的最新代理二进制文件,它使用最新的 Mac 安全性而不是使用 OpenSSL。新二进制文件可在 github 获得。所以我从那里下载而不是从我的 TFS 服务器下载。
我的 Mac 主机上的 TFS 构建代理一直在工作,直到我最近升级 Visual Studio 并使用自制软件安装了 PowerShell 6.2.3。 Visual Studio Enterprise 的版本现在是 8.4(Build 2535)。
根据 Visual Studio 升级要求,在我重新启动 Mac 主机之前,构建代理是 运行。我第一次尝试在命令行上使用 . run.sh
再次启动代理时,它不再起作用。我们试图在另一台 Mac 主机上安装具有最新版本的新代理,但遇到了类似的问题。有重大变化吗?
我已尝试按照以下链接中的建议修复 openssl:https://github.com/microsoft/azure-pipelines-agent/issues/232
我已经用 brew cask uninstall powershell
执行了所有这些步骤后,代理仍不会启动。
我在构建代理的 _diag 目录中找到了日志。好像加载RSA命令时出现异常:
[2020-01-09 01:01:15Z INFO CredentialManager] Creating type OAuth [2020-01-09 01:01:15Z INFO CredentialManager] Creating credential type: OAuth [2020-01-09 01:01:15Z INFO RSAFileKeyManager] Loading RSA key parameters from file /Users/Shared/tfsbuildagent/.credentials_rsaparams [2020-01-09 01:01:15Z ERR Terminal] WRITE ERROR: An error occurred: The type initializer for 'Crypto' threw an exception. [2020-01-09 01:01:15Z ERR AgentProcess] System.TypeInitializationException: The type initializer for 'Crypto' threw an exception. ---> System.TypeInitializationException: The type initializer for 'CryptoInitializer' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'System.Security.Cryptography.Native.OpenSsl': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at Interop.CryptoInitializer.EnsureOpenSslInitialized() at Interop.CryptoInitializer..cctor() --- End of inner exception stack trace --- at Interop.CryptoInitializer.Initialize() at Interop.Crypto..cctor() --- End of inner exception stack trace --- at Interop.Crypto.RsaCreate() at System.Security.Cryptography.RSAImplementation.RSAOpenSsl.ImportParameters(RSAParameters parameters) at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.RSAFileKeyManager.GetKey() at Microsoft.VisualStudio.Services.WebApi.VssSigningCredentials.Create(Func`1 factory) at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.OAuthCredential.GetVssCredentials(IHostContext context) at Microsoft.VisualStudio.Services.Agent.Listener.MessageListener.d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Listener.Agent.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Listener.Agent.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Services.Agent.Listener.Program.d__1.MoveNext()
我们的本地 TFS 没有 OSX 的最新代理二进制文件,它使用最新的 Mac 安全性而不是使用 OpenSSL。新二进制文件可在 github 获得。所以我从那里下载而不是从我的 TFS 服务器下载。