Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Initial TeamCity implementation #81043

Merged
merged 51 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4d7062c
Initial TeamCity work
brianseeders Oct 19, 2020
2037198
Read ES_BUILD_JAVA from file
brianseeders Oct 19, 2020
f45e44f
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 19, 2020
55ffb67
Add bundle limits check
brianseeders Oct 19, 2020
1a96dea
Try runbld
brianseeders Oct 20, 2020
f86beae
Remove refs/heads/ prefix from runbld branch name
brianseeders Oct 20, 2020
f44d4d0
runbld
brianseeders Oct 20, 2020
5b35584
Fix script
brianseeders Oct 20, 2020
2fa4e1c
Another fix
brianseeders Oct 20, 2020
b3b83ec
Use ci-stats for slack notifications
brianseeders Oct 20, 2020
5606097
Update runbld invocation and move more steps to runbld
brianseeders Oct 20, 2020
d665518
Remove accidental RUN_ON_FAILURE
brianseeders Oct 20, 2020
26b5c58
Update slack channel default
brianseeders Oct 20, 2020
f89b3f7
Wrap all build tasks in runbld
brianseeders Oct 20, 2020
1dadd7e
Fix runbld heredoc
brianseeders Oct 21, 2020
72332a4
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 21, 2020
4b7cf67
Try making most test steps retry
brianseeders Oct 21, 2020
982b5bd
Fix a couple of unbound vars
brianseeders Oct 21, 2020
7c5f289
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 21, 2020
100353c
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 22, 2020
377c76c
Move PR config to build config
brianseeders Oct 22, 2020
0251da6
Add target_branch to PR config
brianseeders Oct 22, 2020
821ded6
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 26, 2020
8ffd9e2
Make sure PR check is backwards-compatible
brianseeders Oct 26, 2020
609e9f9
Remove test
brianseeders Oct 26, 2020
9793494
Add a comment for unclear one-liner
brianseeders Oct 26, 2020
9444758
Update teamcity docs a little bit
brianseeders Oct 26, 2020
6bb4488
Add TeamCity CODEOWNERS
brianseeders Oct 26, 2020
2be995a
Fix PR builds
brianseeders Oct 29, 2020
43d43b1
Try disabling the PR feature for now
brianseeders Oct 29, 2020
15b86a1
Re-enable PR feature
brianseeders Oct 29, 2020
c80b3aa
Add PR feature to all builds
brianseeders Oct 29, 2020
c7c1e5a
Remove Kibana project temporarily
brianseeders Oct 29, 2020
96f8ea7
Revert "Remove Kibana project temporarily"
brianseeders Oct 29, 2020
40a728f
Remove PR feature
brianseeders Oct 29, 2020
b1b8e7f
Add PR feature back in
brianseeders Oct 29, 2020
e8de1ea
Add branchFilter to triggers
brianseeders Oct 29, 2020
46d84f8
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Oct 30, 2020
58f2c3c
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Nov 9, 2020
77b352f
Add server integration tests
brianseeders Nov 9, 2020
60909b7
Remove lock file symlinks check
brianseeders Nov 9, 2020
3d7913e
Replace grunt call with FTR one-liner
brianseeders Nov 9, 2020
7cd016b
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Nov 16, 2020
4d80be1
Merge branch 'master' of github.com:elastic/kibana into master_teamcity
spalger Nov 16, 2020
1c681aa
Sync up with other changes from master
brianseeders Nov 16, 2020
4f4b9ef
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Nov 16, 2020
ff13a52
Fix tc_retry return status
brianseeders Nov 16, 2020
08c6543
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Nov 18, 2020
5cc240d
Bring over changes from master
brianseeders Nov 18, 2020
3ec448c
Merge remote-tracking branch 'upstream/master' into master_teamcity
brianseeders Nov 19, 2020
1c72150
A little bit of cleanup
brianseeders Nov 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .ci/teamcity/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/util.sh"

tc_start_block "Bootstrap"

tc_start_block "yarn install and kbn bootstrap"
verify_no_git_changes yarn kbn bootstrap --prefer-offline
tc_end_block "yarn install and kbn bootstrap"

tc_start_block "build kbn-pm"
verify_no_git_changes yarn kbn run build -i @kbn/pm
tc_end_block "build kbn-pm"

tc_start_block "build plugin list docs"
verify_no_git_changes node scripts/build_plugin_list_docs
tc_end_block "build plugin list docs"

tc_end_block "Bootstrap"
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/bundle_limits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

node scripts/build_kibana_platform_plugins --validate-limits
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/doc_api_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkDocApiChanges
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/file_casing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkFileCasing
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/i18n.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:i18nCheck
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/licenses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:licenses
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/telemetry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:telemetryCheck
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/test_hardening.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:test_hardening
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/ts_projects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:checkTsProjects
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/type_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:typeCheck
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/verify_dependency_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:verifyDependencyVersions
7 changes: 7 additions & 0 deletions .ci/teamcity/checks/verify_notice.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

yarn run grunt run:verifyNotice
59 changes: 59 additions & 0 deletions .ci/teamcity/ci_stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const https = require('https');
const token = process.env.CI_STATS_TOKEN;
const host = process.env.CI_STATS_HOST;

const request = (url, options, data = null) => {
const httpOptions = {
...options,
headers: {
...(options.headers || {}),
Authorization: `token ${token}`,
},
};

return new Promise((resolve, reject) => {
console.log(`Calling https://${host}${url}`);

const req = https.request(`https://${host}${url}`, httpOptions, (res) => {
if (res.statusCode < 200 || res.statusCode >= 300) {
return reject(new Error(`Status Code: ${res.statusCode}`));
}

const data = [];
res.on('data', (d) => {
data.push(d);
})

res.on('end', () => {
try {
let resp = Buffer.concat(data).toString();

try {
if (resp.trim()) {
resp = JSON.parse(resp);
}
} catch (ex) {
console.error(ex);
}

resolve(resp);
} catch (ex) {
reject(ex);
}
});
})

req.on('error', reject);

if (data) {
req.write(JSON.stringify(data));
}

req.end();
});
}

module.exports = {
get: (url) => request(url, { method: 'GET' }),
post: (url, data) => request(url, { method: 'POST' }, data),
}
18 changes: 18 additions & 0 deletions .ci/teamcity/ci_stats_complete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const ciStats = require('./ci_stats');

// This might be better as an API call in the future.
// Instead, it relies on a separate step setting the BUILD_STATUS env var. BUILD_STATUS is not something provided by TeamCity.
const BUILD_STATUS = process.env.BUILD_STATUS === 'SUCCESS' ? 'SUCCESS' : 'FAILURE';

(async () => {
try {
if (process.env.CI_STATS_BUILD_ID) {
await ciStats.post(`/v1/build/_complete?id=${process.env.CI_STATS_BUILD_ID}`, {
result: BUILD_STATUS,
});
}
} catch (ex) {
console.error(ex);
process.exit(1);
}
})();
16 changes: 16 additions & 0 deletions .ci/teamcity/default/accessibility.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-default-accessibility
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-default"

cd "$XPACK_DIR"

checks-reporter-with-killswitch "X-Pack accessibility tests" \
node scripts/functional_tests \
--debug --bail \
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
--config test/accessibility/config.ts
31 changes: 31 additions & 0 deletions .ci/teamcity/default/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

tc_start_block "Build Platform Plugins"
node scripts/build_kibana_platform_plugins \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \
--scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \
--verbose
tc_end_block "Build Platform Plugins"

export KBN_NP_PLUGINS_BUILT=true

tc_start_block "Build Default Distribution"

cd "$KIBANA_DIR"
node scripts/build --debug --no-oss
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
installDir="$KIBANA_DIR/install/kibana"
mkdir -p "$installDir"
tar -xzf "$linuxBuild" -C "$installDir" --strip=1

tc_end_block "Build Default Distribution"
20 changes: 20 additions & 0 deletions .ci/teamcity/default/build_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

tc_start_block "Build Platform Plugins"
node scripts/build_kibana_platform_plugins \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \
--scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \
--verbose
tc_end_block "Build Platform Plugins"

tc_set_env KBN_NP_PLUGINS_BUILT true
17 changes: 17 additions & 0 deletions .ci/teamcity/default/ci_group.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export CI_GROUP="$1"
export JOB=kibana-default-ciGroup${CI_GROUP}
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-default"

cd "$XPACK_DIR"

checks-reporter-with-killswitch "Default Distro Chrome Functional tests / Group ${CI_GROUP}" \
node scripts/functional_tests \
--debug --bail \
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
--include-tag "ciGroup$CI_GROUP"
18 changes: 18 additions & 0 deletions .ci/teamcity/default/firefox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-default-firefoxSmoke
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-default"

cd "$XPACK_DIR"

checks-reporter-with-killswitch "X-Pack firefox smoke test" \
node scripts/functional_tests \
--debug --bail \
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
--include-tag "includeFirefox" \
--config test/functional/config.firefox.js \
--config test/functional_embedded/config.firefox.ts
16 changes: 16 additions & 0 deletions .ci/teamcity/default/saved_object_field_metrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-default-savedObjectFieldMetrics
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-default"

cd "$XPACK_DIR"

checks-reporter-with-killswitch "Capture Kibana Saved Objects field count metrics" \
node scripts/functional_tests \
--debug --bail \
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
--config test/saved_objects_field_count/config.ts
16 changes: 16 additions & 0 deletions .ci/teamcity/default/security_solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

export JOB=kibana-default-securitySolution
export KIBANA_INSTALL_DIR="$PARENT_DIR/build/kibana-build-default"

cd "$XPACK_DIR"

checks-reporter-with-killswitch "Security Solution Cypress Tests" \
node scripts/functional_tests \
--debug --bail \
--kibana-install-dir "$KIBANA_INSTALL_DIR" \
--config test/security_solution_cypress/cli_config.ts
45 changes: 45 additions & 0 deletions .ci/teamcity/es_snapshots/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -euo pipefail

source "$(dirname "${0}")/../util.sh"

cd ..
destination="$(pwd)/es-build"
mkdir -p "$destination"

cd elasticsearch

# These turn off automation in the Elasticsearch repo
export BUILD_NUMBER=""
export JENKINS_URL=""
export BUILD_URL=""
export JOB_NAME=""
export NODE_NAME=""

# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it
export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)"

export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH"
export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"

tc_start_block "Build Elasticsearch"
./gradlew -Dbuild.docker=true assemble --parallel
tc_end_block "Build Elasticsearch"

tc_start_block "Create distribution archives"
find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elasticsearch-*-*-*-*.zip' \) -not -path '*no-jdk*' -not -path '*build-context*' -exec cp {} "$destination" \;
tc_end_block "Create distribution archives"

ls -alh "$destination"

tc_start_block "Create docker image archives"
docker images "docker.elastic.co/elasticsearch/elasticsearch"
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
tc_end_block "Create docker image archives"

cd "$destination"

find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \;
ls -alh "$destination"
Loading