【问题标题】:Azure Devops CI pipeline unable to connect to a private repo to fetch a dependency to build an artifactAzure Devops CI 管道无法连接到私有存储库以获取依赖项以构建工件
【发布时间】:2020-08-26 14:07:14
【问题描述】:

Maven 构建任务 -> 私有存储库中的依赖项很少。 在运行 CI 管道时,它无法连接到该私有仓库。下载依赖项并继续。

  1. 是否与需要创建的防火墙或服务连接有关。
  2. 我们能否将这些依赖项放在 azure artifact 中,并在 cuild 时从中提供 CI 管道。请为此提供示例代码。

【问题讨论】:

  • 嗨,您有机会查看以下解决方案吗?进展如何?

标签: azure-devops continuous-integration repository azure-pipelines build-dependencies


【解决方案1】:

如果私有 maven 存储库托管在本地服务器上。您需要在可以访问私有存储库的本地计算机上create a self-hosted agent

并且您需要在您的 azure devops 项目中创建一个maven service connection项目设置s-->服务连接管道下- ->新新服务连接-->选择Maven)。

然后您需要在您的自托管代理上运行您的管道(选择您的自托管代理所在的代理池),因为微软托管的代理无法访问托管在您本地服务器上的私有存储库。并添加 Maven Authenticate task 以在构建期间验证您的私有存储库。在Credentials for repositories outside this organization/collection字段中选择上面步骤中创建的maven服务连接(也可以在yaml格式管道中mavenServiceConnections


您还可以将这些依赖项放在 azure artifact feed 中。请检查此quick start 以在您的 azure devops 中创建一个 Maven 提要,并检查publish 您对它的依赖项。并按照 set up your project 的说明将 repo 添加到您的 pom.xml 文件中。

然后您需要在您的Maven task 中将mavenFeedAuthenticate 参数设置为true。 (在经典 UI 任务的 Advanced 设置中)。现在,您应该能够下载发布到管道中 azure 工件源的依赖项了。

不过,另一种验证供稿的方法是使用Maven Authenticate task。见下文:选择您的 Maven 提要以在管道中进行身份验证。

如果您想在当前组织之外使用 Maven 存储库。您需要按照上述步骤为此存储库创建 Maven 服务连接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    • 1970-01-01
    • 2021-02-26
    • 2016-03-18
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    相关资源
    最近更新 更多