mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[scripts/report_failed_tests] fix report_failed_tests integration on CI (#71131)
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
0ea414c13a
commit
ec43d45b51
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:
|
||||
|
||||
```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.
|
||||
|
||||
```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.
|
|
@ -17,6 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Path from 'path';
|
||||
|
||||
import { REPO_ROOT, run, createFailError, createFlagError } from '@kbn/dev-utils';
|
||||
import globby from 'globby';
|
||||
|
||||
|
@ -28,6 +30,8 @@ import { readTestReport } from './test_report';
|
|||
import { addMessagesToReport } from './add_messages_to_report';
|
||||
import { getReportMessageIter } from './report_metadata';
|
||||
|
||||
const DEFAULT_PATTERNS = [Path.resolve(REPO_ROOT, 'target/junit/**/*.xml')];
|
||||
|
||||
export function runFailedTestsReporterCli() {
|
||||
run(
|
||||
async ({ log, flags }) => {
|
||||
|
@ -67,11 +71,15 @@ export function runFailedTestsReporterCli() {
|
|||
throw createFlagError('Missing --build-url or process.env.BUILD_URL');
|
||||
}
|
||||
|
||||
const reportPaths = await globby(['target/junit/**/*.xml'], {
|
||||
cwd: REPO_ROOT,
|
||||
const patterns = flags._.length ? flags._ : DEFAULT_PATTERNS;
|
||||
const reportPaths = await globby(patterns, {
|
||||
absolute: true,
|
||||
});
|
||||
|
||||
if (!reportPaths.length) {
|
||||
throw createFailError(`Unable to find any junit reports with patterns [${patterns}]`);
|
||||
}
|
||||
|
||||
const newlyCreatedIssues: Array<{
|
||||
failure: TestFailure;
|
||||
newIssue: GithubIssueMini;
|
||||
|
|
|
@ -209,7 +209,7 @@ def runErrorReporter() {
|
|||
bash(
|
||||
"""
|
||||
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"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue