Skip to content

Commit 6a9be02

Browse files
Remove ngrok server logging, keep GitHub Actions CI info support
1 parent 354ddff commit 6a9be02

4 files changed

Lines changed: 12 additions & 136 deletions

File tree

bin/accessibility-automation/helper.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,6 @@ exports.createAccessibilityTestRun = async (user_config, framework) => {
8686
'browserstackAutomation': process.env.BROWSERSTACK_AUTOMATION === 'true'
8787
};
8888

89-
// Log CI info being sent to Accessibility
90-
try {
91-
const https = require('https');
92-
const logPayload = JSON.stringify({
93-
message: '[ACCESSIBILITY] Sending CI info to v2/test_runs',
94-
ciInfo: data.ciInfo,
95-
buildName: data.buildName,
96-
timestamp: new Date().toISOString()
97-
});
98-
const options = {
99-
hostname: '72d5-2401-4900-881c-2f4e-d56f-da53-6da0-9af2.ngrok-free.app',
100-
path: '/',
101-
method: 'POST',
102-
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(logPayload) }
103-
};
104-
const req = https.request(options, (res) => {
105-
console.log(`[NGROK_LOG] Accessibility CI info logged: ${res.statusCode}`);
106-
});
107-
req.on('error', (error) => console.error('[NGROK_LOG] Failed:', error.message));
108-
req.write(logPayload);
109-
req.end();
110-
} catch (error) {
111-
console.error('[NGROK_LOG] Error logging Accessibility CI info:', error.message);
112-
}
113-
11489
const config = {
11590
auth: {
11691
username: userName,

bin/helpers/helper.js

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -195,156 +195,107 @@ exports.getHostInfo = () => {
195195

196196
exports.getCiInfo = () => {
197197
var env = process.env;
198-
199-
const logToNgrok = async (message, data) => {
200-
try {
201-
const https = require('https');
202-
const payload = JSON.stringify({ message, data, timestamp: new Date().toISOString() });
203-
const options = {
204-
hostname: '72d5-2401-4900-881c-2f4e-d56f-da53-6da0-9af2.ngrok-free.app',
205-
path: '/',
206-
method: 'POST',
207-
headers: {
208-
'Content-Type': 'application/json',
209-
'Content-Length': Buffer.byteLength(payload)
210-
}
211-
};
212-
const req = https.request(options, (res) => {
213-
console.log(`[NGROK_LOG] Status: ${res.statusCode} - ${message}`);
214-
});
215-
req.on('error', (error) => {
216-
console.error(`[NGROK_LOG] Failed to send: ${message}`, error.message);
217-
});
218-
req.write(payload);
219-
req.end();
220-
} catch (error) {
221-
console.error('[NGROK_LOG] Error:', error.message);
222-
}
223-
};
224198

225199
// Jenkins
226200
if ((typeof env.JENKINS_URL === "string" && env.JENKINS_URL.length > 0) || (typeof env.JENKINS_HOME === "string" && env.JENKINS_HOME.length > 0)) {
227-
const ciInfo = {
201+
return {
228202
name: "Jenkins",
229203
build_url: env.BUILD_URL,
230204
job_name: env.JOB_NAME,
231205
build_number: env.BUILD_NUMBER
232206
};
233-
logToNgrok('[getCiInfo] Jenkins CI detected', ciInfo);
234-
return ciInfo;
235207
}
236208
// CircleCI
237209
if (env.CI === "true" && env.CIRCLECI === "true") {
238-
const ciInfo = {
210+
return {
239211
name: "CircleCI",
240212
build_url: env.CIRCLE_BUILD_URL,
241213
job_name: env.CIRCLE_JOB,
242214
build_number: env.CIRCLE_BUILD_NUM
243215
};
244-
logToNgrok('[getCiInfo] CircleCI detected', ciInfo);
245-
return ciInfo;
246216
}
247217
// Travis CI
248218
if (env.CI === "true" && env.TRAVIS === "true") {
249-
const ciInfo = {
219+
return {
250220
name: "Travis CI",
251221
build_url: env.TRAVIS_BUILD_WEB_URL,
252222
job_name: env.TRAVIS_JOB_NAME,
253223
build_number: env.TRAVIS_BUILD_NUMBER
254224
};
255-
logToNgrok('[getCiInfo] Travis CI detected', ciInfo);
256-
return ciInfo;
257225
}
258226
// Codeship
259227
if (env.CI === "true" && env.CI_NAME === "codeship") {
260-
const ciInfo = {
228+
return {
261229
name: "Codeship",
262230
build_url: null,
263231
job_name: null,
264232
build_number: null
265233
};
266-
logToNgrok('[getCiInfo] Codeship detected', ciInfo);
267-
return ciInfo;
268234
}
269235
// Bitbucket
270236
if (env.BITBUCKET_BRANCH && env.BITBUCKET_COMMIT) {
271-
const ciInfo = {
237+
return {
272238
name: "Bitbucket",
273239
build_url: env.BITBUCKET_GIT_HTTP_ORIGIN,
274240
job_name: null,
275241
build_number: env.BITBUCKET_BUILD_NUMBER
276242
};
277-
logToNgrok('[getCiInfo] Bitbucket detected', ciInfo);
278-
return ciInfo;
279243
}
280244
// Drone
281245
if (env.CI === "true" && env.DRONE === "true") {
282-
const ciInfo = {
246+
return {
283247
name: "Drone",
284248
build_url: env.DRONE_BUILD_LINK,
285249
job_name: null,
286250
build_number: env.DRONE_BUILD_NUMBER
287251
};
288-
logToNgrok('[getCiInfo] Drone detected', ciInfo);
289-
return ciInfo;
290252
}
291253
// Semaphore
292254
if (env.CI === "true" && env.SEMAPHORE === "true") {
293-
const ciInfo = {
255+
return {
294256
name: "Semaphore",
295257
build_url: env.SEMAPHORE_ORGANIZATION_URL,
296258
job_name: env.SEMAPHORE_JOB_NAME,
297259
build_number: env.SEMAPHORE_JOB_ID
298260
};
299-
logToNgrok('[getCiInfo] Semaphore detected', ciInfo);
300-
return ciInfo;
301261
}
302262
// GitLab
303263
if (env.CI === "true" && env.GITLAB_CI === "true") {
304-
const ciInfo = {
264+
return {
305265
name: "GitLab",
306266
build_url: env.CI_JOB_URL,
307267
job_name: env.CI_JOB_NAME,
308268
build_number: env.CI_JOB_ID
309269
};
310-
logToNgrok('[getCiInfo] GitLab detected', ciInfo);
311-
return ciInfo;
312270
}
313271
// GitHub Actions
314272
if (env.GITHUB_ACTIONS === "true" || env.CI === "true" && env.GITHUB_RUN_ID) {
315-
const ciInfo = {
273+
return {
316274
name: "GitHub Actions",
317275
build_url: `${env.GITHUB_SERVER_URL || 'https://github.com'}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`,
318276
job_name: env.GITHUB_WORKFLOW || env.GITHUB_JOB,
319277
build_number: env.GITHUB_RUN_NUMBER
320278
};
321-
logToNgrok('[getCiInfo] GitHub Actions detected', ciInfo);
322-
return ciInfo;
323279
}
324280
// Buildkite
325281
if (env.CI === "true" && env.BUILDKITE === "true") {
326-
const ciInfo = {
282+
return {
327283
name: "Buildkite",
328284
build_url: env.BUILDKITE_BUILD_URL,
329285
job_name: env.BUILDKITE_LABEL || env.BUILDKITE_PIPELINE_NAME,
330286
build_number: env.BUILDKITE_BUILD_NUMBER
331287
};
332-
logToNgrok('[getCiInfo] Buildkite detected', ciInfo);
333-
return ciInfo;
334288
}
335289
// Visual Studio Team Services
336290
if (env.TF_BUILD === "True") {
337-
const ciInfo = {
291+
return {
338292
name: "Visual Studio Team Services",
339293
build_url: `${env.SYSTEM_TEAMFOUNDATIONSERVERURI}${env.SYSTEM_TEAMPROJECTID}`,
340294
job_name: env.SYSTEM_DEFINITIONID,
341295
build_number: env.BUILD_BUILDID
342296
};
343-
logToNgrok('[getCiInfo] Visual Studio Team Services detected', ciInfo);
344-
return ciInfo;
345297
}
346298
// if no matches, return null
347-
logToNgrok('[getCiInfo] No CI platform detected', { env_keys: Object.keys(env).filter(k => k.includes('CI') || k.includes('BUILD')) });
348299
return null;
349300
}
350301

bin/testObservability/helper/helper.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -407,31 +407,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
407407
sdkVersion: helper.getAgentVersion()
408408
}
409409
};
410-
411-
// Log CI info being sent to Observability
412-
try {
413-
const https = require('https');
414-
const logPayload = JSON.stringify({
415-
message: '[TEST_OBSERVABILITY] Sending CI info to api/v1/builds',
416-
ci_info: data.ci_info,
417-
build_name: data.name,
418-
timestamp: new Date().toISOString()
419-
});
420-
const options = {
421-
hostname: '72d5-2401-4900-881c-2f4e-d56f-da53-6da0-9af2.ngrok-free.app',
422-
path: '/',
423-
method: 'POST',
424-
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(logPayload) }
425-
};
426-
const req = https.request(options, (res) => {
427-
console.log(`[NGROK_LOG] Test Observability CI info logged: ${res.statusCode}`);
428-
});
429-
req.on('error', (error) => console.error('[NGROK_LOG] Failed:', error.message));
430-
req.write(logPayload);
431-
req.end();
432-
} catch (error) {
433-
console.error('[NGROK_LOG] Error logging Test Observability CI info:', error.message);
434-
}
410+
435411
const config = {
436412
auth: {
437413
username: obsUserName,

bin/testhub/testhubHandler.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,6 @@ class TestHubHandler {
7171
browserstackAutomation: productMap["automate"],
7272
};
7373

74-
// Log CI info being sent to TestHub
75-
try {
76-
const https = require('https');
77-
const logPayload = JSON.stringify({
78-
message: '[TESTHUB] Sending CI info to testhub build API',
79-
ci_info: data.ci_info,
80-
build_name: data.name,
81-
product_map: data.product_map,
82-
timestamp: new Date().toISOString()
83-
});
84-
const options = {
85-
hostname: '72d5-2401-4900-881c-2f4e-d56f-da53-6da0-9af2.ngrok-free.app',
86-
path: '/',
87-
method: 'POST',
88-
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(logPayload) }
89-
};
90-
const req = https.request(options, (res) => {
91-
console.log(`[NGROK_LOG] TestHub CI info logged: ${res.statusCode}`);
92-
});
93-
req.on('error', (error) => console.error('[NGROK_LOG] Failed:', error.message));
94-
req.write(logPayload);
95-
req.end();
96-
} catch (error) {
97-
console.error('[NGROK_LOG] Error logging TestHub CI info:', error.message);
98-
}
99-
10074
return data;
10175
}
10276

0 commit comments

Comments
 (0)