@@ -539,6 +539,19 @@ export default class httpClient {
539539 } , ctx . log )
540540 }
541541
542+ getS3PreSignedURLForCaps ( ctx : Context , capsBuildId : string , capsProjectToken : string ) {
543+ return this . request ( {
544+ url : `/loguploadurl` ,
545+ method : 'POST' ,
546+ headers : { 'Content-Type' : 'application/json' ,
547+ projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken
548+ } ,
549+ data : {
550+ buildId : capsBuildId
551+ }
552+ } , ctx . log )
553+ }
554+
542555 getS3PresignedURLForSnapshotUpload ( ctx : Context , snapshotName : string , snapshotUuid : string ) {
543556 return this . request ( {
544557 url : `/snapshotuploadurl` ,
@@ -601,7 +614,7 @@ export default class httpClient {
601614 }
602615
603616 uploadLogs ( ctx : Context , uploadURL : string ) {
604- const fileStream = fs . createReadStream ( constants . LOG_FILE_PATH ) ;
617+ const logContent = fs . readFileSync ( constants . LOG_FILE_PATH ) ;
605618 const { size } = fs . statSync ( constants . LOG_FILE_PATH ) ;
606619
607620 return this . request ( {
@@ -611,7 +624,7 @@ export default class httpClient {
611624 'Content-Type' : 'text/plain' ,
612625 'Content-Length' : size ,
613626 } ,
614- data : fileStream ,
627+ data : logContent ,
615628 maxBodyLength : Infinity , // prevent axios from limiting the body size
616629 maxContentLength : Infinity , // prevent axios from limiting the content size
617630 } , ctx . log )
@@ -631,6 +644,22 @@ export default class httpClient {
631644 } , ctx . log ) ;
632645 }
633646
647+ sendCliLogsToLSRSForCaps ( ctx : Context , capsBuildId : string , capsProjectToken : string ) {
648+ const logContent = fs . readFileSync ( constants . LOG_FILE_PATH , 'utf-8' ) ;
649+ return this . request ( {
650+ url : `/upload/logs` ,
651+ method : 'POST' ,
652+ headers : { 'Content-Type' : 'application/json' ,
653+ projectToken : capsProjectToken !== '' ? capsProjectToken : this . projectToken
654+ } ,
655+ data : {
656+ buildId : capsBuildId ,
657+ logContent : logContent ,
658+ skipLogging : true
659+ }
660+ } , ctx . log ) ;
661+ }
662+
634663 uploadSnapshotToS3 ( ctx : Context , uploadURL : string , snapshot : Snapshot ) {
635664 return this . request ( {
636665 url : uploadURL ,
0 commit comments