Skip to content

Commit 1a81d17

Browse files
committed
Revert "Implement project pulling from Azure DevOps using Service Principals (ansible#14628)"
This reverts commit 2e2cd7f.
1 parent ee9eac1 commit 1a81d17

File tree

7 files changed

+9
-49
lines changed

7 files changed

+9
-49
lines changed

awx/main/models/projects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def clean_credential(self):
160160
if self.scm_type == 'insights':
161161
if cred.kind != 'insights':
162162
raise ValidationError(_("Credential kind must be 'insights'."))
163-
elif cred.kind != 'scm' and cred.kind != 'azure_rm':
164-
raise ValidationError(_("Credential kind must be 'scm' or 'azure_rm'." % cred.kind))
163+
elif cred.kind != 'scm':
164+
raise ValidationError(_("Credential kind must be 'scm'."))
165165
try:
166166
if self.scm_type == 'insights':
167167
self.scm_url = settings.INSIGHTS_URL_BASE

awx/main/tasks/jobs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,9 +1239,6 @@ def _build_scm_url_extra_vars(self, project_update):
12391239

12401240
return scm_url, extra_vars
12411241

1242-
def build_credentials_list(self, instance):
1243-
return [instance.credential]
1244-
12451242
def build_inventory(self, instance, private_data_dir):
12461243
return 'localhost,'
12471244

awx/playbooks/project_update.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,6 @@
3838
tags:
3939
- update_git
4040
block:
41-
- name: Get Azure access token
42-
when: "lookup('ansible.builtin.env', 'AZURE_CLIENT_ID') != ''"
43-
register: azure_token
44-
no_log: True
45-
check_mode: false
46-
azure.azcollection.azure_rm_accesstoken_info:
47-
scopes:
48-
# This is the audience for Azure DevOps, as per
49-
# https://learn.microsoft.com/en-us/rest/api/azure/devops/tokens/
50-
- 499b84ac-1321-427f-aa17-267ca6975798/.default
51-
52-
- name: Define git environment variables
53-
when: "azure_token is not skipped"
54-
no_log: True
55-
ansible.builtin.set_fact:
56-
git_environment:
57-
GIT_CONFIG_COUNT: 1
58-
GIT_CONFIG_KEY_0: http.extraHeader
59-
GIT_CONFIG_VALUE_0: "Authorization: Bearer {{ azure_token.access_token }}"
60-
6141
- name: Update project using git
6242
ansible.builtin.git:
6343
dest: "{{ project_path | quote }}"
@@ -67,7 +47,6 @@
6747
force: "{{ scm_clean }}"
6848
track_submodules: "{{ scm_track_submodules | default(omit) }}"
6949
accept_hostkey: "{{ scm_accept_hostkey | default(omit) }}"
70-
environment: "{{ git_environment | default({}) }}"
7150
register: git_result
7251

7352
- name: Set the git repository version

awx/ui/src/components/Lookup/CredentialLookup.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const QS_CONFIG = getQSConfig('credentials', {
3232
function CredentialLookup({
3333
autoPopulate,
3434
credentialTypeId,
35-
credentialTypeIds,
3635
credentialTypeKind,
3736
credentialTypeNamespace,
3837
fieldName,
@@ -62,9 +61,6 @@ function CredentialLookup({
6261
const typeIdParams = credentialTypeId
6362
? { credential_type: credentialTypeId }
6463
: {};
65-
const typeIdsParams = credentialTypeIds
66-
? { credential_type__in: credentialTypeIds.join() }
67-
: {};
6864
const typeKindParams = credentialTypeKind
6965
? { credential_type__kind: credentialTypeKind }
7066
: {};
@@ -76,7 +72,6 @@ function CredentialLookup({
7672
CredentialsAPI.read(
7773
mergeParams(params, {
7874
...typeIdParams,
79-
...typeIdsParams,
8075
...typeKindParams,
8176
...typeNamespaceParams,
8277
})
@@ -106,7 +101,6 @@ function CredentialLookup({
106101
autoPopulate,
107102
autoPopulateLookup,
108103
credentialTypeId,
109-
credentialTypeIds,
110104
credentialTypeKind,
111105
credentialTypeNamespace,
112106
history.location.search,

awx/ui/src/screens/Project/shared/ProjectForm.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ const fetchCredentials = async (credential) => {
3333
results: [scmCredentialType],
3434
},
3535
},
36-
{
37-
data: {
38-
results: [azurermCredentialType],
39-
},
40-
},
4136
{
4237
data: {
4338
results: [insightsCredentialType],
@@ -50,14 +45,13 @@ const fetchCredentials = async (credential) => {
5045
},
5146
] = await Promise.all([
5247
CredentialTypesAPI.read({ kind: 'scm' }),
53-
CredentialTypesAPI.read({ namespace: 'azure_rm' }),
5448
CredentialTypesAPI.read({ name: 'Insights' }),
5549
CredentialTypesAPI.read({ kind: 'cryptography' }),
5650
]);
5751

5852
if (!credential) {
5953
return {
60-
scm: { typeIds: [scmCredentialType.id, azurermCredentialType.id] },
54+
scm: { typeId: scmCredentialType.id },
6155
insights: { typeId: insightsCredentialType.id },
6256
cryptography: { typeId: cryptographyCredentialType.id },
6357
};
@@ -66,12 +60,8 @@ const fetchCredentials = async (credential) => {
6660
const { credential_type_id } = credential;
6761
return {
6862
scm: {
69-
typeIds: [scmCredentialType.id, azurermCredentialType.id],
70-
value:
71-
credential_type_id === scmCredentialType.id ||
72-
credential_type_id === azurermCredentialType.id
73-
? credential
74-
: null,
63+
typeId: scmCredentialType.id,
64+
value: credential_type_id === scmCredentialType.id ? credential : null,
7565
},
7666
insights: {
7767
typeId: insightsCredentialType.id,
@@ -377,13 +367,13 @@ function ProjectForm({ project, submitError, ...props }) {
377367
});
378368
const [scmTypeOptions, setScmTypeOptions] = useState(null);
379369
const [credentials, setCredentials] = useState({
380-
scm: { typeIds: null, value: null },
370+
scm: { typeId: null, value: null },
381371
insights: { typeId: null, value: null },
382372
cryptography: { typeId: null, value: null },
383373
});
384374
const [signatureValidationCredentials, setSignatureValidationCredentials] =
385375
useState({
386-
scm: { typeIds: null, value: null },
376+
scm: { typeId: null, value: null },
387377
insights: { typeId: null, value: null },
388378
cryptography: { typeId: null, value: null },
389379
});

awx/ui/src/screens/Project/shared/ProjectSubForms/SharedFields.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const ScmCredentialFormField = ({
5252

5353
return (
5454
<CredentialLookup
55-
credentialTypeIds={credential.typeIds}
55+
credentialTypeId={credential.typeId}
5656
label={t`Source Control Credential`}
5757
value={credential.value}
5858
onChange={onCredentialChange}

awxkit/awxkit/api/pages/projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def payload(self, organization, scm_type='git', **kwargs):
5050
def create_payload(self, name='', description='', scm_type='git', scm_url='', scm_branch='', organization=Organization, credential=None, **kwargs):
5151
if credential:
5252
if isinstance(credential, Credential):
53-
if credential.ds.credential_type.namespace not in ('scm', 'insights', 'azure_rm'):
53+
if credential.ds.credential_type.namespace not in ('scm', 'insights'):
5454
credential = None # ignore incompatible credential from HasCreate dependency injection
5555
elif credential in (Credential,):
5656
credential = (Credential, dict(credential_type=(True, dict(kind='scm'))))

0 commit comments

Comments
 (0)