将容器化的自托管代理与 Azure DevOps 连接起来

Connect containerized self-hosted agent with Azure DevOps

我按照 MS 文档中的说明进行操作 guide, and the agent started without any issues. However it never showed up in my agent pool. I tried a different version of the start.sh script found on github,它立即连接上了。我还能做些什么来尝试解决这个问题吗?来自以下非工作代理的日志

❯ kubectl logs azpagent-55864668dc-zgdrn
1. Determining matching Azure Pipelines agent...
2. Downloading and installing Azure Pipelines agent...
3. Configuring Azure Pipelines agent...

>> 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:
  /azp/agent/externals/tee/license.html


>> Connect:

Connecting to server ...

>> Register Agent:

Scanning for tool capabilities.
Connecting to the server.
Successfully replaced the agent
Testing agent connection.
2019-08-03 04:22:56Z: Settings Saved.
4. Running Azure Pipelines agent...
Starting Agent listener interactively
Started listener process
Started running service
Scanning for tool capabilities.
Connecting to the server.
2019-08-03 04:23:08Z: Agent connect error: The signature is not valid.. Retrying until reconnected.

不太确定还可以尝试什么 -- 有没有其他人看到过这个问题,或者使用 linux 代理指南是否成功?

更新

根据错误信息The signature is not valid..

您是否正在使用和构建来自 TFVC 存储库的源代码,该存储库需要接受 Team Explorer Everywhere 最终用户许可协议。从 Git 个存储库构建源不需要此步骤。

如果可以,请尝试从 Git 存储库构建。


您引用的文档是 start.sh 脚本的不同版本,即 deprecated。它适用于旧的构建代理。

根据这个和相关的错误The signature is not valid.. Retrying until reconnected.我有几点建议:

  • 您可能使用的是相当旧的代理版本,请尝试最新版本的代理 https://github.com/microsoft/azure-pipelines-agent/releases
  • 您需要重新启动代理进程才能使这些 环境影响。
  • 请咨询您的 IT 部门,确保您的设备之间的网络 构建机器和 tfs server/Azure DevOps 服务可靠,请参阅 你的网络有没有变化。

还要确保您的构建 machine/VM 不会 运行 资源不足。

查看错误信息:

The signature is not valid.

提供的 PAT 可能有问题。我建议生成一个新的 PAT,如 this guide 所述,然后重试。

如果有帮助,请告诉我。

万一其他人出现此问题或类似问题,@juliobbv 的建议非常有帮助。如果您注释掉脚本的最后一行,并将其替换为

./bin/Agent.Listener run & wait $!

您可以更清楚地查看任何错误消息。

在我的例子中,我没有意识到 AGENT_NAME 和 POOL 不再是同一个变量,并且原始错误消息并未表明问题是我对默认池的权限不足.

我对脚本的最后更改如下 -- 我默认使用主机名作为代理名称,并保持以前使用自定义池的行为

./config.sh --unattended \
  --agent "$(hostname)" \
  --url "$AZP_URL" \
  --auth PAT \
  --token $(cat "$AZP_TOKEN_FILE") \
  --pool "${AZP_POOL:-Default}" \
  --work "${AZP_WORK:-_work}" \
  --replace \
  --acceptTeeEula & wait $!