[ci] Run sonarqube daily (#173961)

Adds a pipeline for a daily SonarQube scan.


https://buildkite.com/elastic/kibana-bot-sonarqube/builds/7#018ca703-4b56-4a56-b6ce-ae6630cd81e3
(ignore the pipeline name/slug, that was a copy paste error. I'll fix it
after)
This commit is contained in:
Jon 2024-01-03 15:43:29 -06:00 committed by GitHub
parent c4821c5b00
commit 0b23e346bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 6 deletions

View file

@ -1,7 +1,8 @@
#!/usr/bin/env bash
if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then
echo "Pipeline file triggered from outside the kibana executors, skipping pre_command"
echo "Pipeline file triggered from outside the kibana executors, skipping .buildkite/scripts/lifecycle/pre_command.sh"
export SONAR_LOGIN=$(vault read -field=token secret/ci/elastic-kibana/sonarqube)
else
source .buildkite/scripts/lifecycle/pre_command.sh
fi

View file

@ -1,4 +1,5 @@
steps:
- label: Placeholder
command: echo "Hello!"
- label: ":sonarqube: Continuous Code Inspection"
agents:
image: docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest
memory: 16G
command: /scan-source-code.sh

View file

@ -10,6 +10,7 @@ metadata:
github.com/project-slug: elastic/kibana
github.com/team-slug: elastic/kibana-tech-leads
buildkite.com/project-slug: elastic/kibana
sonarqube.org/project-key: elastic_kibana_AYvOkAHeQZlFqhqWIr9
tags:
- typescript
@ -200,11 +201,15 @@ spec:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana-bot / sonarqube
name: kibana / sonarqube
spec:
repository: elastic/kibana
provider_settings:
trigger_mode: none
schedules:
daily:
branch: main
cronline: "@daily"
pipeline_file: ".buildkite/pipelines/sonarqube.yml"
teams:
kibana-operations:

52
sonar-project.properties Normal file
View file

@ -0,0 +1,52 @@
sonar.projectKey=elastic_kibana_AYvOkAHeQZlFqhqWIr9Y
sonar.projectName=Kibana
sonar.host.url=https://sonar.elastic.dev
sonar.sources=\
packages, \
plugins, \
src, \
x-pack/packages, \
x-pack/plugins
sonar.exclusions=\
**/*.mock.*, \
**/*.mocks.*, \
**/*.spec.*, \
**/*.stories.js, \
**/*.stories.ts, \
**/*.story.js, \
**/*.story.ts, \
**/*.test.*, \
**/*.test.mocks.*, \
**/.storybook/**/*, \
**/__fixtures__/**/*, \
**/__jest__/**/*, \
**/__mocks__/**/*, \
**/__snapshots__/**/*, \
**/__stories__/**/*, \
**/__tests__/**/*, \
**/cypress/**/*, \
**/dev_docs/**/*, \
**/docs/**/*, \
**/e2e/**/*, \
**/fixtures/**/*, \
**/ftr_e2e/**/*, \
**/integration_tests/**/*, \
**/jest*, \
**/manual_tests/**/*, \
**/mock_responses/**/*, \
**/mocks/**/*, \
**/node_modules/**/*, \
**/packages/**/*, \
**/public/**/*, \
**/scripts/**/*, \
**/storybook/**/*, \
**/stubs.ts, \
**/test/**/*, \
**/test_data/**/*, \
**/test_mocks.ts, \
**/test_resources/**/*, \
**/tests/**/*, \
src/dev/**/*
sonar.javascript.node.maxspace=8192

View file

@ -15,6 +15,7 @@
*/
export const IGNORE_FILE_GLOBS = [
'.node-version',
'sonar-project.properties',
'.github/**/*',
'docs/**/*',
'**/bin/**/*',