为 Azure DevOps 服务器安装自托管 Linux 代理

时间:2021-03-08 09:52:56

标签: linux azure-devops azure-devops-server-2019 azure-devops-self-hosted-agent azure-devops-pipelines

您好云工程师,

我正在尝试在 azure 中创建一个自托管代理,以通过构建和发布管道运行。 当我将 linux VM 配置为代理时,出现以下错误。

--------OS Information--------
NAME="SLES"
VERSION="15-SP2"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP2"

  ___                      ______ _            _ _
 / _ \                     | ___ (_)          | (_)
/ /_\ \_____   _ _ __ ___  | |_/ /_ _ __   ___| |_ _ __   ___  ___
|  _  |_  / | | | '__/ _ \ |  __/| | '_ \ / _ \ | | '_ \ / _ \/ __|
| | | |/ /| |_| | | |  __/ | |   | | |_) |  __/ | | | | |  __/\__ \
\_| |_/___|\__,_|_|  \___| \_|   |_| .__/ \___|_|_|_| |_|\___||___/
                                   | |
        agent v2.183.1             |_|          (commit b8617e6)


>> End User License Agreements:

Building sources from a TFVC repository requires accepting the Team Explorer Everywhere End User License Agreement. This step is not required for building sources from Git repositories.

A copy of the Team Explorer Everywhere license agreement can be found at:
  /home/selfhosted-linuxagent/externals/tee/license.html

Enter (Y/N) Accept the Team Explorer Everywhere license agreement now? (press enter for N) > y

>> Connect:

Enter server URL > https://hello.world.com/
Enter authentication type (press enter for PAT) >
Enter personal access token > *****************
Error reported in diagnostic logs. Please examine the log for more details.
    - /home/selfhosted-linuxagent/_diag/Agent_20210308-094413-utc.log
The SSL connection could not be established, see inner exception.
Failed to connect.  Try again or ctrl-c to quit
Enter server URL >

1 个答案:

答案 0 :(得分:0)

该错误可能表明您在 TFS 服务器上使用的服务器证书不受构建计算机的信任。确保将自签名 ssl 服务器证书安装到操作系统证书存储中。

Windows: Windows certificate store
Linux: OpenSSL certificate store
macOS: OpenSSL certificate store for agent version 2.124.0 or below
       Keychain for agent version 2.125.0 or above

您可以通过运行几个命令轻松验证证书是否已正确安装。只要 SSL 握手正确完成,即使您收到 401 请求,您也应该没事。

Windows: PowerShell Invoke-WebRequest -Uri https://corp.tfs.com/tfs -UseDefaultCredentials 
Linux: curl -v https://corp.tfs.com/tfs 
macOS: curl -v https://corp.tfs.com/tfs (agent version 2.124.0 or below, curl needs to be built for OpenSSL)
       curl -v https://corp.tfs.com/tfs (agent version 2.125.0 or above, curl needs to be built for Secure Transport)

查看以下文档了解更多详情:

https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/certificate?view=azure-devops-2020