diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml index 61212e1fcf0a8..b9aa0e0e3727a 100755 --- a/.buildkite/pipelines/es_snapshots/verify.yml +++ b/.buildkite/pipelines/es_snapshots/verify.yml @@ -19,7 +19,7 @@ steps: - command: .buildkite/scripts/steps/build_kibana.sh label: Build Kibana Distribution and Plugins agents: - queue: c2-8 + queue: c2-16 key: build if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" diff --git a/.buildkite/pipelines/flaky_tests/pipeline.js b/.buildkite/pipelines/flaky_tests/pipeline.js new file mode 100644 index 0000000000000..1d390ed0d1b63 --- /dev/null +++ b/.buildkite/pipelines/flaky_tests/pipeline.js @@ -0,0 +1,52 @@ +const stepInput = (key, nameOfSuite) => { + return { + key: `ftsr-suite/${key}`, + text: nameOfSuite, + required: false, + default: '0', + }; +}; + +const OSS_CI_GROUPS = 12; +const XPACK_CI_GROUPS = 13; + +const inputs = [ + { + key: 'ftsr-override-count', + text: 'Override for all suites', + default: 0, + required: true, + }, + { + key: 'ftsr-concurrency', + text: 'Max concurrency per step', + default: 20, + required: true, + }, +]; + +for (let i = 1; i <= OSS_CI_GROUPS; i++) { + inputs.push(stepInput(`oss/cigroup/${i}`, `OSS CI Group ${i}`)); +} + +for (let i = 1; i <= XPACK_CI_GROUPS; i++) { + inputs.push(stepInput(`xpack/cigroup/${i}`, `Default CI Group ${i}`)); +} + +const pipeline = { + steps: [ + { + input: 'Number of Runs', + fields: inputs, + }, + { + wait: '~', + }, + { + command: '.buildkite/pipelines/flaky_tests/runner.sh', + label: 'Create pipeline', + }, + ], +}; + +console.log(JSON.stringify(pipeline, null, 2)); diff --git a/.buildkite/pipelines/flaky_tests/pipeline.sh b/.buildkite/pipelines/flaky_tests/pipeline.sh new file mode 100755 index 0000000000000..6335cd5490af0 --- /dev/null +++ b/.buildkite/pipelines/flaky_tests/pipeline.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +node .buildkite/pipelines/flaky_tests/pipeline.js | buildkite-agent pipeline upload diff --git a/.buildkite/pipelines/flaky_tests/runner.js b/.buildkite/pipelines/flaky_tests/runner.js new file mode 100644 index 0000000000000..46c390ce455ca --- /dev/null +++ b/.buildkite/pipelines/flaky_tests/runner.js @@ -0,0 +1,82 @@ +const { execSync } = require('child_process'); + +const keys = execSync('buildkite-agent meta-data keys') + .toString() + .split('\n') + .filter((k) => k.startsWith('ftsr-suite/')); + +const overrideCount = parseInt( + execSync(`buildkite-agent meta-data get 'ftsr-override-count'`).toString().trim() +); + +const concurrency = + parseInt(execSync(`buildkite-agent meta-data get 'ftsr-concurrency'`).toString().trim()) || 20; + +const testSuites = []; +for (const key of keys) { + if (!key) { + continue; + } + + const value = + overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim(); + + testSuites.push({ + key: key.replace('ftsr-suite/', ''), + count: value === '' ? defaultCount : parseInt(value), + }); +} + +const steps = []; +const pipeline = { + env: { + IGNORE_SHIP_CI_STATS_ERROR: 'true', + }, + steps: steps, +}; + +steps.push({ + command: '.buildkite/scripts/steps/build_kibana.sh', + label: 'Build Kibana Distribution and Plugins', + agents: { queue: 'c2-8' }, + key: 'build', + if: "build.env('BUILD_ID_FOR_ARTIFACTS') == null || build.env('BUILD_ID_FOR_ARTIFACTS') == ''", +}); + +for (const testSuite of testSuites) { + const TEST_SUITE = testSuite.key; + const RUN_COUNT = testSuite.count; + const UUID = TEST_SUITE + process.env.UUID; + + const JOB_PARTS = TEST_SUITE.split('/'); + const IS_XPACK = JOB_PARTS[0] === 'xpack'; + const CI_GROUP = JOB_PARTS.length > 2 ? JOB_PARTS[2] : ''; + + if (RUN_COUNT < 1) { + continue; + } + + if (IS_XPACK) { + steps.push({ + command: `CI_GROUP=${CI_GROUP} .buildkite/scripts/steps/functional/xpack_cigroup.sh`, + label: `Default CI Group ${CI_GROUP}`, + agents: { queue: 'ci-group-6' }, + depends_on: 'build', + parallelism: RUN_COUNT, + concurrency: concurrency, + concurrency_group: UUID, + }); + } else { + steps.push({ + command: `CI_GROUP=${CI_GROUP} .buildkite/scripts/steps/functional/oss_cigroup.sh`, + label: `OSS CI Group ${CI_GROUP}`, + agents: { queue: 'ci-group-4d' }, + depends_on: 'build', + parallelism: RUN_COUNT, + concurrency: concurrency, + concurrency_group: UUID, + }); + } +} + +console.log(JSON.stringify(pipeline, null, 2)); diff --git a/.buildkite/pipelines/flaky_tests/runner.sh b/.buildkite/pipelines/flaky_tests/runner.sh new file mode 100755 index 0000000000000..b541af88a408a --- /dev/null +++ b/.buildkite/pipelines/flaky_tests/runner.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +UUID="$(cat /proc/sys/kernel/random/uuid)" +export UUID + +node .buildkite/pipelines/flaky_tests/runner.js | buildkite-agent pipeline upload diff --git a/.buildkite/pipelines/hourly.yml b/.buildkite/pipelines/hourly.yml index 279c8cf96bfe3..0edba11836fcd 100644 --- a/.buildkite/pipelines/hourly.yml +++ b/.buildkite/pipelines/hourly.yml @@ -9,7 +9,7 @@ steps: - command: .buildkite/scripts/steps/build_kibana.sh label: Build Kibana Distribution and Plugins agents: - queue: c2-8 + queue: c2-16 key: build if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" @@ -98,7 +98,7 @@ steps: - command: .buildkite/scripts/steps/functional/oss_misc.sh label: 'OSS Misc Functional Tests' agents: - queue: ci-group-4d + queue: ci-group-6 depends_on: build timeout_in_minutes: 120 retry: diff --git a/.buildkite/pipelines/pull_request/apm_cypress.yml b/.buildkite/pipelines/pull_request/apm_cypress.yml new file mode 100644 index 0000000000000..8dcdc6c4b5f39 --- /dev/null +++ b/.buildkite/pipelines/pull_request/apm_cypress.yml @@ -0,0 +1,11 @@ +steps: + - command: .buildkite/scripts/steps/functional/apm_cypress.sh + label: 'APM Cypress Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml new file mode 100644 index 0000000000000..404bfb273b6f7 --- /dev/null +++ b/.buildkite/pipelines/pull_request/base.yml @@ -0,0 +1,155 @@ +steps: + - command: .buildkite/scripts/lifecycle/pre_build.sh + label: Pre-Build + + - wait + + - command: .buildkite/scripts/steps/build_kibana.sh + label: Build Kibana Distribution and Plugins + agents: + queue: c2-16 + key: build + if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" + + - command: .buildkite/scripts/steps/functional/xpack_cigroup.sh + label: 'Default CI Group' + parallelism: 13 + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + key: default-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh + label: 'Docker CI Group' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + key: default-cigroup-docker + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_cigroup.sh + label: 'OSS CI Group' + parallelism: 11 + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + key: oss-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_accessibility.sh + label: 'OSS Accessibility Tests' + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_accessibility.sh + label: 'Default Accessibility Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_firefox.sh + label: 'OSS Firefox Tests' + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_firefox.sh + label: 'Default Firefox Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_misc.sh + label: 'OSS Misc Functional Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh + label: 'Saved Object Field Metrics' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/test/jest_integration.sh + label: 'Jest Integration Tests' + agents: + queue: n2-4 + timeout_in_minutes: 120 + key: jest-integration + + - command: .buildkite/scripts/steps/test/api_integration.sh + label: 'API Integration Tests' + agents: + queue: n2-2 + timeout_in_minutes: 120 + key: api-integration + + - command: .buildkite/scripts/steps/test/jest.sh + label: 'Jest Tests' + agents: + queue: c2-16 + timeout_in_minutes: 120 + key: jest + + - command: .buildkite/scripts/steps/lint.sh + label: 'Linting' + agents: + queue: n2-2 + key: linting + + - command: .buildkite/scripts/steps/checks.sh + label: 'Checks' + agents: + queue: c2-4 + key: checks + + - command: .buildkite/scripts/steps/storybooks/build_and_upload.sh + label: 'Build Storybooks' + agents: + queue: c2-4 + key: storybooks diff --git a/.buildkite/pipelines/pull_request/post_build.yml b/.buildkite/pipelines/pull_request/post_build.yml new file mode 100644 index 0000000000000..4f252bf8abc11 --- /dev/null +++ b/.buildkite/pipelines/pull_request/post_build.yml @@ -0,0 +1,6 @@ +steps: + - wait: ~ + continue_on_failure: true + + - command: .buildkite/scripts/lifecycle/post_build.sh + label: Post-Build diff --git a/.buildkite/pipelines/pull_request/security_solution.yml b/.buildkite/pipelines/pull_request/security_solution.yml new file mode 100644 index 0000000000000..974469a700715 --- /dev/null +++ b/.buildkite/pipelines/pull_request/security_solution.yml @@ -0,0 +1,11 @@ +steps: + - command: .buildkite/scripts/steps/functional/security_solution.sh + label: 'Security Solution Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 diff --git a/.buildkite/scripts/common/env.sh b/.buildkite/scripts/common/env.sh index 21d2c9bb7a8de..ea8ebca0a7dbe 100755 --- a/.buildkite/scripts/common/env.sh +++ b/.buildkite/scripts/common/env.sh @@ -45,12 +45,20 @@ if is_pr; then export ghprbActualCommit="$BUILDKITE_COMMIT" export BUILD_URL="$BUILDKITE_BUILD_URL" - # set_git_merge_base # TODO for PRs + set_git_merge_base + + # For backwards compatibility + export PR_MERGE_BASE="$GITHUB_PR_MERGE_BASE" + export PR_TARGET_BRANCH="$GITHUB_PR_TARGET_BRANCH" else export ELASTIC_APM_ACTIVE=true export CHECKS_REPORTER_ACTIVE=false fi +# These are for backwards-compatibility +export GIT_COMMIT="${BUILDKITE_COMMIT:-}" +export GIT_BRANCH="${BUILDKITE_BRANCH:-}" + export FLEET_PACKAGE_REGISTRY_PORT=6104 export TEST_CORS_SERVER_PORT=6105 diff --git a/.buildkite/scripts/common/util.sh b/.buildkite/scripts/common/util.sh index d536f1a37acfd..a884a147577c9 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -74,3 +74,15 @@ retry() { fi done } + +set_git_merge_base() { + GITHUB_PR_MERGE_BASE="$(buildkite-agent meta-data get merge-base --default '')" + + if [[ ! "$GITHUB_PR_MERGE_BASE" ]]; then + git fetch origin "$GITHUB_PR_TARGET_BRANCH" + GITHUB_PR_MERGE_BASE="$(git merge-base HEAD FETCH_HEAD)" + buildkite-agent meta-data set merge-base "$GITHUB_PR_MERGE_BASE" + fi + + export GITHUB_PR_MERGE_BASE +} diff --git a/.buildkite/scripts/lifecycle/post_build.sh b/.buildkite/scripts/lifecycle/post_build.sh index 4577c1a9fcad4..35e5a6006ee24 100755 --- a/.buildkite/scripts/lifecycle/post_build.sh +++ b/.buildkite/scripts/lifecycle/post_build.sh @@ -8,3 +8,12 @@ export BUILD_SUCCESSFUL "$(dirname "${0}")/commit_status_complete.sh" node "$(dirname "${0}")/ci_stats_complete.js" + +if [[ "${GITHUB_PR_NUMBER:-}" ]]; then + DOCS_CHANGES_URL="https://kibana_$GITHUB_PR_NUMBER}.docs-preview.app.elstc.co/diff" + DOCS_CHANGES=$(curl --connect-timeout 10 -m 10 -sf "$DOCS_CHANGES_URL" || echo '') + + if [[ "$DOCS_CHANGES" && "$DOCS_CHANGES" != "There aren't any differences!" ]]; then + buildkite-agent meta-data set pr_comment:docs_changes:head "* [Documentation Changes](${DOCS_CHANGES_URL})" + fi +fi diff --git a/.buildkite/scripts/packer_cache.sh b/.buildkite/scripts/packer_cache.sh index 45d3dc439ff4d..617ea79c827b0 100755 --- a/.buildkite/scripts/packer_cache.sh +++ b/.buildkite/scripts/packer_cache.sh @@ -2,6 +2,7 @@ set -euo pipefail +source .buildkite/scripts/common/util.sh source .buildkite/scripts/common/env.sh source .buildkite/scripts/common/setup_node.sh diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.js b/.buildkite/scripts/pipelines/pull_request/pipeline.js new file mode 100644 index 0000000000000..068de9917c213 --- /dev/null +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.js @@ -0,0 +1,84 @@ +const execSync = require('child_process').execSync; +const fs = require('fs'); +const { areChangesSkippable, doAnyChangesMatch } = require('kibana-buildkite-library'); + +const SKIPPABLE_PATHS = [ + /^docs\//, + /^rfcs\//, + /^.ci\/.+\.yml$/, + /^.ci\/es-snapshots\//, + /^.ci\/pipeline-library\//, + /^.ci\/Jenkinsfile_[^\/]+$/, + /^\.github\//, + /\.md$/, + /^\.backportrc\.json$/, +]; + +const REQUIRED_PATHS = [ + // this file is auto-generated and changes to it need to be validated with CI + /^docs\/developer\/plugin-list.asciidoc$/, + // don't skip CI on prs with changes to plugin readme files /i is for case-insensitive matching + /\/plugins\/[^\/]+\/readme\.(md|asciidoc)$/i, +]; + +const getPipeline = (filename, removeSteps = true) => { + const str = fs.readFileSync(filename).toString(); + return removeSteps ? str.replace(/^steps:/, '') : str; +}; + +const uploadPipeline = (pipelineContent) => { + const str = + typeof pipelineContent === 'string' ? pipelineContent : JSON.stringify(pipelineContent); + + execSync('buildkite-agent pipeline upload', { + input: str, + stdio: ['pipe', 'inherit', 'inherit'], + }); +}; + +(async () => { + try { + const skippable = await areChangesSkippable(SKIPPABLE_PATHS, REQUIRED_PATHS); + + if (skippable) { + console.log('All changes in PR are skippable. Skipping CI.'); + + // Since we skip everything, including post-build, we need to at least make sure the commit status gets set + execSync('BUILD_SUCCESSFUL=true .buildkite/scripts/lifecycle/commit_status_complete.sh', { + stdio: 'inherit', + }); + process.exit(0); + } + + const pipeline = []; + + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/base.yml', false)); + + if ( + await doAnyChangesMatch([ + /^x-pack\/plugins\/security_solution/, + /^x-pack\/test\/security_solution_cypress/, + /^x-pack\/plugins\/triggers_actions_ui\/public\/application\/sections\/action_connector_form/, + /^x-pack\/plugins\/triggers_actions_ui\/public\/application\/context\/actions_connectors_context\.tsx/, + ]) + ) { + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/security_solution.yml')); + } + + // Disabled for now, these are failing/disabled in Jenkins currently as well + // if ( + // await doAnyChangesMatch([ + // /^x-pack\/plugins\/apm/, + // ]) + // ) { + // pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml')); + // } + + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml')); + + uploadPipeline(pipeline.join('\n')); + } catch (ex) { + console.error('PR pipeline generation error', ex.message); + process.exit(1); + } +})(); diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.sh b/.buildkite/scripts/pipelines/pull_request/pipeline.sh new file mode 100755 index 0000000000000..02be2acdf8588 --- /dev/null +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +node .buildkite/scripts/pipelines/pull_request/pipeline.js diff --git a/.buildkite/scripts/steps/functional/apm_cypress.sh b/.buildkite/scripts/steps/functional/apm_cypress.sh new file mode 100755 index 0000000000000..800f22c78d14c --- /dev/null +++ b/.buildkite/scripts/steps/functional/apm_cypress.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +export JOB=kibana-apm-cypress + +echo "--- APM Cypress Tests" + +cd "$XPACK_DIR" + +checks-reporter-with-killswitch "APM Cypress Tests" \ + node plugins/apm/scripts/test/e2e.js diff --git a/.buildkite/scripts/steps/functional/oss_misc.sh b/.buildkite/scripts/steps/functional/oss_misc.sh index a57a457ca189a..48be6669f321b 100755 --- a/.buildkite/scripts/steps/functional/oss_misc.sh +++ b/.buildkite/scripts/steps/functional/oss_misc.sh @@ -2,9 +2,6 @@ set -euo pipefail -# Required, at least for kbn_sample_panel_action -export BUILD_TS_REFS_DISABLE=false - source .buildkite/scripts/steps/functional/common.sh # Required, at least for plugin_functional tests diff --git a/.buildkite/scripts/steps/functional/security_solution.sh b/.buildkite/scripts/steps/functional/security_solution.sh new file mode 100755 index 0000000000000..9b2bfc7207a95 --- /dev/null +++ b/.buildkite/scripts/steps/functional/security_solution.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +export JOB=kibana-security-solution-chrome + +echo "--- Security Solution tests (Chrome)" + +cd "$XPACK_DIR" + +checks-reporter-with-killswitch "Security Solution Cypress Tests (Chrome)" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --config test/security_solution_cypress/cli_config.ts diff --git a/.buildkite/scripts/steps/storybooks/build_and_upload.js b/.buildkite/scripts/steps/storybooks/build_and_upload.js index 9d72f518837e9..f46928e1a86bf 100644 --- a/.buildkite/scripts/steps/storybooks/build_and_upload.js +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.js @@ -90,6 +90,12 @@ const upload = () => { gsutil -q -m cp -r -z js,css,html,json,map,txt,svg '*' 'gs://${STORYBOOK_BUCKET}/${STORYBOOK_DIRECTORY}/${process.env.BUILDKITE_COMMIT}/' gsutil -h "Cache-Control:no-cache, max-age=0, no-transform" cp -z html 'index.html' 'gs://${STORYBOOK_BUCKET}/${STORYBOOK_DIRECTORY}/latest/' `); + + if (process.env.BUILDKITE_PULL_REQUEST && process.env.BUILDKITE_PULL_REQUEST !== 'false') { + exec( + `buildkite-agent meta-data set pr_comment:storybooks:head '* [Storybooks Preview](${STORYBOOK_BASE_URL})'` + ); + } } finally { process.chdir(originalDirectory); } diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index d1324ba0622d5..2d43198dfd28d 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -65,12 +65,6 @@ Review important information about the {kib} 7.14.x releases. Review the following information about the 7.14.2 release. -[float] -[[known-issue-v7.14.2]] -=== Known issue - -{kib} is unable to restore *Discover* search sessions with a relative time range. When you restore the *Discover* search session, then run a new search, {kib} displays a `Your search session is still running` message. For more information, refer to {kibana-issue}101430[#101430]. - [float] [[breaking-changes-v7.14.2]] === Breaking changes diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts b/packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts index b2cc8d6d8ffb6..b2fd3de6bbbbc 100644 --- a/packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts +++ b/packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts @@ -26,7 +26,8 @@ describe('createFailureIssue()', () => { time: '2018-01-01T01:00:00Z', likelyIrrelevant: false, }, - api + api, + 'main' ); expect(api.createIssue).toMatchInlineSnapshot(` @@ -40,7 +41,7 @@ describe('createFailureIssue()', () => { this is the failure text \`\`\` - First failure: [CI Build](https://build-url) + First failure: [CI Build - main](https://build-url) ", Array [ @@ -74,7 +75,8 @@ describe('updateFailureIssue()', () => { " `, }, - api + api, + 'main' ); expect(api.editIssueBodyAndEnsureOpen).toMatchInlineSnapshot(` @@ -100,7 +102,7 @@ describe('updateFailureIssue()', () => { "calls": Array [ Array [ 1234, - "New failure: [CI Build](https://build-url)", + "New failure: [CI Build - main](https://build-url)", ], ], "results": Array [ diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failure.ts b/packages/kbn-test/src/failed_tests_reporter/report_failure.ts index c881bc39abf61..c44fae560156a 100644 --- a/packages/kbn-test/src/failed_tests_reporter/report_failure.ts +++ b/packages/kbn-test/src/failed_tests_reporter/report_failure.ts @@ -10,7 +10,12 @@ import { TestFailure } from './get_failures'; import { GithubIssueMini, GithubApi } from './github_api'; import { getIssueMetadata, updateIssueMetadata } from './issue_metadata'; -export async function createFailureIssue(buildUrl: string, failure: TestFailure, api: GithubApi) { +export async function createFailureIssue( + buildUrl: string, + failure: TestFailure, + api: GithubApi, + branch: string +) { const title = `Failing test: ${failure.classname} - ${failure.name}`; const body = updateIssueMetadata( @@ -21,7 +26,7 @@ export async function createFailureIssue(buildUrl: string, failure: TestFailure, failure.failure, '```', '', - `First failure: [CI Build](${buildUrl})`, + `First failure: [CI Build - ${branch}](${buildUrl})`, ].join('\n'), { 'test.class': failure.classname, @@ -33,7 +38,12 @@ export async function createFailureIssue(buildUrl: string, failure: TestFailure, return await api.createIssue(title, body, ['failed-test']); } -export async function updateFailureIssue(buildUrl: string, issue: GithubIssueMini, api: GithubApi) { +export async function updateFailureIssue( + buildUrl: string, + issue: GithubIssueMini, + api: GithubApi, + branch: string +) { // Increment failCount const newCount = getIssueMetadata(issue.body, 'test.failCount', 0) + 1; const newBody = updateIssueMetadata(issue.body, { @@ -41,7 +51,7 @@ export async function updateFailureIssue(buildUrl: string, issue: GithubIssueMin }); await api.editIssueBodyAndEnsureOpen(issue.number, newBody); - await api.addIssueComment(issue.number, `New failure: [CI Build](${buildUrl})`); + await api.addIssueComment(issue.number, `New failure: [CI Build - ${branch}](${buildUrl})`); return newCount; } diff --git a/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts b/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts index aca2e6838faec..f075f6ef0b75b 100644 --- a/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts +++ b/packages/kbn-test/src/failed_tests_reporter/report_failures_to_file.ts @@ -76,6 +76,12 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) { .flat() .join('\n'); + // Buildkite steps that use `parallelism` need a numerical suffix added to identify them + // We should also increment the number by one, since it's 0-based + const jobNumberSuffix = process.env.BUILDKITE_PARALLEL_JOB + ? ` #${parseInt(process.env.BUILDKITE_PARALLEL_JOB, 10) + 1}` + : ''; + const failureJSON = JSON.stringify( { ...failure, @@ -84,9 +90,7 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) { jobId: process.env.BUILDKITE_JOB_ID || '', url: process.env.BUILDKITE_BUILD_URL || '', jobName: process.env.BUILDKITE_LABEL - ? `${process.env.BUILDKITE_LABEL}${ - process.env.BUILDKITE_PARALLEL_JOB ? ` #${process.env.BUILDKITE_PARALLEL_JOB}` : '' - }` + ? `${process.env.BUILDKITE_LABEL}${jobNumberSuffix}` : '', }, null, diff --git a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts b/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts index 6c88b7408b628..31cd43eae4141 100644 --- a/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts +++ b/packages/kbn-test/src/failed_tests_reporter/run_failed_tests_reporter_cli.ts @@ -37,8 +37,8 @@ export function runFailedTestsReporterCli() { ); } + let branch: string = ''; if (updateGithub) { - let branch: string = ''; let isPr = false; if (process.env.BUILDKITE === 'true') { @@ -139,7 +139,12 @@ export function runFailedTestsReporterCli() { } if (existingIssue) { - const newFailureCount = await updateFailureIssue(buildUrl, existingIssue, githubApi); + const newFailureCount = await updateFailureIssue( + buildUrl, + existingIssue, + githubApi, + branch + ); const url = existingIssue.html_url; pushMessage(`Test has failed ${newFailureCount - 1} times on tracked branches: ${url}`); if (updateGithub) { @@ -148,7 +153,7 @@ export function runFailedTestsReporterCli() { continue; } - const newIssue = await createFailureIssue(buildUrl, failure, githubApi); + const newIssue = await createFailureIssue(buildUrl, failure, githubApi, branch); pushMessage('Test has not failed recently on tracked branches'); if (updateGithub) { pushMessage(`Created new issue: ${newIssue.html_url}`); diff --git a/x-pack/plugins/canvas/public/components/positionable/positionable.scss b/x-pack/plugins/canvas/public/components/positionable/positionable.scss index d1d927672e052..6dd0d713a0308 100644 --- a/x-pack/plugins/canvas/public/components/positionable/positionable.scss +++ b/x-pack/plugins/canvas/public/components/positionable/positionable.scss @@ -1,4 +1,3 @@ .canvasPositionable { transform-origin: center center; /* the default, only for clarity */ - transform-style: preserve-3d; }