【问题标题】:How to integrate Jenkins with Azure repo如何将 Jenkins 与 Azure 存储库集成
【发布时间】:2021-06-04 14:30:40
【问题描述】:

我们正在尝试使用 Jenkins 设置 CICD 管道。目前它在 Azure DevOps 中。我们的代码位于 Azure 存储库 (GIT) 中。我们已将 Jenkins 安装到本地 Windows 服务器上。

我们试图通过一个虚拟作业从 Azure 存储库中签出代码。我们的 ID 有权查看和克隆 repo。当我在本地运行 git clone <azure repo url http(not https)> 时,我可以下载该软件包。但是,当我在 SCM 中使用 GIT 作为选项以及我们的凭据进行配置时,它会引发身份验证错误。

我什至尝试创建个人访问令牌并对其进行配置以查看它是否有效。

通过 http repo url。

Failed to connect to repository : Command "git.exe ls-remote -h -- http://**************************** HEAD" returned status code 128:
stdout:
stderr: fatal: Authentication failed for '***************************'

我尝试生成 ssh 密钥并将公钥推送到安全选项卡“SSH 公钥”下的 azure repo。还是一样。

通过 ssh repo 网址:

Failed to connect to repository : Command "git.exe ls-remote -h -- ssh://**********:22/******************* HEAD" returned status code 128:
stdout:
stderr: Unable to negotiate with *********** port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
fatal: Could not read from remote repository.

我可以从 jenkins box ping 到 repo url。

如果 repo 是 TFS,我会尝试 TFS 插件来验证 repo。但它位于 GIT Azure 存储库中。

让我们知道是否需要在 Azure DevOps 端启用任何特定设置才能完成这项工作。

Azure 服务挂钩是否有任何影响?这就像普通的 webhook 对吗?以防万一在 repo 上发生任何操作,我们需要基于此执行操作。我们是否也需要将钩子配置为具有对 repo 的读取权限?

请帮助我解决方案或解决方法。

【问题讨论】:

  • 您使用的确切结构 URL 是什么?请提供匿名版本,例如 https://user@dev.azure.com/user/project/_git/repo... 根据经验,Azure DevOps 使用一种特殊格式。使用从 UI 获取的克隆 URL 重试。

标签: git jenkins ssh azure-devops azure-devops-server-2019


【解决方案1】:

关注Azure DevOps Authentication overview,我会:

  • 生成 PAT(个人访问令牌,尽管它们确实有过期日期)

  • 检查存储库是否可访问(使用 https,而不是 http):

       git ls-remote https://<me>:<myPAT>@dev.azure.com/<me>/<myProject>/_git/<myrepo>
    
  • my Jenkins credentials注册令牌

  • 使用带有注册凭据的 https URL:https://dev.azure.com///_git/。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-23
    • 2015-11-09
    • 2011-10-02
    • 2021-09-08
    • 2019-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多