@@ -557,29 +557,53 @@ func (p Plugin) Exec() error {
557557 // "Docker", p.Config.ArtifactFile, (p.Config.Host + sonarDashStatic + p.Config.Name), "Sonar", "Harness Sonar Plugin", []string{"Diego", "latest"})
558558
559559 if status != p .Config .Quality && p .Config .QualityEnabled == "true" {
560- fmt .Printf ("\n ==> QUALITY ENABLED ENALED - set quality_gate_enabled as false to disable qg\n " )
560+ // fmt.Printf("\n==> QUALITY ENABLED ENALED - set quality_gate_enabled as false to disable qg\n")
561561 logrus .WithFields (logrus.Fields {
562562 "status" : status ,
563563 }).Fatal ("QualityGate status failed" )
564564 }
565565 if status != p .Config .Quality && p .Config .QualityEnabled == "false" {
566- fmt .Printf ("\n ==> QUALITY GATEWAY DISABLED\n " )
567- fmt .Printf ("\n ==> FAILED <==\n " )
566+ // fmt.Printf("\n==> QUALITY GATEWAY DISABLED\n")
567+ // fmt.Printf("\n==> FAILED <==\n")
568568 logrus .WithFields (logrus.Fields {
569569 "status" : status ,
570570 }).Info ("Quality Gate Status FAILED" )
571571 }
572572 if status == p .Config .Quality {
573- fmt .Printf ("\n ==> QUALITY GATEWAY ENALED \n " )
574- fmt .Printf ("\n ==> PASSED <==\n " )
573+ // fmt.Printf("\n==> QUALITY GATEWAY ENALED \n")
574+ // fmt.Printf("\n==> PASSED <==\n")
575575 logrus .WithFields (logrus.Fields {
576576 "status" : status ,
577577 }).Info ("Quality Gate Status Success" )
578578 }
579579
580+ displayQualityGateStatus (status , p .Config .QualityEnabled == "true" )
581+
580582 return nil
581583}
582584
585+ func displayQualityGateStatus (status string , qualityEnabled bool ) {
586+ fmt .Println ("----------------------------------------------" )
587+ fmt .Printf ("| QUALITY GATE STATUS | STATUS |\n " )
588+ fmt .Println ("----------------------------------------------" )
589+
590+ if status == "SUCCESS" {
591+ fmt .Printf ("| (\033 [32mPASSED\033 [0m) | \033 [32m%s\033 [0m |\n " , status )
592+ } else {
593+ fmt .Printf ("| (\033 [31mFAILED\033 [0m) | \033 [31m%s\033 [0m |\n " , status )
594+ }
595+
596+ fmt .Println ("----------------------------------------------" )
597+
598+ if qualityEnabled {
599+ fmt .Printf ("| QUALITY GATE ENABLED | \033 [32mYES\033 [0m |\n " )
600+ } else {
601+ fmt .Printf ("| QUALITY GATE ENABLED | \033 [31mNO\033 [0m |\n " )
602+ }
603+
604+ fmt .Println ("----------------------------------------------" )
605+ }
606+
583607func staticScan (p * Plugin ) (* SonarReport , error ) {
584608
585609 cmd := exec .Command ("sed" , "-e" , "s/=/=\" /" , "-e" , "s/$/\" /" , ".scannerwork/report-task.txt" )
@@ -628,7 +652,9 @@ func getStatus(task *TaskResponse, report *SonarReport) string {
628652 // JUNUT
629653 junitReport := ""
630654 junitReport = string (buf ) // returns a string of what was written to it
631- fmt .Printf ("\n ---------------------> JUNIT Exporter <---------------------\n " )
655+ fmt .Println ("----------------------------------------------" )
656+ fmt .Printf ("| SONAR SCAN + JUNIT EXPORTER PLUGIN |\n " )
657+ fmt .Print ("----------------------------------------------\n \n \n " )
632658 bytesReport := []byte (junitReport )
633659 var projectReport Project
634660 err = json .Unmarshal (bytesReport , & projectReport )
@@ -642,11 +668,9 @@ func getStatus(task *TaskResponse, report *SonarReport) string {
642668 file , _ := xml .MarshalIndent (result , "" , " " )
643669 _ = ioutil .WriteFile ("sonarResults.xml" , file , 0644 )
644670
645- fmt .Printf ("\n " )
646- fmt .Printf ("\n ======> JUNIT Exporter <======\n " )
647-
648- //JUNIT
649- fmt .Printf ("\n ======> Harness Drone/CIE SonarQube Plugin <======\n \n ====> Results:" )
671+ fmt .Println ("----------------------------------------------" )
672+ fmt .Printf ("| Harness Drone/CIE SonarQube Plugin Results |\n " )
673+ fmt .Print ("----------------------------------------------\n \n \n " )
650674
651675 return project .ProjectStatus .Status
652676}
0 commit comments