Azure / acr-builder

Azure Container Registry Build Runner
MIT License
38 stars 35 forks source link

Failed to download submodule in private git repo #538

Closed northtyphoon closed 4 years ago

northtyphoon commented 4 years ago

Describe the bug

If the git repo has submodule which is in private git repo, acb download fails error 'error initializing submodules:...'

Looks like the reason is https://github.com/Azure/acr-builder/blob/master/scan/git.go#L99 is unable to use the credential from master repo. One solution is to enable https://git-scm.com/docs/git-credential-cache.

xkszltl commented 4 years ago

Sounds like the right solution and should be enough to resolve our issue!

However, in a more complex scenario, if the submodule uses a different cred, this will also fail. So should we also add options to

northtyphoon commented 4 years ago

@xkszltl, thanks for the suggestion. We don't plan to support modules using different cred now. The PAT (Git or VSTS) token we support is able to work for multiple repositories and projects.

xkszltl commented 4 years ago

I see. FYI although we are not facing the multi-cred issue currently, we do have cross-vsts-org projects.

northtyphoon commented 4 years ago

You can choose what org your want to use the PAT https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops