Skip to content

Commit

Permalink
[ci] Run sonarqube daily (#173961)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
jbudz authored Jan 3, 2024
1 parent c4821c5 commit 0b23e34
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -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
9 changes: 5 additions & 4 deletions .buildkite/pipelines/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
52 changes: 52 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
export const IGNORE_FILE_GLOBS = [
'.node-version',
'sonar-project.properties',
'.github/**/*',
'docs/**/*',
'**/bin/**/*',
Expand Down

0 comments on commit 0b23e34

Please sign in to comment.