From c634888bc9af8ffacb0e6a1d24a8ec82e2bb16e1 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 17 Jan 2024 11:02:49 +0100 Subject: [PATCH] ci: move remaining Cypress tests behind GH label (#174523) Move the remaining Security Solution Cypress tests behind the GitHub flag `ci:all-cypress-suites`. This is a follow-up to PR #173815. --------- Co-authored-by: Yngrid Coello --- .buildkite/pipelines/pull_request/base.yml | 48 ----------------- .../security_solution/defend_workflows.yml | 12 +++++ .../security_solution/osquery_cypress.yml | 24 +++++++++ .../security_solution/threat_intelligence.yml | 12 +++++ .../pipelines/pull_request/pipeline.ts | 52 +++++++++++++++++++ 5 files changed, 100 insertions(+), 48 deletions(-) create mode 100644 .buildkite/pipelines/pull_request/security_solution/osquery_cypress.yml create mode 100644 .buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml index 03019a107df9e..df8962d427ec5 100644 --- a/.buildkite/pipelines/pull_request/base.yml +++ b/.buildkite/pipelines/pull_request/base.yml @@ -57,54 +57,6 @@ steps: - exit_status: '*' limit: 1 - - command: .buildkite/scripts/steps/functional/threat_intelligence.sh - label: 'Threat Intelligence Cypress Tests' - agents: - queue: n2-4-spot - depends_on: build - timeout_in_minutes: 60 - parallelism: 2 - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: .buildkite/scripts/steps/functional/osquery_cypress.sh - label: 'Osquery Cypress Tests' - agents: - queue: n2-4-spot - depends_on: build - timeout_in_minutes: 60 - parallelism: 6 - retry: - automatic: - - exit_status: '*' - limit: 1 - - - command: .buildkite/scripts/steps/functional/security_serverless_osquery.sh - label: 'Serverless Osquery Cypress Tests' - agents: - queue: n2-4-spot - depends_on: build - timeout_in_minutes: 60 - parallelism: 6 - retry: - automatic: - - exit_status: '*' - limit: 1 - - # status_exception: Native role management is not enabled in this Elasticsearch instance - # - command: .buildkite/scripts/steps/functional/security_serverless_defend_workflows.sh - # label: 'Serverless Security Defend Workflows Cypress Tests' - # agents: - # queue: n2-4-spot - # depends_on: build - # timeout_in_minutes: 60 - # retry: - # automatic: - # - exit_status: '*' - # limit: 1 - - command: .buildkite/scripts/steps/lint.sh label: 'Linting' agents: diff --git a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml index 29d90461b04d5..248d953c485e6 100644 --- a/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml +++ b/.buildkite/pipelines/pull_request/security_solution/defend_workflows.yml @@ -22,3 +22,15 @@ steps: automatic: - exit_status: '*' limit: 1 + + # status_exception: Native role management is not enabled in this Elasticsearch instance + # - command: .buildkite/scripts/steps/functional/security_serverless_defend_workflows.sh + # label: 'Serverless Security Defend Workflows Cypress Tests' + # agents: + # queue: n2-4-spot + # depends_on: build + # timeout_in_minutes: 60 + # retry: + # automatic: + # - exit_status: '*' + # limit: 1 diff --git a/.buildkite/pipelines/pull_request/security_solution/osquery_cypress.yml b/.buildkite/pipelines/pull_request/security_solution/osquery_cypress.yml new file mode 100644 index 0000000000000..b969a468c81bc --- /dev/null +++ b/.buildkite/pipelines/pull_request/security_solution/osquery_cypress.yml @@ -0,0 +1,24 @@ +steps: + - command: .buildkite/scripts/steps/functional/osquery_cypress.sh + label: 'Osquery Cypress Tests' + agents: + queue: n2-4-spot + depends_on: build + timeout_in_minutes: 60 + parallelism: 6 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/security_serverless_osquery.sh + label: 'Serverless Osquery Cypress Tests' + agents: + queue: n2-4-spot + depends_on: build + timeout_in_minutes: 60 + parallelism: 6 + retry: + automatic: + - exit_status: '*' + limit: 1 diff --git a/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml new file mode 100644 index 0000000000000..6a82abe46eee1 --- /dev/null +++ b/.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml @@ -0,0 +1,12 @@ +steps: + - command: .buildkite/scripts/steps/functional/threat_intelligence.sh + label: 'Threat Intelligence Cypress Tests' + agents: + queue: n2-4-spot + depends_on: build + timeout_in_minutes: 60 + parallelism: 2 + retry: + automatic: + - exit_status: '*' + limit: 1 diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index ca0a83616492e..c86925cf523c2 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -265,6 +265,58 @@ const uploadPipeline = (pipelineContent: string | object) => { ); } + if ( + (await doAnyChangesMatch([ + /^package.json/, + /^src\/plugins\/data/, + /^src\/plugins\/kibana_utils/, + /^src\/plugins\/inspector/, + /^src\/plugins\/data_views/, + /^src\/core/, + /^packages\/kbn-securitysolution-.*/, + /^packages\/kbn-es-query/, + /^packages\/kbn-securitysolution-io-ts-list-types/, + /^packages\/kbn-i18n-react/, + /^packages\/kbn-i18n/, + /^packages\/shared-ux/, + /^packages\/kbn-doc-links/, + /^packages\/kbn-securitysolution-io-ts-list-types/, + /^x-pack\/plugins\/threat_intelligence/, + /^x-pack\/packages\/security-solution/, + /^x-pack\/test\/threat_intelligence_cypress/, + /^x-pack\/plugins\/cases/, + /^x-pack\/plugins\/timelines/, + /^x-pack\/plugins\/triggers_actions_ui/, + /^x-pack\/plugins\/rule_registry/, + ])) || + GITHUB_PR_LABELS.includes('ci:all-cypress-suites') + ) { + pipeline.push( + getPipeline('.buildkite/pipelines/pull_request/security_solution/threat_intelligence.yml') + ); + } + + if ( + (await doAnyChangesMatch([ + /^src\/plugins\/controls/, + /^packages\/kbn-securitysolution-.*/, + /^x-pack\/plugins\/lists/, + /^x-pack\/plugins\/security_solution/, + /^x-pack\/plugins\/timelines/, + /^x-pack\/plugins\/triggers_actions_ui\/public\/application\/sections\/action_connector_form/, + /^x-pack\/plugins\/triggers_actions_ui\/public\/application\/sections\/alerts_table/, + /^x-pack\/plugins\/triggers_actions_ui\/public\/application\/context\/connectors_context\.tsx/, + /^x-pack\/test\/defend_workflows_cypress/, + /^x-pack\/test\/security_solution_cypress/, + /^fleet_packages\.json/, // It contains reference to prebuilt detection rules, we want to run security solution tests if it changes + ])) || + GITHUB_PR_LABELS.includes('ci:all-cypress-suites') + ) { + pipeline.push( + getPipeline('.buildkite/pipelines/pull_request/security_solution/osquery_cypress.yml') + ); + } + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml')); // remove duplicated steps