Azure Pipelines下载CmdLine任务失败:连接被重置问题求助
解决Azure Pipelines本地Agent下载CmdLine任务失败(Connection reset by peer)的问题
问题场景
已配置如下Azure Pipelines:
trigger: branches: include: - pre-prod pool: name: default stages: - stage: build displayName: 'Build stage' jobs: - job: Build displayName: 'Build' steps: - script: echo Build starting - script: | docker-compose -f docker-compose.yml build displayName: 'Build Docker images'
Ubuntu服务器上已安装并注册Azure Agent,能正常连接服务器,但任务初始化阶段下载CmdLine任务时反复报错:
##[warning]Failed to download task 'CmdLine'. Error Unable to read data from the transport connection: Connection reset by peer. ##[warning]Inner Exception: Connection reset by peer ##[warning]Back off 21.485 seconds before retry. ##[warning]Failed to download task 'CmdLine'. Error Unable to read data from the transport connection: Connection reset by peer. ##[warning]Inner Exception: Connection reset by peer ##[warning]Back off 27.578 seconds before retry. ##[warning]Failed to download task 'CmdLine'. Error Unable to read data from the transport connection: Connection reset by peer. ##[warning]Inner Exception: Connection reset by peer ##[error]Unable to read data from the transport connection: Connection reset by peer.
机器处于网络受限环境,修改DNS未解决问题,以下是可行解决方法:
解决方法
手动部署CmdLine任务包
- 在能正常访问Azure DevOps的设备上,获取CmdLine任务的离线zip包(对应Agent兼容的稳定版本)
- 将zip包传到Ubuntu Agent安装目录下的
_work/_tasks文件夹(无此目录则手动创建) - 解压zip包,文件夹命名遵循
CmdLine_<任务ID>格式(任务ID可从Azure DevOps任务市场页面或错误日志关联信息中获取) - 执行
./run.sh restart重启Agent,重新触发Pipeline任务
配置Agent使用代理服务器
- 进入Ubuntu机器上的Azure Agent安装目录,修改
config.sh文件 - 添加代理环境变量配置:
export http_proxy="http://你的代理IP:端口" export https_proxy="http://你的代理IP:端口" export no_proxy="localhost,127.0.0.1,你的Azure DevOps域名" - 执行
./run.sh restart重启Agent,确保代理配置生效后重试任务
- 进入Ubuntu机器上的Azure Agent安装目录,修改
离线安装包含任务的Agent
- 在可联网机器上,下载Azure Agent时添加
--include-tasks参数,指定包含CmdLine任务,生成完整离线包 - 将整个Agent目录打包上传到Ubuntu机器并解压
- 在Ubuntu机器上执行
./config.sh完成Agent注册(无需联网) - 启动Agent,CmdLine任务已预加载在本地,无需在线下载
- 在可联网机器上,下载Azure Agent时添加
检查网络策略与防火墙
- 确认Ubuntu机器防火墙允许出站访问Azure DevOps相关域名(如
dev.azure.com、vsblob.dev.azure.com) - 联系网络管理员开放443端口的出站权限,确保Agent能访问Azure任务存储节点
- 确认Ubuntu机器防火墙允许出站访问Azure DevOps相关域名(如
内容的提问来源于stack exchange,提问作者reza jafari
相关产品推荐
相关产品推荐

