Skip to content

Commit

Permalink
Merge branch 'main' into fix-mw
Browse files Browse the repository at this point in the history
  • Loading branch information
adcoelho authored Jan 23, 2025
2 parents 3008452 + cc38fbe commit 2e8c2ca
Show file tree
Hide file tree
Showing 2,123 changed files with 33,533 additions and 30,333 deletions.
5 changes: 1 addition & 4 deletions .buildkite/ftr_oblt_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ disabled:
- x-pack/solutions/observability/plugins/observability_onboarding/e2e/ftr_config.ts
- x-pack/solutions/observability/plugins/inventory/e2e/ftr_config_run.ts
- x-pack/solutions/observability/plugins/inventory/e2e/ftr_config.ts
- x-pack/solutions/observability/plugins/profiling/e2e/ftr_config_open.ts
- x-pack/solutions/observability/plugins/profiling/e2e/ftr_config_runner.ts
- x-pack/solutions/observability/plugins/profiling/e2e/ftr_config.ts

- x-pack/test/profiling_cypress/cli_config.ts
#FTR configs
- x-pack/solutions/observability/plugins/uptime/e2e/config.ts

Expand Down
27 changes: 27 additions & 0 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
"globby": "^11.1.0",
"js-yaml": "^4.1.0",
"minimatch": "^5.0.1",
"minimist": "^1.2.8",
"tslib": "*"
},
"devDependencies": {
"@types/chai": "^4.3.3",
"@types/js-yaml": "^4.0.9",
"@types/minimatch": "^3.0.5",
"@types/minimist": "^1.2.5",
"@types/mocha": "^10.0.1",
"@types/node": "^15.12.2",
"chai": "^4.3.10",
Expand Down
45 changes: 45 additions & 0 deletions .buildkite/pipeline-resource-definitions/kibana-deploy-cloud.yml
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-deploy-cloud-from-pr
description: 'Builds Kibana and initiates a Kibana cloud deployment from a PR'
links:
- url: 'https://buildkite.com/elastic/kibana-deploy-cloud-from-pr'
title: Pipeline link
spec:
type: buildkite-pipeline
system: buildkite
owner: 'group:kibana-operations'
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana / deploy cloud from PR
description: 'Builds Kibana and initiates a Kibana cloud deployment from a PR'
spec:
env:
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'false'

allow_rebuilds: false
branch_configuration: main
default_branch: main
repository: elastic/kibana
pipeline_file: .buildkite/pipelines/build_pr_and_deploy_cloud.yml
provider_settings:
build_pull_requests: true
prefix_pull_request_fork_branch_names: false
skip_pull_request_builds_for_existing_commits: true
trigger_mode: none
cancel_intermediate_builds: 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
tags:
- kibana
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
branch_configuration: main
default_branch: main
repository: elastic/kibana
pipeline_file: .buildkite/pipelines/serverless_deployment/project-build-and-deploy-pr.yml
pipeline_file: .buildkite/pipelines/serverless_deployment/build_pr_and_deploy_project.yml
provider_settings:
build_pull_requests: true
prefix_pull_request_fork_branch_names: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ spec:
pipeline_file: ".buildkite/pipelines/pointer_compression.yml"
provider_settings:
trigger_mode: none
schedules:
Daily run:
branch: main
cronline: "@daily"
teams:
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
Expand Down
52 changes: 52 additions & 0 deletions .buildkite/pipeline-utils/github/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import { Octokit, RestEndpointMethodTypes } from '@octokit/rest';

export const KIBANA_COMMENT_SIGIL = 'kbn-message-context';

const github = new Octokit({
auth: process.env.GITHUB_TOKEN,
});
Expand Down Expand Up @@ -113,6 +115,56 @@ export function addComment(
});
}

export async function upsertComment(
messageOpts: {
commentBody: string;
commentContext: string;
clearPrevious: boolean;
},
owner = process.env.GITHUB_PR_BASE_OWNER,
repo = process.env.GITHUB_PR_BASE_REPO,
prNumber: undefined | string | number = process.env.GITHUB_PR_NUMBER
) {
const { commentBody, commentContext, clearPrevious } = messageOpts;
if (!owner || !repo || !prNumber) {
throw Error(
"Couldn't retrieve Github PR info from environment variables in order to add a comment"
);
}
if (!commentContext) {
throw Error('Comment context is required when updating a comment');
}

const commentMarker = `<!-- ${KIBANA_COMMENT_SIGIL}:${commentContext} -->`;
const body = `${commentMarker}\n${commentBody}`;

const existingComment = (
await github.paginate(github.issues.listComments, {
owner,
repo,
issue_number: typeof prNumber === 'number' ? prNumber : parseInt(prNumber, 10),
})
).find((comment) => comment.body?.includes(commentMarker));

if (!existingComment) {
return addComment(body, owner, repo, prNumber);
} else if (clearPrevious) {
await github.issues.deleteComment({
owner,
repo,
comment_id: existingComment.id,
});
return addComment(body, owner, repo, prNumber);
} else {
return github.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body,
});
}
}

export function getGithubClient() {
return github;
}
82 changes: 82 additions & 0 deletions .buildkite/pipelines/build_pr_and_deploy_cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
env:
ELASTIC_PR_COMMENTS_ENABLED: 'true'
ELASTIC_GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true'
GITHUB_BUILD_COMMIT_STATUS_CONTEXT: kibana-deploy-cloud-from-pr

steps:
- group: 'Cloud Deployment'
if: "build.env('GITHUB_PR_LABELS') =~ /(ci:cloud-deploy|ci:cloud-redeploy)/"

steps:
- command: .buildkite/scripts/lifecycle/pre_build.sh
label: Pre-Build
timeout_in_minutes: 10
agents:
provider: gcp
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
machineType: n2-standard-2
retry:
automatic:
- exit_status: '*'
limit: 1

- command: |
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts \
--message "PR Cloud deployment started at: $BUILDKITE_BUILD_URL" \
--context "cloud-deploy-job" \
--clear-previous
label: Comment with job URL
agents:
provider: gcp
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
machineType: n2-standard-2
timeout_in_minutes: 5
- command: .buildkite/scripts/steps/build_kibana.sh
label: Build Kibana Distribution
agents:
provider: gcp
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
machineType: n2-standard-8
preemptible: true
diskSizeGb: 125
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"
timeout_in_minutes: 90
retry:
automatic:
- exit_status: '-1'
limit: 3

- wait: ~

- command: .buildkite/scripts/steps/cloud/build_and_deploy.sh
label: 'Build and Deploy to Cloud'
agents:
provider: gcp
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
machineType: n2-standard-2
preemptible: true
timeout_in_minutes: 30
retry:
automatic:
- exit_status: '-1'
limit: 3

- wait: ~

- command: |
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts \
--message "Cloud deployment initiated, see credentials at: $BUILDKITE_BUILD_URL" \
--context "cloud-deploy-job" \
--clear-previous
label: Comment with job URL
agents:
provider: gcp
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
machineType: n2-standard-2
timeout_in_minutes: 5
16 changes: 16 additions & 0 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,22 @@ steps:
- exit_status: '-1'
limit: 1

- command: .buildkite/scripts/steps/functional/profiling_cypress.sh
label: 'Profiling Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on: build
timeout_in_minutes: 120
parallelism: 3
retry:
automatic:
- exit_status: '-1'
limit: 1

- command: .buildkite/scripts/steps/functional/apm_cypress.sh
label: 'APM Cypress Tests'
agents:
Expand Down
19 changes: 0 additions & 19 deletions .buildkite/pipelines/on_merge_unsupported_ftrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,6 @@ steps:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/functional/profiling_cypress.sh
label: 'Profiling Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on: build
env:
PING_SLACK_TEAM: "@obs-ux-infra_services-team"
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '-1'
limit: 3
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/synthetics_plugin.sh
label: 'Synthetics @elastic/synthetics Tests'
agents:
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/pull_request/profiling_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ steps:
- check_types
- check_oas_snapshot
timeout_in_minutes: 120
parallelism: 2
parallelism: 3
retry:
automatic:
- exit_status: '-1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ steps:
limit: 1

- command: |
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts "PR Project deployment started at: $BUILDKITE_BUILD_URL"
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts \
--message "PR Project deployment started at: $BUILDKITE_BUILD_URL" \
--context "project-deploy-job" \
--clear-previous
label: Comment with job URL
agents:
provider: gcp
Expand Down Expand Up @@ -62,7 +65,10 @@ steps:
- wait: ~

- command: |
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts "Project deployed, see credentials at: $BUILDKITE_BUILD_URL"
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts \
--message "Project deployed, see credentials at: $BUILDKITE_BUILD_URL" \
--context "project-deploy-job" \
--clear-previous
label: Comment with job URL
agents:
provider: gcp
Expand Down
Loading

0 comments on commit 2e8c2ca

Please sign in to comment.