Implement project pulling from Azure DevOps using Service Principals (#14628)

* Credential Lookup with multiple types
Allow looking up a credential with one of multiple type IDs.

* Allow Azure cred for SCM
Allow selecting an Azure Resource Manager credential for Git-based SCMs.
This is in order to enable using Azure Service Principals for project updates.

* Implement Azure Service Principal Git
This adds support for using an Azure Service Principal for project updates.

---------

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This commit is contained in:
Patrick Uiterwijk
2024-03-07 22:07:03 +07:00
committed by GitHub
parent 727278aaa3
commit 2e2cd7f2de
7 changed files with 49 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ class Project(HasCopy, HasCreate, HasNotifications, UnifiedJobTemplate):
def create_payload(self, name='', description='', scm_type='git', scm_url='', scm_branch='', organization=Organization, credential=None, **kwargs):
if credential:
if isinstance(credential, Credential):
if credential.ds.credential_type.namespace not in ('scm', 'insights'):
if credential.ds.credential_type.namespace not in ('scm', 'insights', 'azure_rm'):
credential = None # ignore incompatible credential from HasCreate dependency injection
elif credential in (Credential,):
credential = (Credential, dict(credential_type=(True, dict(kind='scm'))))