cicd
network_error
ai_generated
true
错误:检出失败:无法解析主机名 github.com:名称或服务未知
ERROR: Checkout failed: Could not resolve hostname github.com: Name or service not known
ID: cicd/jenkins-pipeline-checkout-failed
85%修复率
88%置信度
1证据数
2024-01-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Jenkins 2.440 | active | — | — | — |
| Git plugin 5.2.0 | active | — | — | — |
| Alpine Linux 3.18 | active | — | — | — |
根因分析
Jenkins 流水线因 DNS 解析失败、网络配置错误或构建环境中的代理问题而无法解析 Git 主机名。
English
Jenkins pipeline failed to resolve the Git hostname due to DNS resolution failure, network misconfiguration, or proxy issues in the build environment.
官方文档
https://www.jenkins.io/doc/book/pipeline/scm/解决方案
-
Configure DNS servers explicitly in the Jenkins agent's /etc/resolv.conf or set the DNS in Docker if using containers: echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
-
If behind a proxy, set the proxy environment variables in the Jenkins node configuration: export http_proxy=http://proxy:8080; export https_proxy=http://proxy:8080
无效尝试
常见但无效的做法:
-
50% 失败
Restarting Jenkins only restarts the master; it doesn't fix DNS resolution in build agents unless they are restarted separately.
-
60% 失败
Pinging github.com from the master doesn't guarantee the agent can resolve it; agents may have different DNS settings.