proxy - 下载工件失败忽略 http_proxy
问题描述
我们看到 Azure Release Pipelines 无法在某个服务器上下载工件 - 大约 2 分钟后超时,我们怀疑这是代理问题,即代理没有使用它配置为使用的代理。
当我们禁用/绕过工件下载并让代理运行 curl 命令时,我们看到它在访问 HTTPS URL 时也会超时,但 HTTP URL 很好。curl https://curl.haxx.se
所以我们可以用例如重现这个问题。直接在服务器上运行此命令(作为 root 或任何用户)工作正常,因此这是一个代理问题。
当我们告诉代理export https_proxy=<our proxy>
(注意 http S)然后是 CURL 时,对 HTTPS 的调用成功。这意味着 CURL 知道我们的HTTP_PROXY
但不知道HTTPS_PROXY
,并且 curl 似乎忽略HTTP_PROXY
了 HTTPS 域。我们怀疑代理通过/设置 HTTP_PROXY 但不是 HTTP_PROXY!
问题是我们无法export
在工件下载之前运行命令,因为这始终是部署组中的第一步,然后才能执行任何脚本。
除了我们在export http_proxy
其中export https_proxy
正确定义的事实之外/etc/environment
,天蓝色管道在尝试下载工件时似乎不知道代理。我们的.proxy
文件包含代理http://proxy.ourlandomain:3333
,它在代理日志中显示为:
Agent is running behind proxy server: 'http://proxy.ourlandomain.com:3333'
……然后后来……
[AGENT_PROXYURL] --> [http://proxy.ourlandomain.com:***@ourdomain.com]
它看起来有点乱码。3333
它是作为一个秘密隐藏起来的吗?这***
是@ourdomain.com
从哪里来的???
最后,代理以 root 身份运行,当我们以 root 身份 curl HTTPS URL 时,它工作正常。
为什么代理不使用代理或为什么工件下载失败?
2020-07-06T13:15:26.6383041Z ##[debug]Evaluating condition for step: 'Download artifact - Test1Artifact - Test1Linux'
2020-07-06T13:15:26.6423849Z ##[debug]Evaluating: succeeded()
2020-07-06T13:15:26.6429537Z ##[debug]Evaluating succeeded:
2020-07-06T13:15:26.6469145Z ##[debug]=> True
2020-07-06T13:15:26.6477846Z ##[debug]Result: True
2020-07-06T13:15:26.6517309Z ##[section]Starting: Download artifact - Test1Artifact - Test1Linux
2020-07-06T13:15:26.6717563Z ==============================================================================
2020-07-06T13:15:26.6718055Z Task : Download pipeline artifact
2020-07-06T13:15:26.6718463Z Description : Download a named artifact from a pipeline to a local path
2020-07-06T13:15:26.6718700Z Version : 1.2.5
2020-07-06T13:15:26.6719046Z Author : Microsoft Corporation
2020-07-06T13:15:26.6719901Z Help : Download a named artifact from a pipeline to a local path
2020-07-06T13:15:26.6720216Z ==============================================================================
2020-07-06T13:15:26.9979976Z Download from the specified build: #81654
2020-07-06T13:15:26.9980651Z Download artifact to: /prg/azure/deploy2/_work/r1/a/Test1Artifact/Test1Linux
2020-07-06T13:15:30.3332655Z ##[debug]Dedup parallelism: 192
2020-07-06T13:17:10.3457179Z ##[error]One or more errors occurred. (A task was canceled.)
2020-07-06T13:17:10.3471565Z ##[debug]Processed: ##vso[task.logissue type=error;]One or more errors occurred. (A task was canceled.)
2020-07-06T13:17:10.3485598Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2020-07-06T13:17:10.3510288Z ##[debug] at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreApplicationInsightsTelemetrySender..ctor(IAppTraceSource tracer, Uri baseAddress)
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreClientTelemetry..ctor(IAppTraceSource tracer, Uri baseAddress)
at Agent.Plugins.PipelineArtifact.DedupManifestArtifactClientFactory.CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, CancellationToken cancellationToken, BlobStoreClientTelemetry& telemetry)
at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.DownloadAsync(AgentTaskPluginExecutionContext context, PipelineArtifactDownloadParameters downloadParameters, DownloadOptions downloadOptions, CancellationToken cancellationToken)
at Agent.Plugins.PipelineArtifact.DownloadPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
2020-07-06T13:17:10.3588657Z ##[section]Finishing: Download artifact - Test1Artifact - Test1Linux
更新:Environment=https_proxy=http://proxy.ourlandomain.com:3333
在代理的 systemd 配置中设置解决了问题并下载了工件。似乎下载工件任务不尊重http_proxy
或代理应该并且没有设置https_proxy
。
解决方案
下载工件失败忽略 http_proxy
根据文档Run a self-hosted agent behind a web proxy:
当您的自托管代理需要 Web 代理时,您可以在配置期间通知代理有关代理的信息。这允许您的代理通过代理连接到 Azure Pipelines 或 TFS。这反过来又允许代理获取资源并下载工件。
因此,您可以参考上述文档并配置代理权限以再次检查。
此外,作为解决方法,我们可以禁用默认的内置工件下载任务:
然后,我们可以运行export
命令并使用任务下载构建工件来下载工件。
希望这可以帮助。
推荐阅读
- javascript - 如何获取价格范围滑块的值并将它们写入 php 变量?
- python - Django 正则表达式字段查找 - 按查询集中每个项目的匹配数排序
- windowsiot - Windows IoT 中的凭据管理器
- video-capture - Camstudio 仍然是一个活跃的项目吗?
- php - 检查版本字符串是否更新的函数(例如 1.2.5 > 1.1.10)
- python - 在 Python 3.6 中使用 json 加载会产生“ascii 编解码器无法编码字符”错误
- ruby-on-rails-3 - Select2 I18n 占位符导轨
- docker - 在ups中使用docker部署生产服务器是个好主意吗?
- node.js - 将多个 Nodejs 应用程序配置到 nginx conf
- ruby-on-rails - 如何将类添加到 Rails 中的 simple_form 输入包装器?