Skip to content

Commit

Permalink
Merge remote-tracking branch 'hop-dev/asset-criticality-csv-upoad-api…
Browse files Browse the repository at this point in the history
…' into siem-ea-9047
  • Loading branch information
machadoum committed Apr 9, 2024
2 parents 9fa8076 + f3c2c96 commit ae893bf
Show file tree
Hide file tree
Showing 2,718 changed files with 66,001 additions and 19,034 deletions.
24 changes: 12 additions & 12 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,18 +475,18 @@ enabled:
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/alerts/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_numeric_types/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_numeric_types/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_numeric_types/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/date_numeric_types/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/ips/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/keyword/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/long/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/operators_data_types/text/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/exceptions/workflows/basic_license_essentials_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/basic_license_essentials_tier/configs/ess.config.ts
Expand Down
72 changes: 72 additions & 0 deletions .buildkite/pipeline-resource-definitions/_template/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
###
# For more information on authoring pipeline definitions,
# follow the guides at https://docs.elastic.dev/ci/getting-started-with-buildkite-at-elastic
###
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
# This will be the URL slug in Backstage UI as:
# https://backstage.elastic.dev/catalog/default/resource/bk-kibana-your-pipeline-name
# bk-pipeline-<pipeline-name-slugified>
name: bk-kibana-your-pipeline-name
# This will be displayed in the Backstage UI
description: '<Describe your pipeline here>'
links:
# These are relevant links to your pipeline that will be listed in the Backstage UI
# The URL slug here is the .spec.implementation.metadata.name field slugified
- url: 'https://buildkite.com/elastic/kibana-your-pipeline-name'
title: Pipeline link
spec:
type: buildkite-pipeline
system: buildkite
# The owner team's github group name in the format 'group:<github-group-name>'
owner: 'group:github-group-name'
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
# <context / pipeline name> - this will be displayed in the Buildkite UI as title
# and this will be slugified to form the URL in the Backstage UI
name: kibana / your pipeline name
# This will appear as description on the Buildkite UI
description: '<Describe your pipeline here>'
spec:
# Environment variables that will be set for the pipeline
env:
# Slack channel to send notifications to, if ELASTIC_SLACK_NOTIFICATIONS_ENABLED = 'true'
SLACK_NOTIFICATIONS_CHANNEL: '#team-slack-channel-name'
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'

allow_rebuilds: false
branch_configuration: main
default_branch: main
repository: elastic/kibana
# Point to a pipeline implementation, detailing the pipeline steps to run
pipeline_file: .buildkite/pipelines/your-pipeline-name.yml
skip_intermediate_builds: false
provider_settings:
prefix_pull_request_fork_branch_names: false
skip_pull_request_builds_for_existing_commits: true
trigger_mode: none
# Teams and their access levels to the pipeline,
# please keep [kibana-operations, appex-qa, kibana-tech-leads] as MANAGE_BUILD_AND_READ
# and [everyone] as BUILD_AND_READ
teams:
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
appex-qa:
access_level: MANAGE_BUILD_AND_READ
kibana-tech-leads:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: BUILD_AND_READ
# Scheduled runs for the pipeline
schedules:
Daily 6 am UTC:
cronline: 0 5 * * *
message: Daily 6 am UTC
branch: main
# Optionally, set schedule-specific env-vars here
env:
SCHEDULED: 'true'
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env ts-node-script
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import fs from 'fs';
import jsYaml from 'js-yaml';
import path from 'path';
import { execSync } from 'child_process';

const EXCLUDE_LIST = ['locations.yml', '_template/template.yml'];
const REPO_FILES_BASE = 'https://github.com/elastic/kibana/blob/main';

type BackstageLocationResource = object & {
spec: { targets: string[] };
};

async function main() {
const repoRoot = execSync('git rev-parse --show-toplevel').toString().trim();
const resourceDefinitionsFolder = path.resolve(
repoRoot,
'.buildkite',
'pipeline-resource-definitions'
);
const resourceDefinitionsBaseUrl = `${REPO_FILES_BASE}/.buildkite/pipeline-resource-definitions`;
const locationFile = path.resolve(resourceDefinitionsFolder, 'locations.yml');
const locationFileLines = fs.readFileSync(locationFile, 'utf8').split('\n');

const pipelines = readDirRecursively(resourceDefinitionsFolder)
.filter((file) => file.endsWith('.yml'))
.map((file) => file.replace(`${resourceDefinitionsFolder}/`, ''))
.filter((f) => !EXCLUDE_LIST.includes(f));

const preamble = locationFileLines.slice(0, 1);

const locationObj = jsYaml.load(
locationFileLines.slice(1).join('\n')
) as BackstageLocationResource;
locationObj.spec.targets = pipelines.map(
(fileName) => `${resourceDefinitionsBaseUrl}/${fileName}`
);

const locationYaml = jsYaml.dump(locationObj, { lineWidth: 400 });

fs.writeFileSync(locationFile, `${preamble.join('\n')}\n${locationYaml}`);

console.log('Updated locations.yml');
}

function readDirRecursively(dir: string): string[] {
const files = fs.readdirSync(dir);
return files.reduce((acc, file) => {
const filePath = path.join(dir, file);
if (fs.statSync(filePath).isDirectory()) {
return [...acc, ...readDirRecursively(filePath)];
} else {
return [...acc, filePath];
}
}, [] as string[]);
}

main().catch((error) => {
console.error(error);
process.exit(1);
});
50 changes: 50 additions & 0 deletions .buildkite/pipeline-resource-definitions/kibana-coverage-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: bk-kibana-code-coverage-main
description: 'Collects code coverage for unit and e2e tests, publishes results on Kibana stats cluster'
links:
- url: 'https://buildkite.com/elastic/kibana-code-coverage-main'
title: Pipeline link
spec:
type: buildkite-pipeline
owner: 'group:appex-qa'
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana / code-coverage / main
description: 'Collects code coverage for unit and e2e tests, publishes results on Kibana stats cluster'
spec:
env:
SLACK_NOTIFICATIONS_CHANNEL: '#appex-qa-bots'
GITHUB_COMMIT_STATUS_CONTEXT: kibana-code-coverage-main
CODE_COVERAGE: '1'
FTR_CONFIGS_RETRY_COUNT: '0'
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
allow_rebuilds: false
branch_configuration: main
default_branch: main
repository: elastic/kibana
pipeline_file: .buildkite/pipelines/code_coverage/daily.yml
skip_intermediate_builds: false
provider_settings:
prefix_pull_request_fork_branch_names: false
skip_pull_request_builds_for_existing_commits: true
trigger_mode: none
teams:
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
appex-qa:
access_level: MANAGE_BUILD_AND_READ
kibana-tech-leads:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: BUILD_AND_READ
schedules:
Daily 6 am UTC:
cronline: 0 5 * * *
message: Daily 6 am UTC
branch: main
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: bk-kibana-esql-grammar-sync
description: Opens a PR if anything changes in the ES|QL grammar in Elasticsearch
links:
- url: 'https://buildkite.com/elastic/kibana-esql-grammar-sync'
title: Pipeline link
spec:
type: buildkite-pipeline
owner: 'group:kibana-esql'
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana / ES|QL grammar sync
description: Opens a PR if anything changes in the ES|QL grammar in Elasticsearch
spec:
env:
SLACK_NOTIFICATIONS_CHANNEL: '#kibana-esql-project-team'
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
allow_rebuilds: false
branch_configuration: main
default_branch: main
repository: elastic/kibana
pipeline_file: .buildkite/pipelines/esql_grammar_sync.yml
skip_intermediate_builds: false
provider_settings:
build_branches: false
build_pull_requests: false
publish_commit_status: false
trigger_mode: none
build_tags: false
prefix_pull_request_fork_branch_names: false
skip_pull_request_builds_for_existing_commits: true
teams:
kibana-esql:
access_level: MANAGE_BUILD_AND_READ
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
appex-qa:
access_level: MANAGE_BUILD_AND_READ
kibana-tech-leads:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: BUILD_AND_READ
schedules:
Weekly build:
cronline: 0 0 * * 1 America/New_York
message: Weekly build
branch: main
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: bk-kibana-purge-cloud-deployments
description: Purge stale cloud deployments
links:
- url: 'https://buildkite.com/elastic/kibana-purge-cloud-deployments'
title: Pipeline link
spec:
type: buildkite-pipeline
owner: 'group:kibana-operations'
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana / purge-cloud-deployments
description: Purge stale cloud deployments
spec:
env:
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'false'
allow_rebuilds: false
branch_configuration: main
default_branch: main
repository: elastic/kibana
pipeline_file: .buildkite/pipelines/purge_cloud_deployments.yml
skip_intermediate_builds: false
provider_settings:
build_branches: false
build_pull_requests: false
publish_commit_status: false
trigger_mode: none
build_tags: false
prefix_pull_request_fork_branch_names: false
skip_pull_request_builds_for_existing_commits: true
teams:
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
appex-qa:
access_level: MANAGE_BUILD_AND_READ
kibana-tech-leads:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: BUILD_AND_READ
15 changes: 9 additions & 6 deletions .buildkite/pipeline-resource-definitions/locations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ metadata:
spec:
type: url
targets:
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-coverage-daily.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-esql-grammar-sync.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-migration-staging.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-purge-cloud-deployments.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-serverless-release.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-ess/security-solution-ess.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-defend-workflows.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-detection-engine.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-entity-analytics.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-explore.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-gen-ai.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-investigations.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-rule-management.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-detection-engine.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-gen-ai.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-entity-analytics.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-quality-gate/kibana-serverless-security-solution-quality-gate-defend-workflows.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/security-solution-ess/security-solution-ess.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-serverless-release.yml
15 changes: 12 additions & 3 deletions .buildkite/pipeline-utils/buildkite/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ export interface BuildkiteCommandStep {
command: string;
label: string;
parallelism?: number;
agents: {
queue: string;
};
agents:
| {
queue: string;
}
| {
provider?: string;
image?: string;
imageProject?: string;
machineType?: string;
minCpuPlatform?: string;
preemptible?: boolean;
};
timeout_in_minutes?: number;
key?: string;
depends_on?: string | string[];
Expand Down
Loading

0 comments on commit ae893bf

Please sign in to comment.