首页 > 解决方案 > Kustomize Azure Devops 文件夹结构

问题描述

我正在尝试构建跨越多个 Azure Devops git 存储库的 kustomize 对象层次结构。我有许多微服务,它们的配置可以压缩成少量的基本 yaml 文件。我希望每个微服务存储库都有自己的 yaml 文件,这些文件在应用程序更新时对其进行版本控制。

我知道 kustomize 使用 go-getter (hashicorp) 来提取资源,如果它们被赋予一个 git url 的基础。但是,我无法弄清楚与 Azure Devops Git 一起使用的正确语法来拉下一个包含 kustomize 文件的子文件夹。问题不在于身份验证,而在于 Azure devops 喜欢路径子文件夹的方式。它喜欢使它们成为 url 变量而不是在路径中。

以下是我尝试过的一些示例:

go-getter https://<pat-user>:<pat-token>@<tenant>.visualstudio.com/<project>/_git/<repo>/tree/master/base//<folder-i-want> .
go-getter https://<pat-user>:<pat-token>@dev.azure.com/<tenant>/<project>/_git/<repo>/trees/master/base//<folder-i-want> .
go-getter https://<pat-user>:<pat-token>@dev.azure.com/<tenant>/<project>/_git/<repo>/base//<folder-i-want>?version=test-tag .

所有结果都来自 Azure Devops 的 404。

我相信我需要知道在 Azure Devops 中引用子文件夹的正常“git”方式。

标签: azure-devopskustomize

解决方案


正如我在评论中指出的那样,我不得不以不同的方式思考它。一开始只得把子文件夹往下几个层次。此外,需要强制 go-getter 知道它应该在这个 azure devops url 上使用 git。

这个赢了。

git::https://<tenant>.visualstudio.com/<project>/_git/<repo>//<first subfolder>/<folder I want>

推荐阅读