Skip to content

Commit

Permalink
Merge branch 'master' into scottybollinger/es-ts-refs
Browse files Browse the repository at this point in the history
  • Loading branch information
scottybollinger authored Jan 15, 2021
2 parents ecd726f + fc370b7 commit 865d06b
Show file tree
Hide file tree
Showing 906 changed files with 16,647 additions and 7,723 deletions.
162 changes: 82 additions & 80 deletions .ci/es-snapshots/Jenkinsfile_build_es
Original file line number Diff line number Diff line change
Expand Up @@ -25,90 +25,92 @@ def PROMOTE_WITHOUT_VERIFY = !!params.PROMOTE_WITHOUT_VERIFICATION
timeout(time: 120, unit: 'MINUTES') {
timestamps {
ansiColor('xterm') {
node(workers.label('l')) {
catchErrors {
def VERSION
def SNAPSHOT_ID
def DESTINATION

def scmVars = checkoutEs(ES_BRANCH)
def GIT_COMMIT = scmVars.GIT_COMMIT
def GIT_COMMIT_SHORT = sh(script: "git rev-parse --short ${GIT_COMMIT}", returnStdout: true).trim()

buildArchives('to-archive')

dir('to-archive') {
def now = new Date()
def date = now.format("yyyyMMdd-HHmmss")

def filesRaw = sh(script: "ls -1", returnStdout: true).trim()
def files = filesRaw
.split("\n")
.collect { filename ->
// Filename examples
// elasticsearch-oss-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
// elasticsearch-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
def parts = filename.replace("elasticsearch-oss", "oss").split("-")

VERSION = VERSION ?: parts[1]
SNAPSHOT_ID = SNAPSHOT_ID ?: "${date}_${GIT_COMMIT_SHORT}"
DESTINATION = DESTINATION ?: "${VERSION}/archives/${SNAPSHOT_ID}"

return [
filename: filename,
checksum: filename + '.sha512',
url: "https://storage.googleapis.com/kibana-ci-es-snapshots-daily/${DESTINATION}/${filename}".toString(),
version: parts[1],
platform: parts[3],
architecture: parts[4].split('\\.')[0],
license: parts[0] == 'oss' ? 'oss' : 'default',
slackNotifications.onFailure {
node(workers.label('l')) {
catchErrors {
def VERSION
def SNAPSHOT_ID
def DESTINATION

def scmVars = checkoutEs(ES_BRANCH)
def GIT_COMMIT = scmVars.GIT_COMMIT
def GIT_COMMIT_SHORT = sh(script: "git rev-parse --short ${GIT_COMMIT}", returnStdout: true).trim()

buildArchives('to-archive')

dir('to-archive') {
def now = new Date()
def date = now.format("yyyyMMdd-HHmmss")

def filesRaw = sh(script: "ls -1", returnStdout: true).trim()
def files = filesRaw
.split("\n")
.collect { filename ->
// Filename examples
// elasticsearch-oss-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
// elasticsearch-8.0.0-SNAPSHOT-linux-x86_64.tar.gz
def parts = filename.replace("elasticsearch-oss", "oss").split("-")

VERSION = VERSION ?: parts[1]
SNAPSHOT_ID = SNAPSHOT_ID ?: "${date}_${GIT_COMMIT_SHORT}"
DESTINATION = DESTINATION ?: "${VERSION}/archives/${SNAPSHOT_ID}"

return [
filename: filename,
checksum: filename + '.sha512',
url: "https://storage.googleapis.com/kibana-ci-es-snapshots-daily/${DESTINATION}/${filename}".toString(),
version: parts[1],
platform: parts[3],
architecture: parts[4].split('\\.')[0],
license: parts[0] == 'oss' ? 'oss' : 'default',
]
}

sh 'find * -exec bash -c "shasum -a 512 {} > {}.sha512" \\;'

def manifest = [
bucket: "kibana-ci-es-snapshots-daily/${DESTINATION}".toString(),
branch: ES_BRANCH,
sha: GIT_COMMIT,
sha_short: GIT_COMMIT_SHORT,
version: VERSION,
generated: now.format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")),
archives: files,
]
def manifestJson = toJSON(manifest).toString()
writeFile file: 'manifest.json', text: manifestJson

upload(DESTINATION, '*.*')

sh "cp manifest.json manifest-latest.json"
upload(VERSION, 'manifest-latest.json')
}

if (PROMOTE_WITHOUT_VERIFY) {
esSnapshots.promote(VERSION, SNAPSHOT_ID)

emailext(
to: '[email protected]',
subject: "ES snapshot promoted without verification: ${params.ES_BRANCH}",
body: '${SCRIPT,template="groovy-html.template"}',
mimeType: 'text/html',
)
} else {
build(
propagate: false,
wait: false,
job: 'elasticsearch+snapshots+verify',
parameters: [
string(name: 'branch_specifier', value: branch_specifier),
string(name: 'SNAPSHOT_VERSION', value: VERSION),
string(name: 'SNAPSHOT_ID', value: SNAPSHOT_ID),
]
}

sh 'find * -exec bash -c "shasum -a 512 {} > {}.sha512" \\;'

def manifest = [
bucket: "kibana-ci-es-snapshots-daily/${DESTINATION}".toString(),
branch: ES_BRANCH,
sha: GIT_COMMIT,
sha_short: GIT_COMMIT_SHORT,
version: VERSION,
generated: now.format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")),
archives: files,
]
def manifestJson = toJSON(manifest).toString()
writeFile file: 'manifest.json', text: manifestJson

upload(DESTINATION, '*.*')

sh "cp manifest.json manifest-latest.json"
upload(VERSION, 'manifest-latest.json')
)
}
}

if (PROMOTE_WITHOUT_VERIFY) {
esSnapshots.promote(VERSION, SNAPSHOT_ID)

emailext(
to: '[email protected]',
subject: "ES snapshot promoted without verification: ${params.ES_BRANCH}",
body: '${SCRIPT,template="groovy-html.template"}',
mimeType: 'text/html',
)
} else {
build(
propagate: false,
wait: false,
job: 'elasticsearch+snapshots+verify',
parameters: [
string(name: 'branch_specifier', value: branch_specifier),
string(name: 'SNAPSHOT_VERSION', value: VERSION),
string(name: 'SNAPSHOT_ID', value: SNAPSHOT_ID),
]
)
}
kibanaPipeline.sendMail()
}

kibanaPipeline.sendMail()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/teamcity/setup_ci_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ciStats = require('./ci_stats');
branch: process.env.GIT_BRANCH.replace(/^(refs\/heads\/|origin\/)/, ''),
commit: process.env.GIT_COMMIT,
targetBranch: process.env.GITHUB_PR_TARGET_BRANCH || null,
mergeBase: null, // TODO
mergeBase: process.env.GITHUB_PR_MERGE_BASE || null,
});
} catch (ex) {
console.error(ex);
Expand Down
6 changes: 4 additions & 2 deletions .ci/teamcity/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ fi

if is_pr; then
tc_set_env ELASTIC_APM_ACTIVE false
tc_set_env CHECKS_REPORTER_ACTIVE true
tc_set_env CHECKS_REPORTER_ACTIVE "${CI_REPORTING_ENABLED-}"

# These can be removed once we're not supporting Jenkins and TeamCity at the same time
# These are primarily used by github checks reporter and can be configured via /github_checks_api.json
tc_set_env ghprbGhRepository "elastic/kibana" # TODO?
tc_set_env ghprbActualCommit "$GITHUB_PR_TRIGGERED_SHA"
tc_set_env BUILD_URL "$TEAMCITY_BUILD_URL"

set_git_merge_base
else
tc_set_env ELASTIC_APM_ACTIVE true
tc_set_env ELASTIC_APM_ACTIVE "${CI_REPORTING_ENABLED-}"
tc_set_env CHECKS_REPORTER_ACTIVE false
fi

Expand Down
7 changes: 7 additions & 0 deletions .ci/teamcity/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,10 @@ tc_retry() {
}
tc_end_block "Retryable Step - Attempt #1"
}

set_git_merge_base() {
if [[ "${GITHUB_PR_TARGET_BRANCH-}" ]]; then
git fetch origin "$GITHUB_PR_TARGET_BRANCH"
tc_set_env GITHUB_PR_MERGE_BASE "$(git merge-base HEAD FETCH_HEAD)"
fi
}
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Bug report
about: Things break. Help us identify those things so we can fix them!
labels: bug

---

Expand Down
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Delete any items that are not applicable to this PR.
- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be whitelisted in the [cloud](https://github.com/elastic/cloud) and added to the [docker list](https://github.com/elastic/kibana/blob/c29adfef29e921cc447d2a5ed06ac2047ceab552/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puppeteer_skip_chromium_download=true
12 changes: 7 additions & 5 deletions .teamcity/src/Agents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ val StandardAgents = sizes.map { size -> size to GoogleCloudAgent {
machineType = "n2-standard-$size"
diskSizeGb = 75
diskType = GoogleCloudAgentDiskType.SSD
maxInstances = 750
} }.toMap()

val BuildAgent = GoogleCloudAgent {
sourceImageFamily = "elastic-kibana-ci-ubuntu-1804-lts"
agentPrefix = "kibana-c2-16-"
machineType = "c2-standard-16"
diskSizeGb = 250
diskType = GoogleCloudAgentDiskType.SSD
sourceImageFamily = "elastic-kibana-ci-ubuntu-1804-lts"
agentPrefix = "kibana-c2-16-"
machineType = "c2-standard-16"
diskSizeGb = 250
diskType = GoogleCloudAgentDiskType.SSD
maxInstances = 200
}

val CloudProfile = GoogleCloudProfile {
Expand Down
27 changes: 27 additions & 0 deletions .teamcity/src/Common.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext

// If set to true, github check/commit status will be reported, failed-test-reporter will run, etc.
const val ENABLE_REPORTING = false

// If set to false, jobs with triggers (scheduled, on commit, etc) will be paused
const val ENABLE_TRIGGERS = false

fun getProjectBranch(): String {
return DslContext.projectName
}

fun getCorrespondingESBranch(): String {
return getProjectBranch().replace("_teamcity", "")
}

fun areTriggersEnabled(): Boolean {
return ENABLE_TRIGGERS;
}

fun isReportingEnabled(): Boolean {
return ENABLE_REPORTING;
}

fun makeSafeId(id: String): String {
return id.replace(Regex("[^a-zA-Z0-9_]"), "_")
}
4 changes: 3 additions & 1 deletion .teamcity/src/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ val testArtifactRules = """
fun BuildType.addTestSettings() {
artifactRules += "\n" + testArtifactRules
steps {
failedTestReporter()
if(isReportingEnabled()) {
failedTestReporter()
}
}
features {
junit()
Expand Down
8 changes: 5 additions & 3 deletions .teamcity/src/builds/BaselineCi.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package builds

import addSlackNotifications
import areTriggersEnabled
import builds.default.DefaultBuild
import builds.default.DefaultSavedObjectFieldMetrics
import builds.oss.OssBuild
import dependsOn
import getProjectBranch
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
Expand All @@ -15,14 +17,14 @@ object BaselineCi : BuildType({
name = "Baseline CI"
description = "Runs builds, saved object field metrics for every commit"
type = Type.COMPOSITE
paused = true
paused = !areTriggersEnabled()

templates(KibanaTemplate)

triggers {
vcs {
branchFilter = "refs/heads/master_teamcity"
// perCheckinTriggering = true // TODO re-enable this later, it wreaks havoc when I merge upstream
branchFilter = "refs/heads/${getProjectBranch()}"
perCheckinTriggering = areTriggersEnabled()
}
}

Expand Down
5 changes: 4 additions & 1 deletion .teamcity/src/builds/HourlyCi.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package builds

import addSlackNotifications
import areTriggersEnabled
import dependsOn
import getProjectBranch
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
Expand All @@ -11,14 +13,15 @@ object HourlyCi : BuildType({
name = "Hourly CI"
description = "Runs everything in CI, hourly"
type = Type.COMPOSITE
paused = !areTriggersEnabled()

triggers {
schedule {
schedulingPolicy = cron {
hours = "*"
minutes = "0"
}
branchFilter = "refs/heads/master_teamcity"
branchFilter = "refs/heads/${getProjectBranch()}"
triggerBuild = always()
withPendingChangesOnly = true
}
Expand Down
14 changes: 8 additions & 6 deletions .teamcity/src/builds/PullRequestCi.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package builds

import builds.default.DefaultSavedObjectFieldMetrics
import dependsOn
import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId
import getProjectBranch
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.PullRequests
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests
import vcs.Kibana

object PullRequestCi : BuildType({
id = AbsoluteId("Kibana_PullRequest_CI")
id("Pull_Request")
name = "Pull Request CI"
type = Type.COMPOSITE

Expand All @@ -36,7 +35,7 @@ object PullRequestCi : BuildType({

params {
param("elastic.pull_request.enabled", "true")
param("elastic.pull_request.target_branch", "master_teamcity")
param("elastic.pull_request.target_branch", getProjectBranch())
param("elastic.pull_request.allow_org_users", "true")
param("elastic.pull_request.allowed_repo_permissions", "admin,write")
param("elastic.pull_request.allowed_list", prAllowedList.joinToString(","))
Expand Down Expand Up @@ -74,5 +73,8 @@ object PullRequestCi : BuildType({
}
}

dependsOn(FullCi)
dependsOn(
FullCi,
DefaultSavedObjectFieldMetrics
)
})
2 changes: 1 addition & 1 deletion .teamcity/src/projects/Kibana.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun Kibana(config: KibanaConfiguration = KibanaConfiguration()) : Project {
param("teamcity.ui.settings.readOnly", "true")

// https://github.com/JetBrains/teamcity-webhooks
param("teamcity.internal.webhooks.enable", "false")
param("teamcity.internal.webhooks.enable", "true")
param("teamcity.internal.webhooks.events", "BUILD_STARTED;BUILD_FINISHED;BUILD_INTERRUPTED;CHANGES_LOADED;BUILD_TYPE_ADDED_TO_QUEUE;BUILD_PROBLEMS_CHANGED")
param("teamcity.internal.webhooks.url", "https://ci-stats.kibana.dev/_teamcity_webhook")
param("teamcity.internal.webhooks.username", "automation")
Expand Down
Loading

0 comments on commit 865d06b

Please sign in to comment.