You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure DevOps中使用JFrog NuGet推送包时遇域名解析错误

问题:Azure DevOps中JFrog NuGet任务推送包时出现DNS解析失败错误

在Azure DevOps中使用JFrog CLI V2,通过JFrogNuGet任务推送NuGet包到Artifactory仓库,任务配置如下:

- task: JFrogNuGet@1
  inputs:
    command: 'push'
    artifactoryConnection: 'JFrog Trial'
    targetDeployRepo: 'MYREPO'
    targetDeployPath: '/'
    pathToNupkg: '$(Build.ArtifactStagingDirectory)/*.nupkg'

执行后收到错误信息:

15:33:51 [Warn] (Attempt 1) - Failure occurred while sending GET request to https://artifactory.ORG.com/artifactory/api/security/encryptedPassword: Get "https://artifactory.ORG.com/artifactory/api/security/encryptedPassword": dial tcp: lookup artifactory.ORG.com on 127.0.0.53:53: no such host
15:33:51 [Info] executor timeout after 0 attempts with 0 milliseconds wait intervals
15:33:51 [Error] The following error was received while trying to encrypt your password: Get "https://artifactory.ORG.com/artifactory/api/security/encryptedPassword": dial tcp: lookup artifactory.ORG.com on 127.0.0.53:53: no such host
##[error]Error occurred while executing task: Error: Command failed: /opt/hostedtoolcache/jf/2.56.1/x64/jf c add "Antifactory-Test_20240624.3_nuget_deployer_1719243231436" --artifactory-url="https://artifactory.ORG.com/artifactory" --interactive=false --user='***' --basic-auth-only --password-stdin

补充信息:

  • 无服务连接的user和password参数权限,无法使用常规账号密码配置方案
  • 曾尝试在NuGet任务前添加JfrogCliV2配置任务,但错误依旧:
- task: JfrogCliV2@1
   inputs:
     jfrogPlatformConnection: 'My-Connection'
     command: 'jf config add artifactory-server --artifactory-url="https://ORG.hiscox.com"'
解决思路

核心问题定位

错误提示dial tcp: lookup artifactory.ORG.com on 127.0.0.53:53: no such host说明Azure DevOps代理服务器无法解析Artifactory的域名,属于DNS层面的问题,而非JFrog CLI的配置错误。

可行解决方案

1. 验证域名可访问性

  • 联系运维团队确认:
    • artifactory.ORG.com域名是否已正确配置DNS解析
    • Azure DevOps代理所在网络是否允许访问该域名(企业内网可能需要添加白名单或配置VPN)
  • 若使用自托管代理,直接在代理机器上执行nslookup artifactory.ORG.com或ping artifactory.ORG.com,确认域名能否解析到正确IP

2. 修正Artifactory URL配置

检查服务连接JFrog Trial中的Artifactory URL是否正确:

  • 错误信息中显示的URL是https://artifactory.ORG.com/artifactory,但手动配置时用的是https://ORG.hiscox.com,两者域名不一致,需统一为官方正确域名
  • 若无服务连接修改权限,提交工单给运维或服务连接管理员更新URL

3. 跳过密码加密(临时测试方案)

若DNS问题暂时无法解决,可尝试在JFrog CLI配置中跳过密码加密步骤:
在JFrogNuGet任务前添加CLI配置任务,加上--disable-password-encryption参数:

- task: JfrogCliV2@1
  inputs:
    jfrogPlatformConnection: 'JFrog Trial'
    command: 'jf config add artifactory-server --artifactory-url="https://artifactory.ORG.com/artifactory" --disable-password-encryption'

注意:此方案会明文存储密码,仅适合临时测试,不建议生产环境使用

4. 使用IP地址替代域名(临时方案)

若域名解析始终失败,可直接使用Artifactory服务器的公网/内网IP替代域名:
例如将URL改为https://x.x.x.x/artifactory(x.x.x.x为服务器实际IP),更新服务连接或CLI配置后重试

内容的提问来源于stack exchange,提问作者imran chowdhury

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 23:43:13