From 10ebf714b181f20bd1732228fd9d3a7b7ff368df Mon Sep 17 00:00:00 2001 From: dfeldick Date: Fri, 20 Oct 2023 13:45:36 -0700 Subject: [PATCH] APIGOV-26268 - sonar --- .gitlab-ci.yml | 17 ++++++----------- CODEOWNERS | 1 - Makefile | 3 --- sonar-project.properties | 14 ++++++++++++++ sonar.sh | 19 ------------------- 5 files changed, 20 insertions(+), 34 deletions(-) create mode 100644 sonar-project.properties delete mode 100755 sonar.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90dbda7..05b683f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,8 +17,11 @@ variables: GIT_TAG_PREFIX: v include: + - project: "apigov/gitlabci" + ref: master + file: "/.gitlab-ci-sonar.yml" - project: "apigov/beano_cicd" - ref: $BEANO_CICD_LATEST + ref: APIGOV-26268 # the order of these include files is important file: - "/gitlabci/variables.yml" @@ -47,7 +50,8 @@ include: stages: - test - - sonar + - sonar-preview + - sonar-publish - security-scans - security-review @@ -142,12 +146,3 @@ twistlock: twistlock:on-schedule: rules: - !reference [.only-never-rule, rules] - -################### -# These overridden from jobs.xml to never run -################### -test: - extends: .only-never - -error-check: - extends: .only-never diff --git a/CODEOWNERS b/CODEOWNERS index 0136231..55c09c8 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,7 +12,6 @@ whitesource.config @dfeldick # cicd-related files .gitlab-ci.yml @dfeldick @jcollins-axway @vivekschauhan Makefile @dfeldick @jcollins-axway @vivekschauhan -sonar.sh @dfeldick @jcollins-axway @vivekschauhan build/scripts/ @dfeldick @jcollins-axway @vivekschauhan .github/** @dfeldick @jcollins-axway @vivekschauhan diff --git a/Makefile b/Makefile index 84de4e4..9e8d32c 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,3 @@ docker-build-traceability: test-sonar: @go vet ${GO_PKG_LIST} @go test -v -short -coverpkg=./... -coverprofile=./gocoverage.out -count=1 ${GO_PKG_LIST} -json > ./goreport.json - -sonar: test-sonar - ./sonar.sh diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..5aab046 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectName=Mulesoft_Agents +sonar.projectVersion=1.0 +sonar.projectKey=Mulesoft_Agents +sonar.language=go +sonar.sourceEncoding=UTF-8 +sonar.projectBaseDir=. +sonar.sources=. +sonar.exclusions=**/*test*.go,**/build/**/*,**/deployment/** +sonar.tests=. +sonar.test.inclusions=**/*test*.go +sonar.go.tests.reportPaths=goreport.json +sonar.go.coverage.reportPaths=gocoverage.out +sonar.issuesReport.console.enable=true +sonar.report.export.path=sonar-report.json diff --git a/sonar.sh b/sonar.sh deleted file mode 100755 index d85482b..0000000 --- a/sonar.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -sonar-scanner -X \ - -Dsonar.host.url=${SONAR_HOST_URL} \ - -Dsonar.language=go \ - -Dsonar.projectName=Mulesoft_Agents \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.projectKey=Mulesoft_Agents \ - -Dsonar.sourceEncoding=UTF-8 \ - -Dsonar.projectBaseDir=${WORKSPACE} \ - -Dsonar.sources=. \ - -Dsonar.tests=. \ - -Dsonar.exclusions=**/*.json \ - -Dsonar.test.inclusions=**/*test*.go \ - -Dsonar.go.tests.reportPaths=goreport.json \ - -Dsonar.go.coverage.reportPaths=gocoverage.out \ - -Dsonar.issuesReport.console.enable=true \ - -Dsonar.report.export.path=sonar-report.json \ - -Dsonar.verbose=true