Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
animehart committed Dec 18, 2023
2 parents 4f0da28 + ce293db commit 26c20a8
Show file tree
Hide file tree
Showing 1,299 changed files with 13,646 additions and 6,106 deletions.
4 changes: 1 addition & 3 deletions .buildkite/disabled_jest_configs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[
"x-pack/plugins/index_management/jest.config.js"
]
[]
24 changes: 0 additions & 24 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,30 +271,6 @@ steps:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows.sh
label: 'Defend Workflows Cypress Tests'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 10
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows_serverless.sh
label: 'Defend Workflows Cypress Tests on Serverless'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 6
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/threat_intelligence.sh
label: 'Threat Intelligence Cypress Tests'
agents:
Expand Down
24 changes: 24 additions & 0 deletions .buildkite/pipelines/on_merge_unsupported_ftrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,27 @@ steps:
limit: 3
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows.sh
label: 'Defend Workflows Cypress Tests'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 10
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows_serverless.sh
label: 'Defend Workflows Cypress Tests on Serverless'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 6
retry:
automatic:
- exit_status: '*'
limit: 1
24 changes: 0 additions & 24 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,30 +249,6 @@ steps:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows.sh
label: 'Defend Workflows Cypress Tests'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 16
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows_serverless.sh
label: 'Defend Workflows Cypress Tests on Serverless'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 6
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/threat_intelligence.sh
label: 'Threat Intelligence Cypress Tests'
agents:
Expand Down
24 changes: 24 additions & 0 deletions .buildkite/pipelines/pull_request/defend_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
- command: .buildkite/scripts/steps/functional/defend_workflows.sh
label: 'Defend Workflows Cypress Tests'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 16
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/defend_workflows_serverless.sh
label: 'Defend Workflows Cypress Tests on Serverless'
agents:
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 60
parallelism: 6
retry:
automatic:
- exit_status: '*'
limit: 1
13 changes: 13 additions & 0 deletions .buildkite/scripts/pipelines/pull_request/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ const uploadPipeline = (pipelineContent: string | object) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/cypress_burn.yml'));
}

if (
(await doAnyChangesMatch([
/^packages\/kbn-securitysolution-.*/,
/^x-pack\/plugins\/security_solution/,
/^x-pack\/test\/defend_workflows_cypress/,
/^x-pack\/test\/security_solution_cypress/,
/^fleet_packages\.json/,
])) ||
GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/defend_workflows.yml'));
}

pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml'));

// remove duplicated steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
getSelectedCommitHash,
getCommitByHash,
makeCommitInfoHtml,
getRecentCommits,
} from './info_sections/commit_info';
import {
getArtifactBuild,
Expand Down Expand Up @@ -45,7 +46,8 @@ async function main() {
const buildkiteBuild = await getOnMergePRBuild(selectedSha);
const nextBuildContainingCommit = await getQAFBuildContainingCommit(
selectedSha,
selectedCommitInfo.date!
selectedCommitInfo.date!,
await getRecentCommits(50)
);
const artifactBuild = await getArtifactBuild(selectedSha);
addBuildkiteInfoSection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ fi

echo "--- Creating deploy tag $DEPLOY_TAG at $KIBANA_COMMIT_SHA"

echo "Fetching user identity from GitHub..."
IDENTITY_JSON=$(ts-node .buildkite/scripts/serverless/create_deploy_tag/get_github_identity.ts)

# Set git identity to whomever triggered the buildkite job
git config user.email "$BUILDKITE_BUILD_CREATOR_EMAIL"
git config user.name "$BUILDKITE_BUILD_CREATOR"
git config user.email "${BUILDKITE_BUILD_CREATOR_EMAIL:-$(echo ${IDENTITY_JSON} | jq .email)}"
git config user.name "${BUILDKITE_BUILD_CREATOR:-$(echo ${IDENTITY_JSON} | jq .name)}"

# Create a tag for the deploy
git tag -a "$DEPLOY_TAG" "$KIBANA_COMMIT_SHA" \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.
*/

// Query the GitHub API for the user's GitHub identity
import { octokit } from './shared';

const getGitHubIdentity = async (): Promise<{
login: string;
name: string | null;
email: string | null;
}> => {
const { data } = await octokit.users.getAuthenticated();

return {
login: data.login,
name: data.name,
email: data.email,
};
};

async function main() {
try {
const identity = await getGitHubIdentity();

if (!identity.name) {
identity.name = identity.login;
}

if (!identity.email) {
identity.email = `${identity.login}@elastic.co`;
}

return identity;
} catch (error) {
console.error(error);

return {
login: 'unknown-user',
name: 'Unknown User',
email: 'unknown-user@elastic.co',
};
}
}

if (require.main === module) {
main().then((identity) => {
console.log(JSON.stringify(identity));
});
} else {
module.exports = main;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import { components } from '@octokit/openapi-types';
import { buildkite, buildkiteBuildStateToEmoji, CommitWithStatuses, octokit } from '../shared';
import { buildkite, buildkiteBuildStateToEmoji, CommitWithStatuses } from '../shared';
import { GitCommitExtract } from './commit_info';
import { Build } from '#pipeline-utils/buildkite';

const QA_FTR_TEST_SLUG = 'appex-qa-serverless-kibana-ftr-tests';
Expand Down Expand Up @@ -70,27 +70,30 @@ export async function getArtifactBuild(commitSha: string): Promise<BuildkiteBuil

export async function getQAFBuildContainingCommit(
commitSha: string,
date: string
date: string,
recentGitCommits: GitCommitExtract[]
): Promise<BuildkiteBuildExtract | null> {
// List of commits
const commitShaList = await getCommitListCached();

// List of QAF builds
const qafBuilds = await buildkite.getBuildsAfterDate(QA_FTR_TEST_SLUG, date, 30);
qafBuilds.reverse();

// Find the first build that contains this commit
const build = qafBuilds.find((kbBuild) => {
// Check if build.commit is after commitSha?
const kibanaCommitSha = tryGetKibanaBuildHashFromQAFBuild(kbBuild);
const buildkiteBuildShaIndex = commitShaList.findIndex((c) => c.sha === kibanaCommitSha);
const commitShaIndex = commitShaList.findIndex((c) => c.sha === commitSha);

return (
commitShaIndex !== -1 &&
buildkiteBuildShaIndex !== -1 &&
buildkiteBuildShaIndex < commitShaIndex
);
});
const build = qafBuilds
// Only search across scheduled builds, triggered builds might run with different commits
.filter((e) => e.source === 'schedule')
.find((kbBuild) => {
const commitShaIndex = recentGitCommits.findIndex((c) => c.sha === commitSha);

const kibanaCommitOfFTR = tryGetKibanaBuildHashFromQAFBuild(kbBuild);
const buildkiteBuildShaIndex = recentGitCommits.findIndex((c) => c.sha === kibanaCommitOfFTR);

// Check if build.commit is after commitSha?
return (
commitShaIndex !== -1 &&
buildkiteBuildShaIndex !== -1 &&
buildkiteBuildShaIndex <= commitShaIndex
);
});

if (!build) {
return null;
Expand Down Expand Up @@ -121,25 +124,6 @@ function tryGetKibanaBuildHashFromQAFBuild(build: Build) {
}
}

let _commitListCache: Array<components['schemas']['commit']> | null = null;
async function getCommitListCached() {
if (!_commitListCache) {
const resp = await octokit.request<'GET /repos/{owner}/{repo}/commits'>(
'GET /repos/{owner}/{repo}/commits',
{
owner: 'elastic',
repo: 'kibana',
headers: {
accept: 'application/vnd.github.v3+json',
'X-GitHub-Api-Version': '2022-11-28',
},
}
);
_commitListCache = resp.data;
}
return _commitListCache;
}

function makeBuildInfoSnippetHtml(name: string, build: BuildkiteBuildExtract | null) {
if (!build) {
return `[❓] ${name} - no build found`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async function enrichWithStatuses(commits: GitCommitExtract[]): Promise<CommitWi
};
}

const nextFTRBuild = await getQAFBuildContainingCommit(commit.sha, commit.date);
const nextFTRBuild = await getQAFBuildContainingCommit(commit.sha, commit.date, commits);
const artifactBuild = await getArtifactBuild(commit.sha);

return {
Expand Down
5 changes: 4 additions & 1 deletion .buildkite/scripts/serverless/create_deploy_tag/mock_exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ const loadFakeResponses = (() => {
})();

const makeMockExec = (id: string) => {
console.warn("--- Using mock exec, don't use this on CI. ---");
if (process.env?.CI?.match(/(1|true)/i)) {
throw new Error(`Mock exec is not supported in CI - your commands won't be executed.`);
}

const callStorage = getCallStorage();
const calls = callStorage[id];

Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ x-pack/plugins/cloud_integrations/cloud_links @elastic/kibana-core
x-pack/plugins/cloud @elastic/kibana-core
x-pack/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture
packages/shared-ux/code_editor @elastic/appex-sharedux
packages/kbn-code-owners @elastic/appex-qa
packages/kbn-coloring @elastic/kibana-visualizations
packages/kbn-config @elastic/kibana-core
packages/kbn-config-mocks @elastic/kibana-core
Expand Down Expand Up @@ -626,6 +627,7 @@ x-pack/test/plugin_functional/plugins/resolver_test @elastic/security-solution
examples/response_stream @elastic/ml-ui
packages/kbn-rison @elastic/kibana-operations
x-pack/plugins/rollup @elastic/platform-deployment-management
packages/kbn-router-utils @elastic/obs-ux-logs-team
examples/routing_example @elastic/kibana-core
packages/kbn-rrule @elastic/response-ops
packages/kbn-rule-data-utils @elastic/security-detections-response @elastic/response-ops @elastic/obs-ux-management-team
Expand Down
2 changes: 1 addition & 1 deletion api_docs/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions
title: "actions"
image: https://source.unsplash.com/400x175/?github
description: API docs for the actions plugin
date: 2023-12-14
date: 2023-12-18
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions']
---
import actionsObj from './actions.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/advanced_settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/advancedSettings
title: "advancedSettings"
image: https://source.unsplash.com/400x175/?github
description: API docs for the advancedSettings plugin
date: 2023-12-14
date: 2023-12-18
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings']
---
import advancedSettingsObj from './advanced_settings.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/ai_assistant_management_observability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiAssistantManagementObservability
title: "aiAssistantManagementObservability"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiAssistantManagementObservability plugin
date: 2023-12-14
date: 2023-12-18
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiAssistantManagementObservability']
---
import aiAssistantManagementObservabilityObj from './ai_assistant_management_observability.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/ai_assistant_management_selection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiAssistantManagementSelection
title: "aiAssistantManagementSelection"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiAssistantManagementSelection plugin
date: 2023-12-14
date: 2023-12-18
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiAssistantManagementSelection']
---
import aiAssistantManagementSelectionObj from './ai_assistant_management_selection.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/aiops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiops
title: "aiops"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiops plugin
date: 2023-12-14
date: 2023-12-18
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops']
---
import aiopsObj from './aiops.devdocs.json';
Expand Down
Loading

0 comments on commit 26c20a8

Please sign in to comment.