Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 9f43e31

Browse files
committed
Remove azure.
1 parent b045d54 commit 9f43e31

18 files changed

+14
-1044
lines changed

src/common/constants.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ const USER_ROLES = {
3030
// The user types
3131
const USER_TYPES = {
3232
GITHUB: 'github',
33-
GITLAB: 'gitlab',
34-
AZURE: 'azure'
33+
GITLAB: 'gitlab'
3534
};
3635

3736
// The default page size for Gitlab API
@@ -50,15 +49,8 @@ const GITLAB_ACCESS_TOKEN_DEFAULT_EXPIRATION = 3600 * 24 * 14;
5049
// The Gitlab refresh token time in seconds before expiration
5150
const GITLAB_REFRESH_TOKEN_BEFORE_EXPIRATION = 300;
5251

53-
// The Azure access token default expiration in seconds
54-
const AZURE_ACCESS_TOKEN_DEFAULT_EXPIRATION = 3600 * 24 * 14;
55-
56-
// The Azure refresh token time in seconds before expiration
57-
const AZURE_REFRESH_TOKEN_BEFORE_EXPIRATION = 300;
58-
5952
const GITHUB_OWNER_CALLBACK_URL = '/api/v1/github/owneruser/callback';
6053
const GITLAB_OWNER_CALLBACK_URL = '/api/v1/gitlab/owneruser/callback';
61-
const AZURE_OWNER_CALLBACK_URL = '/api/v1/azure/owneruser/callback';
6254

6355
const OWNER_USER_LOGIN_SUCCESS_URL = '/#!/app/settings';
6456
const USER_ADDED_TO_TEAM_SUCCESS_URL = '/#!/members';
@@ -78,11 +70,8 @@ module.exports = {
7870
GITLAB_DEFAULT_GROUP_ACCESS_LEVEL,
7971
GITLAB_ACCESS_TOKEN_DEFAULT_EXPIRATION,
8072
GITLAB_REFRESH_TOKEN_BEFORE_EXPIRATION,
81-
AZURE_ACCESS_TOKEN_DEFAULT_EXPIRATION,
82-
AZURE_REFRESH_TOKEN_BEFORE_EXPIRATION,
8373
GITHUB_OWNER_CALLBACK_URL,
8474
GITLAB_OWNER_CALLBACK_URL,
85-
AZURE_OWNER_CALLBACK_URL,
8675
OWNER_USER_LOGIN_SUCCESS_URL,
8776
USER_ADDED_TO_TEAM_SUCCESS_URL,
8877
TC_LOGIN_CALLBACK_URL,

src/common/helper.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -159,26 +159,6 @@ function convertGitLabError(err, message) {
159159
return apiError;
160160
}
161161

162-
/**
163-
* Convert azure api error.
164-
* @param {Error} err the azure api error
165-
* @param {String} message the error message
166-
* @returns {Error} converted error
167-
*/
168-
function convertAzureError(err, message) {
169-
let resMsg = `${message}. ${err.message}.\n`;
170-
const detail = _.get(err, 'response.body.message');
171-
if (detail) {
172-
resMsg += ` Detail: ${detail}`;
173-
}
174-
const apiError = new errors.ApiError(
175-
err.status || _.get(err, 'response.status', constants.SERVICE_ERROR_STATUS),
176-
_.get(err, 'response.body.message', constants.SERVICE_ERROR),
177-
resMsg
178-
);
179-
return apiError;
180-
}
181-
182162
/**
183163
* Ensure entity exists for given criteria. Return error if no result.
184164
* @param {Object} Model the mongoose model to query
@@ -216,7 +196,7 @@ async function ensureExists(Model, criteria, modelName) {
216196
async function getProviderType(repoUrl) {
217197
const parsedDomain = await parseDomain(repoUrl);
218198
if (!parsedDomain || !parsedDomain.domain ||
219-
(parsedDomain.domain !== 'github' && parsedDomain.domain !== 'gitlab' && parsedDomain.domain !== 'azure')) {
199+
(parsedDomain.domain !== 'github' && parsedDomain.domain !== 'gitlab')) {
220200
throw new ValidationError('Invalid git repo url');
221201
}
222202
return parsedDomain.domain;
@@ -237,21 +217,15 @@ async function getProjectCopilotOrOwner(models, project, provider, isCopilot) {
237217

238218
if (!userMapping ||
239219
(provider === 'github' && !userMapping.githubUserId)
240-
|| (provider === 'gitlab' && !userMapping.gitlabUserId)
241-
|| (provider === 'azure' && !userMapping.azureUserId)) {
220+
|| (provider === 'gitlab' && !userMapping.gitlabUserId)) {
242221
throw new Error(`Couldn't find ${isCopilot ? 'copilot' : 'owner'} username for '${provider}' for this repository.`);
243222
}
244223

245224
let user = await dbHelper.scanOne(models.User, {
246225
username: provider === 'github' ? userMapping.githubUsername : // eslint-disable-line no-nested-ternary
247-
provider === 'gitlab' ? userMapping.gitlabUsername : userMapping.azureEmail,
226+
userMapping.gitlabUsername,
248227
type: provider,
249228
});
250-
251-
if (provider === 'azure') {
252-
const azureService = require('../services/AzureService'); // eslint-disable-line global-require
253-
user = azureService.refreshAzureUserAccessToken(user);
254-
}
255229

256230
return user;
257231
}
@@ -283,7 +257,6 @@ module.exports = {
283257
buildController,
284258
convertGitHubError,
285259
convertGitLabError,
286-
convertAzureError,
287260
ensureExists,
288261
generateIdentifier,
289262
getProviderType,

src/config.js

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,11 @@ module.exports = {
1919
GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET,
2020
GITLAB_CLIENT_ID: process.env.GITLAB_CLIENT_ID,
2121
GITLAB_CLIENT_SECRET: process.env.GITLAB_CLIENT_SECRET,
22-
AZURE_APP_ID: process.env.AZURE_APP_ID,
23-
AZURE_CLIENT_SECRET: process.env.AZURE_CLIENT_SECRET,
24-
AZURE_USER_APP_ID: process.env.AZURE_APP_ID,
25-
AZURE_USER_CLIENT_SECRET: process.env.AZURE_USER_CLIENT_SECRET,
2622

2723
// used as base to construct various URLs
2824
WEBSITE: process.env.WEBSITE || 'http://topcoderx.topcoder-dev.com',
2925
WEBSITE_SECURE: process.env.WEBSITE_SECURE || 'https://topcoderx.topcoder-dev.com',
3026
GITLAB_API_BASE_URL: process.env.GITLAB_API_BASE_URL || 'https://gitlab.com',
31-
AZURE_API_BASE_URL: process.env.AZURE_API_BASE_URL || 'https://app.vssps.visualstudio.com',
32-
AZURE_DEVOPS_API_BASE_URL: process.env.AZURE_DEVOPS_API_BASE_URL || 'https://dev.azure.com',
3327

3428
// kafka configuration
3529
TOPIC: process.env.TOPIC || 'tc-x-events',
@@ -90,12 +84,9 @@ const frontendConfigs = {
9084
"DIRECT_URL_BASE": "https://www.topcoder-dev/direct/projectOverview?formData.projectId=",
9185
"OWNER_LOGIN_GITHUB_URL":"/api/v1/github/owneruser/login",
9286
"OWNER_LOGIN_GITLAB_URL":"/api/v1/gitlab/owneruser/login",
93-
"OWNER_LOGIN_AZURE_URL":"/api/v1/azure/owneruser/login",
9487
"TOPCODER_URL": "https://topcoder-dev.com",
9588
"GITHUB_TEAM_URL": "https://github.com/orgs/",
96-
"GITLAB_GROUP_URL": "https://gitlab.com/groups/",
97-
"AZURE_TEAM_URL": "https://dev.azure.com/"
98-
89+
"GITLAB_GROUP_URL": "https://gitlab.com/groups/"
9990
},
10091
"heroku":{
10192
"JWT_V3_NAME":"v3jwt",
@@ -109,11 +100,9 @@ const frontendConfigs = {
109100
"DIRECT_URL_BASE": "https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=",
110101
"OWNER_LOGIN_GITHUB_URL":"/api/v1/github/owneruser/login",
111102
"OWNER_LOGIN_GITLAB_URL":"/api/v1/gitlab/owneruser/login",
112-
"OWNER_LOGIN_AZURE_URL":"/api/v1/azure/owneruser/login",
113103
"TOPCODER_URL": "https://topcoder-dev.com",
114104
"GITHUB_TEAM_URL": "https://github.com/orgs/",
115-
"GITLAB_GROUP_URL": "https://gitlab.com/groups/",
116-
"AZURE_TEAM_URL": "https://dev.azure.com/"
105+
"GITLAB_GROUP_URL": "https://gitlab.com/groups/"
117106
},
118107
"dev":{
119108
"JWT_V3_NAME":"v3jwt",
@@ -127,11 +116,9 @@ const frontendConfigs = {
127116
"DIRECT_URL_BASE": "https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=",
128117
"OWNER_LOGIN_GITHUB_URL":"/api/v1/github/owneruser/login",
129118
"OWNER_LOGIN_GITLAB_URL":"/api/v1/gitlab/owneruser/login",
130-
"OWNER_LOGIN_AZURE_URL":"/api/v1/azure/owneruser/login",
131119
"TOPCODER_URL": "https://topcoder-dev.com",
132120
"GITHUB_TEAM_URL": "https://github.com/orgs/",
133-
"GITLAB_GROUP_URL": "https://gitlab.com/groups/",
134-
"AZURE_TEAM_URL": "https://dev.azure.com/"
121+
"GITLAB_GROUP_URL": "https://gitlab.com/groups/"
135122
},
136123
"qa":{
137124
"JWT_V3_NAME":"v3jwt",
@@ -145,11 +132,9 @@ const frontendConfigs = {
145132
"DIRECT_URL_BASE": "https://www.topcoder-dev.com/direct/projectOverview?formData.projectId=",
146133
"OWNER_LOGIN_GITHUB_URL":"/api/v1/github/owneruser/login",
147134
"OWNER_LOGIN_GITLAB_URL":"/api/v1/gitlab/owneruser/login",
148-
"OWNER_LOGIN_AZURE_URL":"/api/v1/azure/owneruser/login",
149135
"TOPCODER_URL": "https://topcoder-dev.com",
150136
"GITHUB_TEAM_URL": "https://github.com/orgs/",
151-
"GITLAB_GROUP_URL": "https://gitlab.com/groups/",
152-
"AZURE_TEAM_URL": "https://dev.azure.com/"
137+
"GITLAB_GROUP_URL": "https://gitlab.com/groups/"
153138
},
154139
"prod":{
155140
"JWT_V3_NAME":"v3jwt",
@@ -163,11 +148,9 @@ const frontendConfigs = {
163148
"DIRECT_URL_BASE": "https://www.topcoder.com/direct/projectOverview?formData.projectId=",
164149
"OWNER_LOGIN_GITHUB_URL":"/api/v1/github/owneruser/login",
165150
"OWNER_LOGIN_GITLAB_URL":"/api/v1/gitlab/owneruser/login",
166-
"OWNER_LOGIN_AZURE_URL":"/api/v1/azure/owneruser/login",
167151
"TOPCODER_URL": "https://topcoder-dev.com",
168152
"GITHUB_TEAM_URL": "https://github.com/orgs/",
169-
"GITLAB_GROUP_URL": "https://gitlab.com/groups/",
170-
"AZURE_TEAM_URL": "https://dev.azure.com/"
153+
"GITLAB_GROUP_URL": "https://gitlab.com/groups/"
171154
}
172155
};
173156

@@ -187,9 +170,7 @@ module.exports.frontendConfigs = {
187170
DIRECT_URL_BASE: process.env.DIRECT_URL_BASE || frontendConfigs[activeEnv].DIRECT_URL_BASE,
188171
OWNER_LOGIN_GITHUB_URL: process.env.OWNER_LOGIN_GITHUB_URL || frontendConfigs[activeEnv].OWNER_LOGIN_GITHUB_URL,
189172
OWNER_LOGIN_GITLAB_URL: process.env.OWNER_LOGIN_GITLAB_URL || frontendConfigs[activeEnv].OWNER_LOGIN_GITLAB_URL,
190-
OWNER_LOGIN_AZURE_URL: process.env.OWNER_LOGIN_AZURE_URL || frontendConfigs[activeEnv].OWNER_LOGIN_AZURE_URL,
191173
TOPCODER_URL: process.env.TOPCODER_URL || frontendConfigs[activeEnv].TOPCODER_URL,
192174
GITHUB_TEAM_URL: process.env.GITHUB_TEAM_URL || frontendConfigs[activeEnv].GITHUB_TEAM_URL,
193-
GITLAB_GROUP_URL: process.env.GITLAB_GROUP_URL || frontendConfigs[activeEnv].GITLAB_GROUP_URL,
194-
AZURE_TEAM_URL: process.env.AZURE_TEAM_URL || frontendConfigs[activeEnv].AZURE_TEAM_URL
175+
GITLAB_GROUP_URL: process.env.GITLAB_GROUP_URL || frontendConfigs[activeEnv].GITLAB_GROUP_URL
195176
};

0 commit comments

Comments
 (0)