Skip to content

Commit

Permalink
Sonarqube integration
Browse files Browse the repository at this point in the history
  • Loading branch information
pazone committed Sep 4, 2023
1 parent ada3c33 commit cab3c3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ steps:
provider: "gcp"
artifact_paths:
- build/*.xml
- build/coverage.out

- label: ":sonarqube: Continuous Code Inspection"
env:
VAULT_SONAR_TOKEN_PATH: "kv/ci-shared/platform-ingest/elastic/fleet-server/sonar-analyze-token"
agents:
image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest"
command:
- "buildkite-agent artifact download build/coverage.out ."
- "/scan-source-code.sh"
depends_on:
- "tests"

- label: ":smartbear-testexecute: Run integration tests"
key: int-test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test-release: ## - Check that all release binaries are created

.PHONY: test-unit
test-unit: prepare-test-context ## - Run unit tests only
set -o pipefail; go test ${GO_TEST_FLAG} -v -race ./... | tee build/test-unit.out
set -o pipefail; go test ${GO_TEST_FLAG} -v -race -coverprofile=build/coverage.out ./... | tee build/test-unit.out

.PHONY: benchmark
benchmark: prepare-test-context install-benchstat ## - Run benchmark tests only
Expand Down
7 changes: 3 additions & 4 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
sonar.organization=elastic-1
sonar.projectKey=elastic_fleet-server
sonar.host.url=https://sonarcloud.io
sonar.projectKey=elastic_fleet-server_AYpL8BsVaV3I-igkX4hx
sonar.host.url=https://sonar.elastic.dev

sonar.sources=.
sonar.exclusions=**/*_test.go, .git/**, dev-tools/**, /magefile.go, changelog/**, testing/**, **/*.gen.go
sonar.tests=.
sonar.test.inclusions=**/*_test.go

sonar.go.tests.reportPaths=build/test-unit.out.xml
sonar.go.coverage.reportPaths=**/build/TEST-*.cov
sonar.go.coverage.reportPaths=**/build/coverage.out
sonar.go.exclusions=**/vendor/**,**/*_mock.go

sonar.sourceEncoding=UTF-8
Expand Down

0 comments on commit cab3c3e

Please sign in to comment.