Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]: Get sources - provide a global flag for persistCredentials #5120

Open
dylan8902 opened this issue Feb 14, 2025 · 0 comments
Open

Comments

@dylan8902
Copy link

Describe your feature request here

Use Case

Private terraform modules hosted on GitHub (or any other git provider). You need to authenticate, but the credentials are only persisted to the local repo config, not 'globally'. When running terraform init, the credentials are not provided and you are not authenticated.

Common workarounds in place today include:

  • getting and managing a Personal Access Token and setting the global config with a script task:
git config --global url."https://token:[email protected]".insteadOf https://github.com
  • copying the credentials from the repo gitconfig into the global config:
tail -n 2 $(Pipeline.Workspace)/s/terraform-modules.my-favourite-module/.git/config >> ~/.gitconfig

Proposed Solution

New configuration for 'Get Sources' to persist credentials globally - persistCredentialsGlobally: true | false (Default: false)

Implementation Detail

New method in https://github.com/microsoft/azure-pipelines-agent/blob/master/src/Agent.Plugins/GitCliManager.cs like GitConfig but GitGlobalConfig that just adds the flag --global to the command args

Added logic in https://github.com/microsoft/azure-pipelines-agent/blob/master/src/Agent.Plugins/GitSourceProvider.cs to support calling that method instead when global flag is true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant