Skip to content

Commit c82db45

Browse files
authored
Merge pull request #336 from parthlambdatest/admiral_2
add upload cli logs via lsrs in stop endpoint
2 parents 24872ac + 0d897bd commit c82db45

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
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.25",
3+
"version": "4.1.26",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/server.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { validateSnapshot } from './schemaValidation.js'
77
import { pingIntervalId } from './utils.js';
88
import { startPolling } from './utils.js';
99

10+
const uploadDomToS3ViaEnv = process.env.USE_LAMBDA_INTERNAL || false;
1011
export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMessage, ServerResponse>> => {
1112

1213
const server: FastifyInstance<Server, IncomingMessage, ServerResponse> = fastify({
@@ -122,8 +123,16 @@ export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMes
122123
if (ctx.server){
123124
ctx.server.close();
124125
}
125-
let resp = await ctx.client.getS3PreSignedURL(ctx);
126-
await ctx.client.uploadLogs(ctx, resp.data.url);
126+
127+
let uploadCLILogsToS3 = ctx?.config?.useLambdaInternal || uploadDomToS3ViaEnv;
128+
if (!uploadCLILogsToS3) {
129+
ctx.log.debug(`Log file to be uploaded`)
130+
let resp = await ctx.client.getS3PreSignedURL(ctx);
131+
await ctx.client.uploadLogs(ctx, resp.data.url);
132+
} else {
133+
ctx.log.debug(`Log file to be uploaded via LSRS`)
134+
let resp = ctx.client.sendCliLogsToLSRS(ctx);
135+
}
127136

128137
if (pingIntervalId !== null) {
129138
clearInterval(pingIntervalId);

0 commit comments

Comments
 (0)