Skip to content

Commit 8ac7110

Browse files
Merge pull request #439 from LambdaTest/stage
Stage
2 parents 0742853 + e43042d commit 8ac7110

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.44",
3+
"version": "4.1.45",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/server.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,35 @@ export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMes
345345
}
346346
});
347347

348+
// Get build info
349+
server.get('/build/info', opts, async (request, reply) => {
350+
let replyCode: number;
351+
let replyBody: Record<string, any>;
352+
353+
try {
354+
if (ctx.build && ctx.build.id) {
355+
const buildInfo = ctx.build;
356+
const data = {
357+
buildId: buildInfo.id,
358+
buildName: buildInfo.name,
359+
baseline: buildInfo.baseline,
360+
projectToken: ctx.env.PROJECT_TOKEN || '',
361+
}
362+
replyCode = 200;
363+
replyBody = { data: data };
364+
} else {
365+
throw new Error('Build information is not available');
366+
}
367+
} catch (error: any) {
368+
ctx.log.debug(`build info failed; ${error}`);
369+
replyCode = 500;
370+
replyBody = { error: { message: error.message } };
371+
}
372+
373+
return reply.code(replyCode).send(replyBody);
374+
375+
});
376+
348377
// Use the helper function to find and start server on available port
349378
if (ctx.sourceCommand && ctx.sourceCommand === 'exec-start') {
350379

0 commit comments

Comments
 (0)