Skip to content

Commit 2237811

Browse files
Merge branch 'master' into canvas/fix-109304
2 parents 98d0005 + e64a036 commit 2237811

File tree

3,431 files changed

+66484
-82685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,431 files changed

+66484
-82685
lines changed

.buildkite/hooks/post-command

Lines changed: 0 additions & 3 deletions
This file was deleted.

.buildkite/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "kibana-buildkite",
3+
"version": "1.0.0",
4+
"private": true,
5+
"dependencies": {
6+
"kibana-buildkite-library": "elastic/kibana-buildkite-library"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
env:
2+
GITHUB_COMMIT_STATUS_ENABLED: 'true'
3+
GITHUB_COMMIT_STATUS_CONTEXT: 'buildkite/kibana-pull-request'
4+
steps:
5+
- command: .buildkite/scripts/lifecycle/pre_build.sh
6+
label: Pre-Build
7+
8+
- wait
9+
10+
- command: echo 'Hello World'
11+
label: Test
12+
13+
- wait: ~
14+
continue_on_failure: true
15+
16+
- command: .buildkite/scripts/lifecycle/post_build.sh
17+
label: Post-Build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
steps:
2+
- command: .buildkite/scripts/steps/demo_env/es_and_init.sh
3+
label: Initialize Environment and Deploy ES
4+
5+
- command: .buildkite/scripts/steps/demo_env/kibana.sh
6+
label: Build and Deploy Kibana
7+
agents:
8+
queue: c2-8
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { BuildkiteClient } = require('kibana-buildkite-library');
2+
3+
(async () => {
4+
try {
5+
const client = new BuildkiteClient();
6+
const status = await client.getCurrentBuildStatus();
7+
console.log(status.success ? 'true' : 'false');
8+
process.exit(0);
9+
} catch (ex) {
10+
if (ex.response) {
11+
console.error('HTTP Error Response Body', ex.response.data);
12+
console.error('HTTP Error Response Status', ex.response.status);
13+
}
14+
console.error(ex);
15+
process.exit(1);
16+
}
17+
})();

.buildkite/scripts/lifecycle/ci_stats.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

.buildkite/scripts/lifecycle/ci_stats_complete.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
const ciStats = require('./ci_stats');
2-
3-
// TODO - this is okay for now but should really be replaced with an API call, especially once retries are enabled
4-
const BUILD_STATUS = process.env.BUILD_FAILED === 'true' ? 'FAILURE' : 'SUCCESS';
1+
const { CiStats } = require('kibana-buildkite-library');
52

63
(async () => {
74
try {
8-
if (process.env.CI_STATS_BUILD_ID) {
9-
await ciStats.post(`/v1/build/_complete?id=${process.env.CI_STATS_BUILD_ID}`, {
10-
result: BUILD_STATUS,
11-
});
12-
}
5+
await CiStats.onComplete();
136
} catch (ex) {
147
console.error(ex);
158
process.exit(1);

.buildkite/scripts/lifecycle/ci_stats_start.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
1-
const { execSync } = require('child_process');
2-
const ciStats = require('./ci_stats');
1+
const { CiStats } = require('kibana-buildkite-library');
32

43
(async () => {
54
try {
6-
const build = await ciStats.post('/v1/build', {
7-
jenkinsJobName: process.env.BUILDKITE_PIPELINE_NAME,
8-
jenkinsJobId: process.env.BUILDKITE_BUILD_ID,
9-
jenkinsUrl: process.env.BUILDKITE_BUILD_URL,
10-
prId: process.env.GITHUB_PR_NUMBER || null,
11-
});
12-
13-
execSync(`buildkite-agent meta-data set ci_stats_build_id "${build.id}"`);
14-
15-
// TODO Will need to set MERGE_BASE for PRs
16-
17-
await ciStats.post(`/v1/git_info?buildId=${build.id}`, {
18-
branch: process.env.BUILDKITE_BRANCH.replace(/^(refs\/heads\/|origin\/)/, ''),
19-
commit: process.env.BUILDKITE_COMMIT,
20-
targetBranch:
21-
process.env.GITHUB_PR_TARGET_BRANCH ||
22-
process.env.BUILDKITE_PULL_REQUEST_BASE_BRANCH ||
23-
null,
24-
mergeBase: process.env.GITHUB_PR_MERGE_BASE || null, // TODO confirm GITHUB_PR_MERGE_BASE or switch to final var
25-
});
5+
await CiStats.onStart();
266
} catch (ex) {
277
console.error(ex);
288
process.exit(1);

.buildkite/scripts/lifecycle/commit_status_complete.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
if [[ "${GITHUB_COMMIT_STATUS_ENABLED:-}" == "true" ]]; then
66
COMMIT_STATUS=success
7-
if [[ "${BUILD_FAILED:-}" == "true" ]]; then
7+
if [[ "${BUILD_SUCCESSFUL:-}" != "true" ]]; then
88
COMMIT_STATUS=failure
99
fi
1010

.buildkite/scripts/lifecycle/post_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
set -euo pipefail
44

5-
BUILD_FAILED=$(buildkite-agent meta-data get build_failed --default "false")
6-
export BUILD_FAILED
5+
BUILD_SUCCESSFUL=$(node "$(dirname "${0}")/build_status.js")
6+
export BUILD_SUCCESSFUL
77

88
"$(dirname "${0}")/commit_status_complete.sh"
99

0 commit comments

Comments
 (0)