【发布时间】:2019-09-15 19:22:36
【问题描述】:
我正在尝试使用 Google Cloud Build 来构建我的 Java 应用。它允许使用所谓的云构建器——不同构建器的 docker 镜像。我正在使用 Maven。所以问题是我必须使用私有存储库(工件)来部署工件。此代表受密码保护,我不知道如何将这些凭据传递给 GC maven docker 容器。
我看到唯一可能的方法是:
-
运行 shell 脚本,该脚本将更新 maven 容器 settings.xml,如下所示:
<servers> <server> <id>myRepoName</id> <username>${server.username}</username> <password>${server.password}</password> </server> </servers> 在 cloudbuild.yml 中设置环境变量
还有其他优雅的方法来实现我想要的吗?
【问题讨论】:
-
据我所知,您的存储库需要使用 SSH 密钥进行访问控制。这是 GitHub 私有存储库的示例。 cloud.google.com/cloud-build/docs/access-private-github-repos
-
@JohnHanley 我认为 OP 是在询问 Maven 存储库而不是 github 中的 git 存储库。
-
@KarthikeyanVaithilingam - OP 正在询问 Cloud Build。我的链接是访问私有存储库的示例。
-
@JohnHanley 您的链接提供了访问 github 私有存储库的示例,但 OP 需要访问私有 Artifactory 存储库。
-
你也可以看看this。
标签: maven docker google-cloud-platform google-cloud-build docker-maven-plugin