@@ -195,156 +195,107 @@ exports.getHostInfo = () => {
195195
196196exports . 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
0 commit comments