Skip to content

Commit

Permalink
Merge branch 'main' into 170295-pre-fill-custom-threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
maryam-saeidi authored Dec 14, 2023
2 parents 48aef85 + 5cab10b commit b036186
Show file tree
Hide file tree
Showing 885 changed files with 22,851 additions and 9,153 deletions.
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: '[email protected]',
};
}
}

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: 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-13
date: 2023-12-14
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-13
date: 2023-12-14
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-13
date: 2023-12-14
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-13
date: 2023-12-14
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-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops']
---
import aiopsObj from './aiops.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/alerting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/alerting
title: "alerting"
image: https://source.unsplash.com/400x175/?github
description: API docs for the alerting plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting']
---
import alertingObj from './alerting.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/apm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apm
title: "apm"
image: https://source.unsplash.com/400x175/?github
description: API docs for the apm plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apm']
---
import apmObj from './apm.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/apm_data_access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apmDataAccess
title: "apmDataAccess"
image: https://source.unsplash.com/400x175/?github
description: API docs for the apmDataAccess plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apmDataAccess']
---
import apmDataAccessObj from './apm_data_access.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/asset_manager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/assetManager
title: "assetManager"
image: https://source.unsplash.com/400x175/?github
description: API docs for the assetManager plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'assetManager']
---
import assetManagerObj from './asset_manager.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/banners.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/banners
title: "banners"
image: https://source.unsplash.com/400x175/?github
description: API docs for the banners plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'banners']
---
import bannersObj from './banners.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/bfetch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/bfetch
title: "bfetch"
image: https://source.unsplash.com/400x175/?github
description: API docs for the bfetch plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'bfetch']
---
import bfetchObj from './bfetch.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/canvas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/canvas
title: "canvas"
image: https://source.unsplash.com/400x175/?github
description: API docs for the canvas plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'canvas']
---
import canvasObj from './canvas.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cases
title: "cases"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cases plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cases']
---
import casesObj from './cases.devdocs.json';
Expand Down
16 changes: 3 additions & 13 deletions api_docs/charts.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2239,19 +2239,9 @@
"label": "theme",
"description": [],
"signature": [
"{ readonly chartsDefaultTheme: ",
"RecursivePartial",
"<",
"Theme",
">; readonly chartsDefaultBaseTheme: ",
"Theme",
"; chartsTheme$: ",
"Observable",
"<",
"RecursivePartial",
"<",
"{ readonly chartsDefaultBaseTheme: ",
"Theme",
">>; chartsBaseTheme$: ",
"; chartsBaseTheme$: ",
"Observable",
"<",
"Theme",
Expand Down Expand Up @@ -3403,7 +3393,7 @@
"CustomXDomain",
" | undefined>; ariaDescription?: string | undefined; ariaDescribedBy?: string | undefined; ariaLabelledBy?: string | undefined; ariaTableCaption?: string | undefined; legendAction?: \"ignore\" | undefined; legendStrategy?: ",
"LegendStrategy",
" | undefined; onLegendItemClick?: \"ignore\" | undefined; customLegend?: \"ignore\" | undefined; onLegendItemMinusClick?: \"ignore\" | undefined; onLegendItemOut?: \"ignore\" | undefined; onLegendItemOver?: \"ignore\" | undefined; onLegendItemPlusClick?: \"ignore\" | undefined; debugState?: boolean | undefined; onProjectionClick?: \"ignore\" | undefined; onElementClick?: \"ignore\" | undefined; onElementOver?: \"ignore\" | undefined; onElementOut?: \"ignore\" | undefined; onBrushEnd?: \"ignore\" | undefined; onProjectionAreaChange?: \"ignore\" | undefined; onAnnotationClick?: \"ignore\" | undefined; pointerUpdateDebounce?: number | undefined; roundHistogramBrushValues?: boolean | undefined; noResults?: React.ReactChild | React.ComponentType<{}> | undefined; legendSort?: \"ignore\" | undefined; } | undefined; }"
" | undefined; onLegendItemClick?: \"ignore\" | undefined; customLegend?: \"ignore\" | undefined; onLegendItemMinusClick?: \"ignore\" | undefined; onLegendItemOut?: \"ignore\" | undefined; onLegendItemOver?: \"ignore\" | undefined; onLegendItemPlusClick?: \"ignore\" | undefined; debugState?: boolean | undefined; onProjectionClick?: \"ignore\" | undefined; onElementClick?: \"ignore\" | undefined; onElementOver?: \"ignore\" | undefined; onElementOut?: \"ignore\" | undefined; onBrushEnd?: \"ignore\" | undefined; onResize?: \"ignore\" | undefined; onWillRender?: \"ignore\" | undefined; onProjectionAreaChange?: \"ignore\" | undefined; onAnnotationClick?: \"ignore\" | undefined; pointerUpdateDebounce?: number | undefined; roundHistogramBrushValues?: boolean | undefined; noResults?: React.ReactChild | React.ComponentType<{}> | undefined; legendSort?: \"ignore\" | undefined; } | undefined; }"
],
"path": "src/plugins/charts/common/static/overrides/settings.ts",
"deprecated": false,
Expand Down
2 changes: 1 addition & 1 deletion api_docs/charts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/charts
title: "charts"
image: https://source.unsplash.com/400x175/?github
description: API docs for the charts plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'charts']
---
import chartsObj from './charts.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cloud.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloud
title: "cloud"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloud plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloud']
---
import cloudObj from './cloud.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cloud_data_migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudDataMigration
title: "cloudDataMigration"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudDataMigration plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudDataMigration']
---
import cloudDataMigrationObj from './cloud_data_migration.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cloud_defend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudDefend
title: "cloudDefend"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudDefend plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudDefend']
---
import cloudDefendObj from './cloud_defend.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cloud_experiments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudExperiments
title: "cloudExperiments"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudExperiments plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudExperiments']
---
import cloudExperimentsObj from './cloud_experiments.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/cloud_security_posture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudSecurityPosture
title: "cloudSecurityPosture"
image: https://source.unsplash.com/400x175/?github
description: API docs for the cloudSecurityPosture plugin
date: 2023-12-13
date: 2023-12-14
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudSecurityPosture']
---
import cloudSecurityPostureObj from './cloud_security_posture.devdocs.json';
Expand Down
Loading

0 comments on commit b036186

Please sign in to comment.