Skip to content

Commit f1bd9e7

Browse files
Merge branch 'master' into discover-ssource-fields
2 parents 0eec11a + d37852a commit f1bd9e7

File tree

267 files changed

+5118
-3062
lines changed

Some content is hidden

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

267 files changed

+5118
-3062
lines changed

.ci/es-snapshots/Jenkinsfile_build_es

Lines changed: 82 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -25,90 +25,92 @@ def PROMOTE_WITHOUT_VERIFY = !!params.PROMOTE_WITHOUT_VERIFICATION
2525
timeout(time: 120, unit: 'MINUTES') {
2626
timestamps {
2727
ansiColor('xterm') {
28-
node(workers.label('l')) {
29-
catchErrors {
30-
def VERSION
31-
def SNAPSHOT_ID
32-
def DESTINATION
33-
34-
def scmVars = checkoutEs(ES_BRANCH)
35-
def GIT_COMMIT = scmVars.GIT_COMMIT
36-
def GIT_COMMIT_SHORT = sh(script: "git rev-parse --short ${GIT_COMMIT}", returnStdout: true).trim()
37-
38-
buildArchives('to-archive')
39-
40-
dir('to-archive') {
41-
def now = new Date()
42-
def date = now.format("yyyyMMdd-HHmmss")
43-
44-
def filesRaw = sh(script: "ls -1", returnStdout: true).trim()
45-
def files = filesRaw
46-
.split("\n")
47-
.collect { filename ->
48-
// Filename examples
49-
// elasticsearch-oss-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
50-
// elasticsearch-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
51-
def parts = filename.replace("elasticsearch-oss", "oss").split("-")
52-
53-
VERSION = VERSION ?: parts[1]
54-
SNAPSHOT_ID = SNAPSHOT_ID ?: "${date}_${GIT_COMMIT_SHORT}"
55-
DESTINATION = DESTINATION ?: "${VERSION}/archives/${SNAPSHOT_ID}"
56-
57-
return [
58-
filename: filename,
59-
checksum: filename + '.sha512',
60-
url: "https://storage.googleapis.com/kibana-ci-es-snapshots-daily/${DESTINATION}/${filename}".toString(),
61-
version: parts[1],
62-
platform: parts[3],
63-
architecture: parts[4].split('\\.')[0],
64-
license: parts[0] == 'oss' ? 'oss' : 'default',
28+
slackNotifications.onFailure {
29+
node(workers.label('l')) {
30+
catchErrors {
31+
def VERSION
32+
def SNAPSHOT_ID
33+
def DESTINATION
34+
35+
def scmVars = checkoutEs(ES_BRANCH)
36+
def GIT_COMMIT = scmVars.GIT_COMMIT
37+
def GIT_COMMIT_SHORT = sh(script: "git rev-parse --short ${GIT_COMMIT}", returnStdout: true).trim()
38+
39+
buildArchives('to-archive')
40+
41+
dir('to-archive') {
42+
def now = new Date()
43+
def date = now.format("yyyyMMdd-HHmmss")
44+
45+
def filesRaw = sh(script: "ls -1", returnStdout: true).trim()
46+
def files = filesRaw
47+
.split("\n")
48+
.collect { filename ->
49+
// Filename examples
50+
// elasticsearch-oss-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
51+
// elasticsearch-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
52+
def parts = filename.replace("elasticsearch-oss", "oss").split("-")
53+
54+
VERSION = VERSION ?: parts[1]
55+
SNAPSHOT_ID = SNAPSHOT_ID ?: "${date}_${GIT_COMMIT_SHORT}"
56+
DESTINATION = DESTINATION ?: "${VERSION}/archives/${SNAPSHOT_ID}"
57+
58+
return [
59+
filename: filename,
60+
checksum: filename + '.sha512',
61+
url: "https://storage.googleapis.com/kibana-ci-es-snapshots-daily/${DESTINATION}/${filename}".toString(),
62+
version: parts[1],
63+
platform: parts[3],
64+
architecture: parts[4].split('\\.')[0],
65+
license: parts[0] == 'oss' ? 'oss' : 'default',
66+
]
67+
}
68+
69+
sh 'find * -exec bash -c "shasum -a 512 {} > {}.sha512" \\;'
70+
71+
def manifest = [
72+
bucket: "kibana-ci-es-snapshots-daily/${DESTINATION}".toString(),
73+
branch: ES_BRANCH,
74+
sha: GIT_COMMIT,
75+
sha_short: GIT_COMMIT_SHORT,
76+
version: VERSION,
77+
generated: now.format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")),
78+
archives: files,
79+
]
80+
def manifestJson = toJSON(manifest).toString()
81+
writeFile file: 'manifest.json', text: manifestJson
82+
83+
upload(DESTINATION, '*.*')
84+
85+
sh "cp manifest.json manifest-latest.json"
86+
upload(VERSION, 'manifest-latest.json')
87+
}
88+
89+
if (PROMOTE_WITHOUT_VERIFY) {
90+
esSnapshots.promote(VERSION, SNAPSHOT_ID)
91+
92+
emailext(
93+
to: 'build-kibana@elastic.co',
94+
subject: "ES snapshot promoted without verification: ${params.ES_BRANCH}",
95+
body: '${SCRIPT,template="groovy-html.template"}',
96+
mimeType: 'text/html',
97+
)
98+
} else {
99+
build(
100+
propagate: false,
101+
wait: false,
102+
job: 'elasticsearch+snapshots+verify',
103+
parameters: [
104+
string(name: 'branch_specifier', value: branch_specifier),
105+
string(name: 'SNAPSHOT_VERSION', value: VERSION),
106+
string(name: 'SNAPSHOT_ID', value: SNAPSHOT_ID),
65107
]
66-
}
67-
68-
sh 'find * -exec bash -c "shasum -a 512 {} > {}.sha512" \\;'
69-
70-
def manifest = [
71-
bucket: "kibana-ci-es-snapshots-daily/${DESTINATION}".toString(),
72-
branch: ES_BRANCH,
73-
sha: GIT_COMMIT,
74-
sha_short: GIT_COMMIT_SHORT,
75-
version: VERSION,
76-
generated: now.format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")),
77-
archives: files,
78-
]
79-
def manifestJson = toJSON(manifest).toString()
80-
writeFile file: 'manifest.json', text: manifestJson
81-
82-
upload(DESTINATION, '*.*')
83-
84-
sh "cp manifest.json manifest-latest.json"
85-
upload(VERSION, 'manifest-latest.json')
108+
)
109+
}
86110
}
87111

88-
if (PROMOTE_WITHOUT_VERIFY) {
89-
esSnapshots.promote(VERSION, SNAPSHOT_ID)
90-
91-
emailext(
92-
to: 'build-kibana@elastic.co',
93-
subject: "ES snapshot promoted without verification: ${params.ES_BRANCH}",
94-
body: '${SCRIPT,template="groovy-html.template"}',
95-
mimeType: 'text/html',
96-
)
97-
} else {
98-
build(
99-
propagate: false,
100-
wait: false,
101-
job: 'elasticsearch+snapshots+verify',
102-
parameters: [
103-
string(name: 'branch_specifier', value: branch_specifier),
104-
string(name: 'SNAPSHOT_VERSION', value: VERSION),
105-
string(name: 'SNAPSHOT_ID', value: SNAPSHOT_ID),
106-
]
107-
)
108-
}
112+
kibanaPipeline.sendMail()
109113
}
110-
111-
kibanaPipeline.sendMail()
112114
}
113115
}
114116
}

.ci/teamcity/setup_ci_stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ciStats = require('./ci_stats');
2424
branch: process.env.GIT_BRANCH.replace(/^(refs\/heads\/|origin\/)/, ''),
2525
commit: process.env.GIT_COMMIT,
2626
targetBranch: process.env.GITHUB_PR_TARGET_BRANCH || null,
27-
mergeBase: null, // TODO
27+
mergeBase: process.env.GITHUB_PR_MERGE_BASE || null,
2828
});
2929
} catch (ex) {
3030
console.error(ex);

.ci/teamcity/setup_env.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ fi
3333

3434
if is_pr; then
3535
tc_set_env ELASTIC_APM_ACTIVE false
36-
tc_set_env CHECKS_REPORTER_ACTIVE true
36+
tc_set_env CHECKS_REPORTER_ACTIVE "${CI_REPORTING_ENABLED-}"
3737

3838
# These can be removed once we're not supporting Jenkins and TeamCity at the same time
3939
# These are primarily used by github checks reporter and can be configured via /github_checks_api.json
4040
tc_set_env ghprbGhRepository "elastic/kibana" # TODO?
4141
tc_set_env ghprbActualCommit "$GITHUB_PR_TRIGGERED_SHA"
4242
tc_set_env BUILD_URL "$TEAMCITY_BUILD_URL"
43+
44+
set_git_merge_base
4345
else
44-
tc_set_env ELASTIC_APM_ACTIVE true
46+
tc_set_env ELASTIC_APM_ACTIVE "${CI_REPORTING_ENABLED-}"
4547
tc_set_env CHECKS_REPORTER_ACTIVE false
4648
fi
4749

.ci/teamcity/util.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,10 @@ tc_retry() {
7979
}
8080
tc_end_block "Retryable Step - Attempt #1"
8181
}
82+
83+
set_git_merge_base() {
84+
if [[ "${GITHUB_PR_TARGET_BRANCH-}" ]]; then
85+
git fetch origin "$GITHUB_PR_TARGET_BRANCH"
86+
tc_set_env GITHUB_PR_MERGE_BASE "$(git merge-base HEAD FETCH_HEAD)"
87+
fi
88+
}

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: Bug report
33
about: Things break. Help us identify those things so we can fix them!
4+
labels: bug
45

56
---
67

.teamcity/src/Agents.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ val StandardAgents = sizes.map { size -> size to GoogleCloudAgent {
1010
machineType = "n2-standard-$size"
1111
diskSizeGb = 75
1212
diskType = GoogleCloudAgentDiskType.SSD
13+
maxInstances = 750
1314
} }.toMap()
1415

1516
val BuildAgent = GoogleCloudAgent {
16-
sourceImageFamily = "elastic-kibana-ci-ubuntu-1804-lts"
17-
agentPrefix = "kibana-c2-16-"
18-
machineType = "c2-standard-16"
19-
diskSizeGb = 250
20-
diskType = GoogleCloudAgentDiskType.SSD
17+
sourceImageFamily = "elastic-kibana-ci-ubuntu-1804-lts"
18+
agentPrefix = "kibana-c2-16-"
19+
machineType = "c2-standard-16"
20+
diskSizeGb = 250
21+
diskType = GoogleCloudAgentDiskType.SSD
22+
maxInstances = 200
2123
}
2224

2325
val CloudProfile = GoogleCloudProfile {

.teamcity/src/Common.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
2+
3+
// If set to true, github check/commit status will be reported, failed-test-reporter will run, etc.
4+
const val ENABLE_REPORTING = false
5+
6+
// If set to false, jobs with triggers (scheduled, on commit, etc) will be paused
7+
const val ENABLE_TRIGGERS = false
8+
9+
fun getProjectBranch(): String {
10+
return DslContext.projectName
11+
}
12+
13+
fun getCorrespondingESBranch(): String {
14+
return getProjectBranch().replace("_teamcity", "")
15+
}
16+
17+
fun areTriggersEnabled(): Boolean {
18+
return ENABLE_TRIGGERS;
19+
}
20+
21+
fun isReportingEnabled(): Boolean {
22+
return ENABLE_REPORTING;
23+
}
24+
25+
fun makeSafeId(id: String): String {
26+
return id.replace(Regex("[^a-zA-Z0-9_]"), "_")
27+
}

.teamcity/src/Extensions.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ val testArtifactRules = """
3939
fun BuildType.addTestSettings() {
4040
artifactRules += "\n" + testArtifactRules
4141
steps {
42-
failedTestReporter()
42+
if(isReportingEnabled()) {
43+
failedTestReporter()
44+
}
4345
}
4446
features {
4547
junit()

.teamcity/src/builds/BaselineCi.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package builds
22

33
import addSlackNotifications
4+
import areTriggersEnabled
45
import builds.default.DefaultBuild
56
import builds.default.DefaultSavedObjectFieldMetrics
67
import builds.oss.OssBuild
78
import dependsOn
9+
import getProjectBranch
810
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
911
import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction
1012
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
@@ -15,14 +17,14 @@ object BaselineCi : BuildType({
1517
name = "Baseline CI"
1618
description = "Runs builds, saved object field metrics for every commit"
1719
type = Type.COMPOSITE
18-
paused = true
20+
paused = !areTriggersEnabled()
1921

2022
templates(KibanaTemplate)
2123

2224
triggers {
2325
vcs {
24-
branchFilter = "refs/heads/master_teamcity"
25-
// perCheckinTriggering = true // TODO re-enable this later, it wreaks havoc when I merge upstream
26+
branchFilter = "refs/heads/${getProjectBranch()}"
27+
perCheckinTriggering = areTriggersEnabled()
2628
}
2729
}
2830

.teamcity/src/builds/HourlyCi.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package builds
22

33
import addSlackNotifications
4+
import areTriggersEnabled
45
import dependsOn
6+
import getProjectBranch
57
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
68
import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction
79
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
@@ -11,14 +13,15 @@ object HourlyCi : BuildType({
1113
name = "Hourly CI"
1214
description = "Runs everything in CI, hourly"
1315
type = Type.COMPOSITE
16+
paused = !areTriggersEnabled()
1417

1518
triggers {
1619
schedule {
1720
schedulingPolicy = cron {
1821
hours = "*"
1922
minutes = "0"
2023
}
21-
branchFilter = "refs/heads/master_teamcity"
24+
branchFilter = "refs/heads/${getProjectBranch()}"
2225
triggerBuild = always()
2326
withPendingChangesOnly = true
2427
}

0 commit comments

Comments
 (0)