-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into im/index-mode-support
- Loading branch information
Showing
51 changed files
with
1,340 additions
and
983 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 70 additions & 51 deletions
121
.buildkite/pipelines/serverless_deployment/project-build-and-deploy-pr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,72 @@ | ||
agents: | ||
provider: gcp | ||
image: family/kibana-ubuntu-2004 | ||
imageProject: elastic-images-prod | ||
env: | ||
ELASTIC_PR_COMMENTS_ENABLED: 'true' | ||
GITHUB_BUILD_COMMIT_STATUS_ENABLED: 'true' | ||
GITHUB_BUILD_COMMIT_STATUS_CONTEXT: kibana-deploy-project-from-pr | ||
|
||
steps: | ||
- command: .buildkite/scripts/lifecycle/pre_build.sh | ||
label: Pre-Build | ||
timeout_in_minutes: 10 | ||
agents: | ||
machineType: n2-standard-2 | ||
retry: | ||
automatic: | ||
- exit_status: '*' | ||
limit: 1 | ||
|
||
- wait: ~ | ||
|
||
- command: .buildkite/scripts/steps/build_kibana.sh | ||
label: Build Kibana Distribution and Plugins | ||
agents: | ||
machineType: n2-standard-16 | ||
preemptible: true | ||
key: build | ||
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/artifacts/docker_image.sh | ||
label: 'Build Project Image' | ||
key: build_project_image | ||
agents: | ||
machineType: n2-standard-16 | ||
preemptible: true | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 3 | ||
|
||
- wait: ~ | ||
|
||
- command: .buildkite/scripts/steps/serverless/deploy.sh | ||
label: 'Deploy Project' | ||
agents: | ||
machineType: n2-standard-4 | ||
preemptible: true | ||
timeout_in_minutes: 10 | ||
- group: 'Project Deployment' | ||
if: "build.env('GITHUB_PR_LABELS') =~ /ci:project-deploy-(elasticsearch|observability|security)/" | ||
|
||
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 "PR Project deployment started at: $BUILDKITE_BUILD_URL" | ||
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 | ||
- wait: ~ | ||
|
||
- command: .buildkite/scripts/steps/artifacts/docker_image.sh | ||
label: 'Build Project Image' | ||
key: build_project_image | ||
agents: | ||
provider: gcp | ||
image: family/kibana-ubuntu-2004 | ||
imageProject: elastic-images-prod | ||
machineType: n2-standard-16 | ||
preemptible: true | ||
timeout_in_minutes: 60 | ||
retry: | ||
automatic: | ||
- exit_status: '-1' | ||
limit: 3 | ||
|
||
- wait: ~ | ||
- command: .buildkite/scripts/steps/serverless/deploy.sh | ||
label: 'Deploy Project' | ||
agents: | ||
provider: gcp | ||
image: family/kibana-ubuntu-2004 | ||
imageProject: elastic-images-prod | ||
machineType: n2-standard-4 | ||
preemptible: true | ||
timeout_in_minutes: 10 | ||
|
||
- wait: ~ | ||
|
||
- command: | | ||
ts-node .buildkite/scripts/lifecycle/comment_on_pr.ts "Project deployed, see credentials at: $BUILDKITE_BUILD_URL" | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { addComment } from '#pipeline-utils'; | ||
|
||
const ALLOWED_ENV_VARS = [ | ||
'BUILDKITE_BRANCH', | ||
'BUILDKITE_BUILD_ID', | ||
'BUILDKITE_BUILD_NUMBER', | ||
'BUILDKITE_BUILD_URL', | ||
'BUILDKITE_COMMIT', | ||
'BUILDKITE_PIPELINE_NAME', | ||
'BUILDKITE_PIPELINE_SLUG', | ||
'GITHUB_PR_BASE_OWNER', | ||
'GITHUB_PR_BASE_REPO', | ||
'GITHUB_PR_BRANCH', | ||
'GITHUB_PR_HEAD_SHA', | ||
'GITHUB_PR_HEAD_USER', | ||
'GITHUB_PR_LABELS', | ||
'GITHUB_PR_NUMBER', | ||
'GITHUB_PR_OWNER', | ||
'GITHUB_PR_REPO', | ||
'GITHUB_PR_TARGET_BRANCH', | ||
'GITHUB_PR_TRIGGERED_SHA', | ||
'GITHUB_PR_TRIGGER_USER', | ||
'GITHUB_PR_USER', | ||
]; | ||
const DEFAULT_MESSAGE_TEMPLATE = | ||
'🚀 Buildkite job started for PR #${GITHUB_PR_NUMBER}: ${BUILDKITE_BUILD_URL}'; | ||
|
||
export function commentOnPR() { | ||
const messageTemplate = | ||
process.argv.slice(2)?.join(' ') || | ||
process.env.JOB_START_COMMENT_TEMPLATE || | ||
DEFAULT_MESSAGE_TEMPLATE; | ||
if (messageTemplate === DEFAULT_MESSAGE_TEMPLATE) { | ||
console.log('No message template provided, using default message'); | ||
} else { | ||
console.log(`Using message template: ${messageTemplate}`); | ||
} | ||
|
||
const message = messageTemplate.replace(/\${([^}]+)}/g, (_, envVar) => { | ||
if (ALLOWED_ENV_VARS.includes(envVar)) { | ||
return process.env[envVar] || ''; | ||
} else { | ||
return '${' + envVar + '}'; | ||
} | ||
}); | ||
|
||
return addComment(message); | ||
} | ||
|
||
if (require.main === module) { | ||
commentOnPR().catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.