From 74746b9ca4f31e0849b5d8330f5d575d054f1fc0 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 06:39:51 -0600 Subject: [PATCH 01/13] [ci] Run sonarqube --- .buildkite/pipelines/sonarqube.yml | 10 ++++++---- catalog-info.yaml | 2 +- sonar-project.properties | 5 +++++ 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 sonar-project.properties diff --git a/.buildkite/pipelines/sonarqube.yml b/.buildkite/pipelines/sonarqube.yml index 655bf93dcd61a..3a81c1b039027 100644 --- a/.buildkite/pipelines/sonarqube.yml +++ b/.buildkite/pipelines/sonarqube.yml @@ -1,4 +1,6 @@ - -steps: - - label: Placeholder - command: echo "Hello!" \ No newline at end of file + - label: ":sonarqube: Continuous Code Inspection" + env: + VAULT_SONAR_TOKEN_PATH: "secret/ci/elastic-kibana/sonarqube" + agents: + image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" + command: /scan-source-code.sh diff --git a/catalog-info.yaml b/catalog-info.yaml index a28008c14e71f..b25e2278c0e5c 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -200,7 +200,7 @@ spec: apiVersion: buildkite.elastic.dev/v1 kind: Pipeline metadata: - name: kibana-bot / sonarqube + name: kibana / sonarqube spec: repository: elastic/kibana provider_settings: diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000000..865a9c790f41e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +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/**/* \ No newline at end of file From f6d43b4826833cbe1a839ee9f77272ea4da70c8e Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 07:09:29 -0600 Subject: [PATCH 02/13] mv --- .buildkite/pipelines/sonarqube.yml | 2 -- .buildkite/scripts/lifecycle/pre_command.sh | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/sonarqube.yml b/.buildkite/pipelines/sonarqube.yml index 3a81c1b039027..868c79f3a26cc 100644 --- a/.buildkite/pipelines/sonarqube.yml +++ b/.buildkite/pipelines/sonarqube.yml @@ -1,6 +1,4 @@ - label: ":sonarqube: Continuous Code Inspection" - env: - VAULT_SONAR_TOKEN_PATH: "secret/ci/elastic-kibana/sonarqube" agents: image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" command: /scan-source-code.sh diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 9b19e5e82da84..d232316989db2 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -142,6 +142,9 @@ export SYNTHETICS_REMOTE_KIBANA_URL DEPLOY_TAGGER_SLACK_WEBHOOK_URL=${DEPLOY_TAGGER_SLACK_WEBHOOK_URL:-"$(vault_get kibana-serverless-release-tools DEPLOY_TAGGER_SLACK_WEBHOOK_URL)"} export DEPLOY_TAGGER_SLACK_WEBHOOK_URL +SONAR_LOGIN="$(vault_get sonarqube token)" +export SONAR_LOGIN + # Setup Failed Test Reporter Elasticsearch credentials { TEST_FAILURES_ES_CLOUD_ID=$(vault_get failed_tests_reporter_es cloud_id) From 63c497a0c7a1009dffd186fcb481b8f8ac143d13 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 07:20:05 -0600 Subject: [PATCH 03/13] test --- .buildkite/hooks/pre-command | 3 ++- .buildkite/scripts/lifecycle/pre_command.sh | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 95e2975d094c3..2d2dc158e276d 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -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 token)" else source .buildkite/scripts/lifecycle/pre_command.sh fi diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index d232316989db2..9b19e5e82da84 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -142,9 +142,6 @@ export SYNTHETICS_REMOTE_KIBANA_URL DEPLOY_TAGGER_SLACK_WEBHOOK_URL=${DEPLOY_TAGGER_SLACK_WEBHOOK_URL:-"$(vault_get kibana-serverless-release-tools DEPLOY_TAGGER_SLACK_WEBHOOK_URL)"} export DEPLOY_TAGGER_SLACK_WEBHOOK_URL -SONAR_LOGIN="$(vault_get sonarqube token)" -export SONAR_LOGIN - # Setup Failed Test Reporter Elasticsearch credentials { TEST_FAILURES_ES_CLOUD_ID=$(vault_get failed_tests_reporter_es cloud_id) From 605ab196d18a3518e06ce36a1c55d6cd3037cca3 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 07:28:45 -0600 Subject: [PATCH 04/13] fix --- .buildkite/hooks/pre-command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 2d2dc158e276d..725591fdf19b4 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -2,7 +2,7 @@ if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then 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 token)" + export SONAR_LOGIN=$(vault read -field=token secret/ci/elastic-kibana/sonarqube) else source .buildkite/scripts/lifecycle/pre_command.sh fi From 6fcfbc93ec0ff4abc5f858824026aba8a749971a Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:08:23 -0600 Subject: [PATCH 05/13] more memory --- .buildkite/pipelines/sonarqube.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipelines/sonarqube.yml b/.buildkite/pipelines/sonarqube.yml index 868c79f3a26cc..ab43fccfa32bb 100644 --- a/.buildkite/pipelines/sonarqube.yml +++ b/.buildkite/pipelines/sonarqube.yml @@ -1,4 +1,5 @@ - label: ":sonarqube: Continuous Code Inspection" agents: - image: "docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest" + image: docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest + memory: 8G command: /scan-source-code.sh From 31d53a1a2c1a4eafa0b2a9554cb92733c323e031 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:10:43 -0600 Subject: [PATCH 06/13] scan error --- .../server/lib/pipelines/create_pipeline_definitions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts index 7900e196fe604..cbe3cb0433677 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts @@ -142,6 +142,7 @@ export const createIndexPipelineDefinitions = async ( }, }, ], + // Commenting for code review pattern: '�', replacement: '', tag: 'remove_replacement_chars', From 89ce28156c2315acf9c194dbd0b544d07645fdac Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:17:51 -0600 Subject: [PATCH 07/13] add annotation --- catalog-info.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/catalog-info.yaml b/catalog-info.yaml index b25e2278c0e5c..c2db1571e7c1e 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -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 From 186d93bf198c031a91c12dfffc0cecbfcdefafb2 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:23:46 -0600 Subject: [PATCH 08/13] run daily --- catalog-info.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/catalog-info.yaml b/catalog-info.yaml index c2db1571e7c1e..05251d665f44e 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -206,6 +206,10 @@ spec: repository: elastic/kibana provider_settings: trigger_mode: none + schedules: + daily: + branch: main + cronline: "@daily" pipeline_file: ".buildkite/pipelines/sonarqube.yml" teams: kibana-operations: From c57be3d00d061d645881f00b1b9c88e8fdd101bf Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:38:31 -0600 Subject: [PATCH 09/13] more memory --- .buildkite/pipelines/sonarqube.yml | 2 +- sonar-project.properties | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipelines/sonarqube.yml b/.buildkite/pipelines/sonarqube.yml index ab43fccfa32bb..827c52815c1fa 100644 --- a/.buildkite/pipelines/sonarqube.yml +++ b/.buildkite/pipelines/sonarqube.yml @@ -1,5 +1,5 @@ - label: ":sonarqube: Continuous Code Inspection" agents: image: docker.elastic.co/cloud-ci/sonarqube/buildkite-scanner:latest - memory: 8G + memory: 16G command: /scan-source-code.sh diff --git a/sonar-project.properties b/sonar-project.properties index 865a9c790f41e..05fb42f7e7b8c 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,4 +2,5 @@ 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/**/* \ No newline at end of file +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 \ No newline at end of file From c8c37d639e4972a2436e8c5c4a4d17d6322f0101 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 10:47:18 -0600 Subject: [PATCH 10/13] formatting --- sonar-project.properties | 50 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 05fb42f7e7b8c..337de8f59895a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +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.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 \ No newline at end of file From ea8dc16957132bb613a122f91933d6706077f60c Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 11:24:29 -0600 Subject: [PATCH 11/13] newline --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 337de8f59895a..3cac455d961f4 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -49,4 +49,4 @@ sonar.exclusions=\ **/tests/**/*, \ src/dev/**/* -sonar.javascript.node.maxspace=8192 \ No newline at end of file +sonar.javascript.node.maxspace=8192 From 6c174a38bf4b05a4c4c00c37ec325c273ba4d0c4 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 11:40:32 -0600 Subject: [PATCH 12/13] casing check --- src/dev/precommit_hook/casing_check_config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index d7376a81d4525..4043878da9195 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -15,6 +15,7 @@ */ export const IGNORE_FILE_GLOBS = [ '.node-version', + 'sonar-project.properties', '.github/**/*', 'docs/**/*', '**/bin/**/*', From bb56bec6b214113a20800f74c91e8450c317ad01 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 27 Dec 2023 05:50:04 -0600 Subject: [PATCH 13/13] rm comment --- .../server/lib/pipelines/create_pipeline_definitions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts index cbe3cb0433677..7900e196fe604 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts @@ -142,7 +142,6 @@ export const createIndexPipelineDefinitions = async ( }, }, ], - // Commenting for code review pattern: '�', replacement: '', tag: 'remove_replacement_chars',