You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
fix(sonar): disable gcp upload when not configured (#3369)
This commit is contained in:
committed by
GitHub
parent
cd243ee542
commit
91ddbf9152
@@ -55,6 +55,10 @@ type sonarExecuteScanReports struct {
|
||||
}
|
||||
|
||||
func (p *sonarExecuteScanReports) persist(stepConfig sonarExecuteScanOptions) {
|
||||
if GeneralConfig.GCSBucketId == "" {
|
||||
log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
|
||||
return
|
||||
}
|
||||
content := []gcs.ReportOutputParam{
|
||||
{FilePattern: "sonarscan.json", ParamRef: "", StepResultType: "sonarqube"},
|
||||
{FilePattern: "sonarExecuteScan_*.json", ParamRef: "", StepResultType: "sonarqube"},
|
||||
|
||||
@@ -214,6 +214,10 @@ const reportsStructTemplate = `type {{ .StepName }}{{ .Name | title}} struct {
|
||||
}
|
||||
|
||||
func (p *{{ .StepName }}{{ .Name | title}}) persist(stepConfig sonarExecuteScanOptions) {
|
||||
if GeneralConfig.GCSBucketId == "" {
|
||||
log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
|
||||
return
|
||||
}
|
||||
content := []gcs.ReportOutputParam{
|
||||
{{- range $notused, $param := .Parameters }}
|
||||
{FilePattern: "{{ $param.FilePattern }}", ParamRef: "{{ $param.ParamRef }}", StepResultType: "{{ $param.Type }}"},
|
||||
|
||||
@@ -120,6 +120,10 @@ func TestReportsResource_StructString(t *testing.T) {
|
||||
}
|
||||
|
||||
func (p *testStepReports) persist(stepConfig sonarExecuteScanOptions) {
|
||||
if GeneralConfig.GCSBucketId == "" {
|
||||
log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
|
||||
return
|
||||
}
|
||||
content := []gcs.ReportOutputParam{
|
||||
{FilePattern: "pattern1", ParamRef: "", StepResultType: "general"},
|
||||
{FilePattern: "pattern2", ParamRef: "", StepResultType: ""},
|
||||
|
||||
@@ -34,6 +34,10 @@ type testStepReports struct {
|
||||
}
|
||||
|
||||
func (p *testStepReports) persist(stepConfig sonarExecuteScanOptions) {
|
||||
if GeneralConfig.GCSBucketId == "" {
|
||||
log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
|
||||
return
|
||||
}
|
||||
content := []gcs.ReportOutputParam{
|
||||
{FilePattern: "test-report_*.json", ParamRef: "", StepResultType: ""},
|
||||
{FilePattern: "report1", ParamRef: "", StepResultType: "general"},
|
||||
|
||||
@@ -33,6 +33,10 @@ type testStepReports struct {
|
||||
}
|
||||
|
||||
func (p *testStepReports) persist(stepConfig sonarExecuteScanOptions) {
|
||||
if GeneralConfig.GCSBucketId == "" {
|
||||
log.Entry().Info("persisting reports to GCS is disabled, because gcsBucketId is empty")
|
||||
return
|
||||
}
|
||||
content := []gcs.ReportOutputParam{
|
||||
{FilePattern: "test-report_*.json", ParamRef: "", StepResultType: ""},
|
||||
{FilePattern: "report1", ParamRef: "", StepResultType: "general"},
|
||||
|
||||
Reference in New Issue
Block a user