mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
b4789e525b
commit
ef3308fafb
3 changed files with 14 additions and 6 deletions
|
@ -7,15 +7,15 @@ A little CLI that runs in CI to find the failed tests in the JUnit reports, then
|
||||||
To fetch some JUnit reports from a recent build on CI, visit its `Google Cloud Storage Upload Report` and execute the following in the JS Console:
|
To fetch some JUnit reports from a recent build on CI, visit its `Google Cloud Storage Upload Report` and execute the following in the JS Console:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
copy(`wget "${Array.from($$('a[href$=".xml"]')).filter(a => a.innerText === 'Download').map(a => a.href.replace('https://storage.cloud.google.com/', 'https://storage.googleapis.com/')).join('" "')}"`)
|
copy(`wget -x -nH --cut-dirs 5 -P "target/downloaded_junit" "${Array.from($$('a[href$=".xml"]')).filter(a => a.innerText === 'Download').map(a => a.href.replace('https://storage.cloud.google.com/', 'https://storage.googleapis.com/')).join('" "')}"`)
|
||||||
```
|
```
|
||||||
|
|
||||||
This copies a script to download the reports, which you should execute in the `test/junit` directory.
|
This copies a script to download the reports, which you should execute in the root of the Kibana repository.
|
||||||
|
|
||||||
Next, run the CLI in `--no-github-update` mode so that it doesn't actually communicate with Github and `--no-report-update` to prevent the script from mutating the reports on disk and instead log the updated report.
|
Next, run the CLI in `--no-github-update` mode so that it doesn't actually communicate with Github and `--no-report-update` to prevent the script from mutating the reports on disk and instead log the updated report.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
node scripts/report_failed_tests.js --verbose --no-github-update --no-report-update
|
node scripts/report_failed_tests.js --verbose --no-github-update --no-report-update target/downloaded_junit/**/*.xml
|
||||||
```
|
```
|
||||||
|
|
||||||
Unless you specify the `GITHUB_TOKEN` environment variable requests to read existing issues will use anonymous access which is limited to 60 requests per hour.
|
Unless you specify the `GITHUB_TOKEN` environment variable requests to read existing issues will use anonymous access which is limited to 60 requests per hour.
|
|
@ -17,6 +17,8 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import Path from 'path';
|
||||||
|
|
||||||
import { REPO_ROOT, run, createFailError, createFlagError } from '@kbn/dev-utils';
|
import { REPO_ROOT, run, createFailError, createFlagError } from '@kbn/dev-utils';
|
||||||
import globby from 'globby';
|
import globby from 'globby';
|
||||||
|
|
||||||
|
@ -28,6 +30,8 @@ import { readTestReport } from './test_report';
|
||||||
import { addMessagesToReport } from './add_messages_to_report';
|
import { addMessagesToReport } from './add_messages_to_report';
|
||||||
import { getReportMessageIter } from './report_metadata';
|
import { getReportMessageIter } from './report_metadata';
|
||||||
|
|
||||||
|
const DEFAULT_PATTERNS = [Path.resolve(REPO_ROOT, 'target/junit/**/*.xml')];
|
||||||
|
|
||||||
export function runFailedTestsReporterCli() {
|
export function runFailedTestsReporterCli() {
|
||||||
run(
|
run(
|
||||||
async ({ log, flags }) => {
|
async ({ log, flags }) => {
|
||||||
|
@ -67,11 +71,15 @@ export function runFailedTestsReporterCli() {
|
||||||
throw createFlagError('Missing --build-url or process.env.BUILD_URL');
|
throw createFlagError('Missing --build-url or process.env.BUILD_URL');
|
||||||
}
|
}
|
||||||
|
|
||||||
const reportPaths = await globby(['target/junit/**/*.xml'], {
|
const patterns = flags._.length ? flags._ : DEFAULT_PATTERNS;
|
||||||
cwd: REPO_ROOT,
|
const reportPaths = await globby(patterns, {
|
||||||
absolute: true,
|
absolute: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!reportPaths.length) {
|
||||||
|
throw createFailError(`Unable to find any junit reports with patterns [${patterns}]`);
|
||||||
|
}
|
||||||
|
|
||||||
const newlyCreatedIssues: Array<{
|
const newlyCreatedIssues: Array<{
|
||||||
failure: TestFailure;
|
failure: TestFailure;
|
||||||
newIssue: GithubIssueMini;
|
newIssue: GithubIssueMini;
|
||||||
|
|
|
@ -192,7 +192,7 @@ def runErrorReporter() {
|
||||||
bash(
|
bash(
|
||||||
"""
|
"""
|
||||||
source src/dev/ci_setup/setup_env.sh
|
source src/dev/ci_setup/setup_env.sh
|
||||||
node scripts/report_failed_tests ${dryRun}
|
node scripts/report_failed_tests ${dryRun} target/junit/**/*.xml
|
||||||
""",
|
""",
|
||||||
"Report failed tests, if necessary"
|
"Report failed tests, if necessary"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue