@@ -23,6 +23,7 @@ import (
2323const (
2424 endpointPostTestResults = "http://localhost:9876/results"
2525 endpointPostTestList = "http://localhost:9876/test-list"
26+ languageJs = "javascript"
2627)
2728
2829// NewPipeline creates and returns a new Pipeline instance
@@ -56,7 +57,7 @@ func (pl *Pipeline) Start(ctx context.Context) (err error) {
5657 pl .Logger .Debugf ("Payload for current task: %+v \n " , * payload )
5758
5859 if pl .Cfg .CoverageMode {
59- if err : = pl .CoverageService .MergeAndUpload (ctx , payload ); err != nil {
60+ if err = pl .CoverageService .MergeAndUpload (ctx , payload ); err != nil {
6061 pl .Logger .Fatalf ("error while merge and upload coverage files %v" , err )
6162 }
6263 os .Exit (0 )
@@ -211,11 +212,19 @@ func (pl *Pipeline) runOldVersion(ctx context.Context,
211212 return err
212213 }
213214
214- cacheKey := fmt .Sprintf ("%s/%s/%s/%s" , tasConfig .Cache .Version , payload .OrgID , payload .RepoID , tasConfig .Cache .Key )
215+ cacheKey := ""
216+
217+ language := global .FrameworkLanguageMap [tasConfig .Framework ]
218+
219+ if language == languageJs {
220+ cacheKey = fmt .Sprintf ("%s/%s/%s/%s" , tasConfig .Cache .Version , payload .OrgID , payload .RepoID , tasConfig .Cache .Key )
221+ }
222+
215223 pl .Logger .Infof ("Tas yaml: %+v" , tasConfig )
224+
216225 os .Setenv ("REPO_CACHE_DIR" , global .RepoCacheDir )
217226
218- if tasConfig .NodeVersion != "" {
227+ if tasConfig .NodeVersion != "" && language == languageJs {
219228 nodeVersion := tasConfig .NodeVersion
220229 if nodeErr := pl .installNodeVersion (ctx , nodeVersion ); nodeErr != nil {
221230 return nodeErr
@@ -250,6 +259,13 @@ func (pl *Pipeline) runTestExecutionV1(ctx context.Context,
250259 coverageDir string ,
251260 secretMap map [string ]string ,
252261 taskPayload * TaskPayload , payload * Payload ) error {
262+ blYml := pl .BlockTestService .GetBlocklistYMLV1 (tasConfig )
263+ if errG := pl .BlockTestService .GetBlockTests (ctx , blYml , payload .BranchName ); errG != nil {
264+ pl .Logger .Errorf ("Unable to fetch blocklisted tests: %v" , errG )
265+ errG = errs .New (errs .GenericErrRemark .Error ())
266+ return errG
267+ }
268+
253269 executionResults , err := pl .TestExecutionService .RunV1 (ctx , tasConfig , pl .Payload , coverageDir , secretMap )
254270 if err != nil {
255271 pl .Logger .Infof ("Unable to perform test execution: %v" , err )
@@ -291,20 +307,31 @@ func (pl *Pipeline) runDiscoveryV1(ctx context.Context,
291307 // discover test cases
292308 // mark status as passed
293309 // Upload cache once for other builds
310+ language := global .FrameworkLanguageMap [tasConfig .Framework ]
311+
294312 if postErr := pl .TestDiscoveryService .UpdateSubmoduleList (ctx , payload .BuildID , 1 ); postErr != nil {
295313 return postErr
296314 }
297315
298316 g , errCtx := errgroup .WithContext (ctx )
299317
300- g .Go (func () error {
301- if errG := pl .CacheStore .Download (errCtx , cacheKey ); errG != nil {
302- pl .Logger .Errorf ("Unable to download cache: %v" , errG )
303- errG = errs .New (errs .GenericErrRemark .Error ())
304- return errG
318+ if language == languageJs {
319+ g .Go (func () error {
320+ if errG := pl .CacheStore .Download (errCtx , cacheKey ); errG != nil {
321+ pl .Logger .Errorf ("Unable to download cache: %v" , errG )
322+ errG = errs .New (errs .GenericErrRemark .Error ())
323+ return errG
324+ }
325+ return nil
326+ })
327+
328+ err := pl .ExecutionManager .ExecuteInternalCommands (ctx , InstallRunners , global .InstallRunnerCmds , global .RepoDir , nil , nil )
329+ if err != nil {
330+ pl .Logger .Errorf ("Unable to install custom runners %v" , err )
331+ err = errs .New (errs .GenericErrRemark .Error ())
332+ return err
305333 }
306- return nil
307- })
334+ }
308335
309336 pl .Logger .Infof ("Identifying changed files ..." )
310337 diffExists := true
@@ -338,12 +365,6 @@ func (pl *Pipeline) runDiscoveryV1(ctx context.Context,
338365 return err
339366 }
340367 }
341- err = pl .ExecutionManager .ExecuteInternalCommands (ctx , InstallRunners , global .InstallRunnerCmds , global .RepoDir , nil , nil )
342- if err != nil {
343- pl .Logger .Errorf ("Unable to install custom runners %v" , err )
344- err = errs .New (errs .GenericErrRemark .Error ())
345- return err
346- }
347368
348369 pl .Logger .Debugf ("Caching workspace" )
349370
@@ -359,10 +380,12 @@ func (pl *Pipeline) runDiscoveryV1(ctx context.Context,
359380 err = & errs.StatusFailed {Remark : "Failed in discovering tests" }
360381 return err
361382 }
362- if err = pl .CacheStore .Upload (ctx , cacheKey , tasConfig .Cache .Paths ... ); err != nil {
363- pl .Logger .Errorf ("Unable to upload cache: %v" , err )
364- err = errs .New (errs .GenericErrRemark .Error ())
365- return err
383+ if language == languageJs {
384+ if err = pl .CacheStore .Upload (ctx , cacheKey , tasConfig .Cache .Paths ... ); err != nil {
385+ pl .Logger .Errorf ("Unable to upload cache: %v" , err )
386+ err = errs .New (errs .GenericErrRemark .Error ())
387+ return err
388+ }
366389 }
367390 taskPayload .Status = Passed
368391 pl .Logger .Debugf ("Cache uploaded successfully" )
0 commit comments