1

I am attempting to build a hierarchy of kustomize objects that span multiple Azure Devops git repositories. I have a number of microservices whose configurations can be condensed into a small number of base yaml files. I'd like to have each microservice repo have it's own yaml files that are versioned with it as the application is updated.

I know that kustomize uses go-getter (hashicorp) to pull resources if they are given a base of a git url. However, I cannot figure out the correct syntax to use with Azure Devops Git to pull down a subfolder with a kustomize file in it. The problem is not with authentication, but in the way Azure devops likes to path the subfolders. It likes to make them a url variable instead of being in the path.

Here are some examples I've tried:

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 .

All result in a 404 from Azure Devops.

I believe that I need to know the normal "git" way of referencing a subfolder in Azure Devops.

torek
  • 448,244
  • 59
  • 642
  • 775
Robert Smith
  • 385
  • 4
  • 15
  • 1
    Git does not have a way to refer to subfolders (or files within repositories). ADO might, but it won't be a "normal git way" since Git doesn't have a way. Sites like GitHub and Bitbucket have their own ways... – torek Aug 24 '21 at 07:58
  • @torek You're absolutely right. Another read through of the go-getter documentation gave me the answer. I had to think of it in absolute terms for the git repo, then use the go-getter syntax for the folder I wanted. – Robert Smith Aug 24 '21 at 12:08

1 Answers1

0

As noted in my comment, I had to think of it a different way. Had to subfolder at the beginning to several levels down. Also, needed to force go-getter to know that it should use git on this azure devops url.

This one wins.

git::https://<tenant>.visualstudio.com/<project>/_git/<repo>//<first subfolder>/<folder I want>
Robert Smith
  • 385
  • 4
  • 15