mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Revert "Implement project pulling from Azure DevOps using Service Pri… (#14977)
Revert "Implement project pulling from Azure DevOps using Service Principals (#14628)" This reverts commit 2e2cd7f2de52a02a7bbf343f26bf8d0177dcdec3.
This commit is contained in:
parent
ee9eac15dc
commit
b076cb00a9
@ -160,8 +160,8 @@ class ProjectOptions(models.Model):
|
|||||||
if self.scm_type == 'insights':
|
if self.scm_type == 'insights':
|
||||||
if cred.kind != 'insights':
|
if cred.kind != 'insights':
|
||||||
raise ValidationError(_("Credential kind must be 'insights'."))
|
raise ValidationError(_("Credential kind must be 'insights'."))
|
||||||
elif cred.kind != 'scm' and cred.kind != 'azure_rm':
|
elif cred.kind != 'scm':
|
||||||
raise ValidationError(_("Credential kind must be 'scm' or 'azure_rm'." % cred.kind))
|
raise ValidationError(_("Credential kind must be 'scm'."))
|
||||||
try:
|
try:
|
||||||
if self.scm_type == 'insights':
|
if self.scm_type == 'insights':
|
||||||
self.scm_url = settings.INSIGHTS_URL_BASE
|
self.scm_url = settings.INSIGHTS_URL_BASE
|
||||||
|
|||||||
@ -1239,9 +1239,6 @@ class RunProjectUpdate(BaseTask):
|
|||||||
|
|
||||||
return scm_url, extra_vars
|
return scm_url, extra_vars
|
||||||
|
|
||||||
def build_credentials_list(self, instance):
|
|
||||||
return [instance.credential]
|
|
||||||
|
|
||||||
def build_inventory(self, instance, private_data_dir):
|
def build_inventory(self, instance, private_data_dir):
|
||||||
return 'localhost,'
|
return 'localhost,'
|
||||||
|
|
||||||
|
|||||||
@ -38,26 +38,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- update_git
|
- update_git
|
||||||
block:
|
block:
|
||||||
- name: Get Azure access token
|
|
||||||
when: "lookup('ansible.builtin.env', 'AZURE_CLIENT_ID') != ''"
|
|
||||||
register: azure_token
|
|
||||||
no_log: True
|
|
||||||
check_mode: false
|
|
||||||
azure.azcollection.azure_rm_accesstoken_info:
|
|
||||||
scopes:
|
|
||||||
# This is the audience for Azure DevOps, as per
|
|
||||||
# https://learn.microsoft.com/en-us/rest/api/azure/devops/tokens/
|
|
||||||
- 499b84ac-1321-427f-aa17-267ca6975798/.default
|
|
||||||
|
|
||||||
- name: Define git environment variables
|
|
||||||
when: "azure_token is not skipped"
|
|
||||||
no_log: True
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
git_environment:
|
|
||||||
GIT_CONFIG_COUNT: 1
|
|
||||||
GIT_CONFIG_KEY_0: http.extraHeader
|
|
||||||
GIT_CONFIG_VALUE_0: "Authorization: Bearer {{ azure_token.access_token }}"
|
|
||||||
|
|
||||||
- name: Update project using git
|
- name: Update project using git
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
dest: "{{ project_path | quote }}"
|
dest: "{{ project_path | quote }}"
|
||||||
@ -67,7 +47,6 @@
|
|||||||
force: "{{ scm_clean }}"
|
force: "{{ scm_clean }}"
|
||||||
track_submodules: "{{ scm_track_submodules | default(omit) }}"
|
track_submodules: "{{ scm_track_submodules | default(omit) }}"
|
||||||
accept_hostkey: "{{ scm_accept_hostkey | default(omit) }}"
|
accept_hostkey: "{{ scm_accept_hostkey | default(omit) }}"
|
||||||
environment: "{{ git_environment | default({}) }}"
|
|
||||||
register: git_result
|
register: git_result
|
||||||
|
|
||||||
- name: Set the git repository version
|
- name: Set the git repository version
|
||||||
|
|||||||
@ -32,7 +32,6 @@ const QS_CONFIG = getQSConfig('credentials', {
|
|||||||
function CredentialLookup({
|
function CredentialLookup({
|
||||||
autoPopulate,
|
autoPopulate,
|
||||||
credentialTypeId,
|
credentialTypeId,
|
||||||
credentialTypeIds,
|
|
||||||
credentialTypeKind,
|
credentialTypeKind,
|
||||||
credentialTypeNamespace,
|
credentialTypeNamespace,
|
||||||
fieldName,
|
fieldName,
|
||||||
@ -62,9 +61,6 @@ function CredentialLookup({
|
|||||||
const typeIdParams = credentialTypeId
|
const typeIdParams = credentialTypeId
|
||||||
? { credential_type: credentialTypeId }
|
? { credential_type: credentialTypeId }
|
||||||
: {};
|
: {};
|
||||||
const typeIdsParams = credentialTypeIds
|
|
||||||
? { credential_type__in: credentialTypeIds.join() }
|
|
||||||
: {};
|
|
||||||
const typeKindParams = credentialTypeKind
|
const typeKindParams = credentialTypeKind
|
||||||
? { credential_type__kind: credentialTypeKind }
|
? { credential_type__kind: credentialTypeKind }
|
||||||
: {};
|
: {};
|
||||||
@ -76,7 +72,6 @@ function CredentialLookup({
|
|||||||
CredentialsAPI.read(
|
CredentialsAPI.read(
|
||||||
mergeParams(params, {
|
mergeParams(params, {
|
||||||
...typeIdParams,
|
...typeIdParams,
|
||||||
...typeIdsParams,
|
|
||||||
...typeKindParams,
|
...typeKindParams,
|
||||||
...typeNamespaceParams,
|
...typeNamespaceParams,
|
||||||
})
|
})
|
||||||
@ -106,7 +101,6 @@ function CredentialLookup({
|
|||||||
autoPopulate,
|
autoPopulate,
|
||||||
autoPopulateLookup,
|
autoPopulateLookup,
|
||||||
credentialTypeId,
|
credentialTypeId,
|
||||||
credentialTypeIds,
|
|
||||||
credentialTypeKind,
|
credentialTypeKind,
|
||||||
credentialTypeNamespace,
|
credentialTypeNamespace,
|
||||||
history.location.search,
|
history.location.search,
|
||||||
|
|||||||
@ -33,11 +33,6 @@ const fetchCredentials = async (credential) => {
|
|||||||
results: [scmCredentialType],
|
results: [scmCredentialType],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
data: {
|
|
||||||
results: [azurermCredentialType],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
data: {
|
data: {
|
||||||
results: [insightsCredentialType],
|
results: [insightsCredentialType],
|
||||||
@ -50,14 +45,13 @@ const fetchCredentials = async (credential) => {
|
|||||||
},
|
},
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
CredentialTypesAPI.read({ kind: 'scm' }),
|
CredentialTypesAPI.read({ kind: 'scm' }),
|
||||||
CredentialTypesAPI.read({ namespace: 'azure_rm' }),
|
|
||||||
CredentialTypesAPI.read({ name: 'Insights' }),
|
CredentialTypesAPI.read({ name: 'Insights' }),
|
||||||
CredentialTypesAPI.read({ kind: 'cryptography' }),
|
CredentialTypesAPI.read({ kind: 'cryptography' }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!credential) {
|
if (!credential) {
|
||||||
return {
|
return {
|
||||||
scm: { typeIds: [scmCredentialType.id, azurermCredentialType.id] },
|
scm: { typeId: scmCredentialType.id },
|
||||||
insights: { typeId: insightsCredentialType.id },
|
insights: { typeId: insightsCredentialType.id },
|
||||||
cryptography: { typeId: cryptographyCredentialType.id },
|
cryptography: { typeId: cryptographyCredentialType.id },
|
||||||
};
|
};
|
||||||
@ -66,12 +60,8 @@ const fetchCredentials = async (credential) => {
|
|||||||
const { credential_type_id } = credential;
|
const { credential_type_id } = credential;
|
||||||
return {
|
return {
|
||||||
scm: {
|
scm: {
|
||||||
typeIds: [scmCredentialType.id, azurermCredentialType.id],
|
typeId: scmCredentialType.id,
|
||||||
value:
|
value: credential_type_id === scmCredentialType.id ? credential : null,
|
||||||
credential_type_id === scmCredentialType.id ||
|
|
||||||
credential_type_id === azurermCredentialType.id
|
|
||||||
? credential
|
|
||||||
: null,
|
|
||||||
},
|
},
|
||||||
insights: {
|
insights: {
|
||||||
typeId: insightsCredentialType.id,
|
typeId: insightsCredentialType.id,
|
||||||
@ -377,13 +367,13 @@ function ProjectForm({ project, submitError, ...props }) {
|
|||||||
});
|
});
|
||||||
const [scmTypeOptions, setScmTypeOptions] = useState(null);
|
const [scmTypeOptions, setScmTypeOptions] = useState(null);
|
||||||
const [credentials, setCredentials] = useState({
|
const [credentials, setCredentials] = useState({
|
||||||
scm: { typeIds: null, value: null },
|
scm: { typeId: null, value: null },
|
||||||
insights: { typeId: null, value: null },
|
insights: { typeId: null, value: null },
|
||||||
cryptography: { typeId: null, value: null },
|
cryptography: { typeId: null, value: null },
|
||||||
});
|
});
|
||||||
const [signatureValidationCredentials, setSignatureValidationCredentials] =
|
const [signatureValidationCredentials, setSignatureValidationCredentials] =
|
||||||
useState({
|
useState({
|
||||||
scm: { typeIds: null, value: null },
|
scm: { typeId: null, value: null },
|
||||||
insights: { typeId: null, value: null },
|
insights: { typeId: null, value: null },
|
||||||
cryptography: { typeId: null, value: null },
|
cryptography: { typeId: null, value: null },
|
||||||
});
|
});
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export const ScmCredentialFormField = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CredentialLookup
|
<CredentialLookup
|
||||||
credentialTypeIds={credential.typeIds}
|
credentialTypeId={credential.typeId}
|
||||||
label={t`Source Control Credential`}
|
label={t`Source Control Credential`}
|
||||||
value={credential.value}
|
value={credential.value}
|
||||||
onChange={onCredentialChange}
|
onChange={onCredentialChange}
|
||||||
|
|||||||
@ -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):
|
def create_payload(self, name='', description='', scm_type='git', scm_url='', scm_branch='', organization=Organization, credential=None, **kwargs):
|
||||||
if credential:
|
if credential:
|
||||||
if isinstance(credential, Credential):
|
if isinstance(credential, Credential):
|
||||||
if credential.ds.credential_type.namespace not in ('scm', 'insights', 'azure_rm'):
|
if credential.ds.credential_type.namespace not in ('scm', 'insights'):
|
||||||
credential = None # ignore incompatible credential from HasCreate dependency injection
|
credential = None # ignore incompatible credential from HasCreate dependency injection
|
||||||
elif credential in (Credential,):
|
elif credential in (Credential,):
|
||||||
credential = (Credential, dict(credential_type=(True, dict(kind='scm'))))
|
credential = (Credential, dict(credential_type=(True, dict(kind='scm'))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user