Skip to content

Commit 1e16d70

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into dev/url-drilldown
# Conflicts: # x-pack/plugins/ui_actions_enhanced/public/drilldowns/index.ts
2 parents 74ac9a8 + 40ff82d commit 1e16d70

File tree

3,441 files changed

+123878
-52792
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,441 files changed

+123878
-52792
lines changed

.backportrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"targetPRLabels": ["backport"],
2727
"branchLabelMapping": {
28+
"^v8.0.0$": "master",
2829
"^v7.9.0$": "7.x",
2930
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
3031
}

.ci/packer_cache.sh

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

33
set -e
44

5-
branch="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
6-
7-
# run setup script that gives us node, yarn, and bootstraps the project
8-
source src/dev/ci_setup/setup.sh;
9-
10-
# download es snapshots
11-
node scripts/es snapshot --download-only;
12-
node scripts/es snapshot --license=oss --download-only;
13-
14-
# download reporting browsers
15-
(cd "x-pack" && yarn gulp prepare);
16-
17-
# cache the chromedriver archive
18-
chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
19-
chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
20-
if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
21-
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
22-
exit 1
23-
fi
24-
mkdir -p .chromedriver
25-
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
26-
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
27-
28-
# cache the geckodriver archive
29-
geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
30-
if [ -z "$geckodriverPkgVersion" ]; then
31-
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
32-
exit 1
33-
fi
34-
mkdir -p ".geckodriver"
35-
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
36-
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion
37-
38-
echo "Creating bootstrap_cache archive"
39-
40-
# archive cacheable directories
41-
mkdir -p "$HOME/.kibana/bootstrap_cache"
42-
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
43-
x-pack/plugins/reporting/.chromium \
44-
.es \
45-
.chromedriver \
46-
.geckodriver;
47-
48-
echo "Adding node_modules"
49-
# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
50-
find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"
51-
52-
echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
53-
54-
if [ "$branch" == "master" ]; then
55-
echo "Creating bootstrap cache for 7.x";
56-
57-
git clone https://github.com/elastic/kibana.git --branch 7.x --depth 1 /tmp/kibana-7.x
58-
(cd /tmp/kibana-7.x && ./.ci/packer_cache.sh);
59-
rm -rf /tmp/kibana-7.x;
60-
fi
5+
./.ci/packer_cache_for_branch.sh master
6+
./.ci/packer_cache_for_branch.sh 7.x

.ci/packer_cache_for_branch.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
branch="$1"
6+
checkoutDir="$(pwd)"
7+
8+
if [[ "$branch" != "master" ]]; then
9+
checkoutDir="/tmp/kibana-$branch"
10+
git clone https://github.com/elastic/kibana.git --branch "$branch" --depth 1 "$checkoutDir"
11+
cd "$checkoutDir"
12+
fi
13+
14+
source src/dev/ci_setup/setup.sh;
15+
16+
# download es snapshots
17+
node scripts/es snapshot --download-only;
18+
node scripts/es snapshot --license=oss --download-only;
19+
20+
# download reporting browsers
21+
(cd "x-pack" && yarn gulp prepare);
22+
23+
# cache the chromedriver archive
24+
chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
25+
chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
26+
if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
27+
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
28+
exit 1
29+
fi
30+
mkdir -p .chromedriver
31+
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
32+
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
33+
34+
# cache the geckodriver archive
35+
geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
36+
if [ -z "$geckodriverPkgVersion" ]; then
37+
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
38+
exit 1
39+
fi
40+
mkdir -p ".geckodriver"
41+
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
42+
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion
43+
44+
echo "Creating bootstrap_cache archive"
45+
46+
# archive cacheable directories
47+
mkdir -p "$HOME/.kibana/bootstrap_cache"
48+
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
49+
x-pack/plugins/reporting/.chromium \
50+
.es \
51+
.chromedriver \
52+
.geckodriver;
53+
54+
echo "Adding node_modules"
55+
# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
56+
find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"
57+
58+
echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
59+
60+
if [[ "$branch" != "master" ]]; then
61+
rm --preserve-root -rf "$checkoutDir"
62+
fi

.ci/pipeline-library/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies {
2020
implementation 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.19@jar'
2121
testImplementation 'com.lesfurets:jenkins-pipeline-unit:1.4'
2222
testImplementation 'junit:junit:4.12'
23+
testImplementation 'org.mockito:mockito-core:2.+'
2324
testImplementation 'org.assertj:assertj-core:3.15+' // Temporary https://github.com/jenkinsci/JenkinsPipelineUnit/issues/209
2425
}
2526

.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class KibanaBasePipelineTest extends BasePipelineTest {
1919
env.BUILD_DISPLAY_NAME = "#${env.BUILD_ID}"
2020

2121
env.JENKINS_URL = 'http://jenkins.localhost:8080'
22-
env.BUILD_URL = "${env.JENKINS_URL}/job/elastic+kibana+${env.BRANCH_NAME}/${env.BUILD_ID}/"
22+
env.BUILD_URL = "${env.JENKINS_URL}/job/elastic+kibana+${env.BRANCH_NAME}/${env.BUILD_ID}/".toString()
2323

24-
env.JOB_BASE_NAME = "elastic / kibana # ${env.BRANCH_NAME}"
24+
env.JOB_BASE_NAME = "elastic / kibana # ${env.BRANCH_NAME}".toString()
2525
env.JOB_NAME = env.JOB_BASE_NAME
2626

2727
env.WORKSPACE = 'WS'
@@ -31,6 +31,9 @@ class KibanaBasePipelineTest extends BasePipelineTest {
3131
getBuildStatus: { 'SUCCESS' },
3232
printStacktrace: { ex -> print ex },
3333
],
34+
githubPr: [
35+
isPr: { false },
36+
],
3437
jenkinsApi: [ getFailedSteps: { [] } ],
3538
testUtils: [ getFailures: { [] } ],
3639
])
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import org.junit.*
2+
import static groovy.test.GroovyAssert.*
3+
4+
class BuildStateTest extends KibanaBasePipelineTest {
5+
def buildState
6+
7+
@Before
8+
void setUp() {
9+
super.setUp()
10+
11+
buildState = loadScript("vars/buildState.groovy")
12+
}
13+
14+
@Test
15+
void 'get() returns existing data'() {
16+
buildState.add('test', 1)
17+
def actual = buildState.get('test')
18+
assertEquals(1, actual)
19+
}
20+
21+
@Test
22+
void 'get() returns null for missing data'() {
23+
def actual = buildState.get('missing_key')
24+
assertEquals(null, actual)
25+
}
26+
27+
@Test
28+
void 'add() does not overwrite existing keys'() {
29+
assertTrue(buildState.add('test', 1))
30+
assertFalse(buildState.add('test', 2))
31+
32+
def actual = buildState.get('test')
33+
34+
assertEquals(1, actual)
35+
}
36+
37+
@Test
38+
void 'set() overwrites existing keys'() {
39+
assertFalse(buildState.has('test'))
40+
buildState.set('test', 1)
41+
assertTrue(buildState.has('test'))
42+
buildState.set('test', 2)
43+
44+
def actual = buildState.get('test')
45+
46+
assertEquals(2, actual)
47+
}
48+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import org.junit.*
2+
import static org.mockito.Mockito.*;
3+
4+
class GithubCommitStatusTest extends KibanaBasePipelineTest {
5+
def githubCommitStatus
6+
def githubApiMock
7+
def buildStateMock
8+
9+
def EXPECTED_STATUS_URL = 'repos/elastic/kibana/statuses/COMMIT_HASH'
10+
def EXPECTED_CONTEXT = 'kibana-ci'
11+
def EXPECTED_BUILD_URL = 'http://jenkins.localhost:8080/job/elastic+kibana+master/1/'
12+
13+
interface BuildState {
14+
Object get(String key)
15+
}
16+
17+
interface GithubApi {
18+
Object post(String url, Map data)
19+
}
20+
21+
@Before
22+
void setUp() {
23+
super.setUp()
24+
25+
buildStateMock = mock(BuildState)
26+
githubApiMock = mock(GithubApi)
27+
28+
when(buildStateMock.get('checkoutInfo')).thenReturn([ commit: 'COMMIT_HASH', ])
29+
when(githubApiMock.post(any(), any())).thenReturn(null)
30+
31+
props([
32+
buildState: buildStateMock,
33+
githubApi: githubApiMock,
34+
])
35+
36+
githubCommitStatus = loadScript("vars/githubCommitStatus.groovy")
37+
}
38+
39+
void verifyStatusCreate(String state, String description) {
40+
verify(githubApiMock).post(
41+
EXPECTED_STATUS_URL,
42+
[
43+
'state': state,
44+
'description': description,
45+
'context': EXPECTED_CONTEXT,
46+
'target_url': EXPECTED_BUILD_URL,
47+
]
48+
)
49+
}
50+
51+
@Test
52+
void 'onStart() should create a pending status'() {
53+
githubCommitStatus.onStart()
54+
verifyStatusCreate('pending', 'Build started.')
55+
}
56+
57+
@Test
58+
void 'onFinish() should create a success status'() {
59+
githubCommitStatus.onFinish()
60+
verifyStatusCreate('success', 'Build completed successfully.')
61+
}
62+
63+
@Test
64+
void 'onFinish() should create an error status for failed builds'() {
65+
mockFailureBuild()
66+
githubCommitStatus.onFinish()
67+
verifyStatusCreate('error', 'Build failed.')
68+
}
69+
70+
@Test
71+
void 'onStart() should exit early for PRs'() {
72+
prop('githubPr', [ isPr: { true } ])
73+
74+
githubCommitStatus.onStart()
75+
verifyZeroInteractions(githubApiMock)
76+
}
77+
78+
@Test
79+
void 'onFinish() should exit early for PRs'() {
80+
prop('githubPr', [ isPr: { true } ])
81+
82+
githubCommitStatus.onFinish()
83+
verifyZeroInteractions(githubApiMock)
84+
}
85+
}

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ target
3333
/x-pack/plugins/canvas/shareable_runtime/build
3434
/x-pack/plugins/canvas/storybook
3535
/x-pack/plugins/monitoring/public/lib/jquery_flot
36+
/x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/**
3637
/x-pack/legacy/plugins/infra/common/graphql/types.ts
3738
/x-pack/legacy/plugins/infra/public/graphql/types.ts
3839
/x-pack/legacy/plugins/infra/server/graphql/types.ts

.github/CODEOWNERS

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# App
66
/x-pack/plugins/dashboard_enhanced/ @elastic/kibana-app
7+
/x-pack/plugins/discover_enhanced/ @elastic/kibana-app
78
/x-pack/plugins/lens/ @elastic/kibana-app
89
/x-pack/plugins/graph/ @elastic/kibana-app
910
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
@@ -66,11 +67,10 @@
6667

6768
# APM
6869
/x-pack/plugins/apm/ @elastic/apm-ui
69-
/x-pack/plugins/apm/ @elastic/apm-ui
7070
/x-pack/test/functional/apps/apm/ @elastic/apm-ui
7171
/src/legacy/core_plugins/apm_oss/ @elastic/apm-ui
7272
/src/plugins/apm_oss/ @elastic/apm-ui
73-
/src/apm.js @watson
73+
/src/apm.js @watson @vigneshshanmugam
7474

7575
# Beats
7676
/x-pack/legacy/plugins/beats_management/ @elastic/beats
@@ -170,13 +170,19 @@
170170

171171
# Kibana Telemetry
172172
/packages/kbn-analytics/ @elastic/kibana-telemetry
173+
/packages/kbn-telemetry-tools/ @elastic/kibana-telemetry
173174
/src/plugins/kibana_usage_collection/ @elastic/kibana-telemetry
174175
/src/plugins/newsfeed/ @elastic/kibana-telemetry
175176
/src/plugins/telemetry/ @elastic/kibana-telemetry
176177
/src/plugins/telemetry_collection_manager/ @elastic/kibana-telemetry
177178
/src/plugins/telemetry_management_section/ @elastic/kibana-telemetry
178179
/src/plugins/usage_collection/ @elastic/kibana-telemetry
179180
/x-pack/plugins/telemetry_collection_xpack/ @elastic/kibana-telemetry
181+
/.telemetryrc.json @elastic/kibana-telemetry
182+
/x-pack/.telemetryrc.json @elastic/kibana-telemetry
183+
src/plugins/telemetry/schema/legacy_oss_plugins.json @elastic/kibana-telemetry
184+
src/plugins/telemetry/schema/oss_plugins.json @elastic/kibana-telemetry
185+
x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kibana-telemetry
180186

181187
# Kibana Alerting Services
182188
/x-pack/plugins/alerts/ @elastic/kibana-alerting-services

.telemetryrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"output": "src/plugins/telemetry/schema/legacy_oss_plugins.json",
4+
"root": "src/legacy/core_plugins/",
5+
"exclude": [
6+
"src/legacy/core_plugins/testbed",
7+
"src/legacy/core_plugins/elasticsearch",
8+
"src/legacy/core_plugins/tests_bundle"
9+
]
10+
},
11+
{
12+
"output": "src/plugins/telemetry/schema/oss_plugins.json",
13+
"root": "src/plugins/",
14+
"exclude": [
15+
"src/plugins/kibana_react/",
16+
"src/plugins/testbed/",
17+
"src/plugins/kibana_utils/",
18+
"src/plugins/kibana_usage_collection/server/collectors/kibana/kibana_usage_collector.ts",
19+
"src/plugins/kibana_usage_collection/server/collectors/application_usage/telemetry_application_usage_collector.ts",
20+
"src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts",
21+
"src/plugins/kibana_usage_collection/server/collectors/ui_metric/telemetry_ui_metric_collector.ts",
22+
"src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts"
23+
]
24+
}
25+
]

0 commit comments

Comments
 (0)