|
3 | 3 | library 'kibana-pipeline-library' |
4 | 4 | kibanaLibrary.load() // load from the Jenkins instance |
5 | 5 |
|
6 | | -stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a little bit |
7 | | - timeout(time: 180, unit: 'MINUTES') { |
8 | | - timestamps { |
9 | | - ansiColor('xterm') { |
10 | | - catchError { |
| 6 | +kibanaPipeline(timeoutMinutes: 180) { |
| 7 | + catchErrors { |
| 8 | + withEnv([ |
| 9 | + 'CODE_COVERAGE=1', // Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc. |
| 10 | + ]) { |
| 11 | + parallel([ |
| 12 | + 'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'), |
| 13 | + 'x-pack-intake-agent': { |
11 | 14 | withEnv([ |
12 | | - 'CODE_COVERAGE=1', // Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc. |
| 15 | + 'NODE_ENV=test' // Needed for jest tests only |
13 | 16 | ]) { |
14 | | - parallel([ |
15 | | - 'kibana-intake-agent': { |
16 | | - kibanaPipeline.intakeWorker('kibana-intake', './test/scripts/jenkins_unit.sh')() |
17 | | - }, |
18 | | - 'x-pack-intake-agent': { |
19 | | - withEnv([ |
20 | | - 'NODE_ENV=test' // Needed for jest tests only |
21 | | - ]) { |
22 | | - kibanaPipeline.intakeWorker('x-pack-intake', './test/scripts/jenkins_xpack.sh')() |
23 | | - } |
24 | | - }, |
25 | | - 'kibana-oss-agent': kibanaPipeline.withWorkers('kibana-oss-tests', { kibanaPipeline.buildOss() }, [ |
26 | | - 'oss-ciGroup1': kibanaPipeline.getOssCiGroupWorker(1), |
27 | | - 'oss-ciGroup2': kibanaPipeline.getOssCiGroupWorker(2), |
28 | | - 'oss-ciGroup3': kibanaPipeline.getOssCiGroupWorker(3), |
29 | | - 'oss-ciGroup4': kibanaPipeline.getOssCiGroupWorker(4), |
30 | | - 'oss-ciGroup5': kibanaPipeline.getOssCiGroupWorker(5), |
31 | | - 'oss-ciGroup6': kibanaPipeline.getOssCiGroupWorker(6), |
32 | | - 'oss-ciGroup7': kibanaPipeline.getOssCiGroupWorker(7), |
33 | | - 'oss-ciGroup8': kibanaPipeline.getOssCiGroupWorker(8), |
34 | | - 'oss-ciGroup9': kibanaPipeline.getOssCiGroupWorker(9), |
35 | | - 'oss-ciGroup10': kibanaPipeline.getOssCiGroupWorker(10), |
36 | | - 'oss-ciGroup11': kibanaPipeline.getOssCiGroupWorker(11), |
37 | | - 'oss-ciGroup12': kibanaPipeline.getOssCiGroupWorker(12), |
38 | | - ]), |
39 | | - 'kibana-xpack-agent': kibanaPipeline.withWorkers('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [ |
40 | | - 'xpack-ciGroup1': kibanaPipeline.getXpackCiGroupWorker(1), |
41 | | - 'xpack-ciGroup2': kibanaPipeline.getXpackCiGroupWorker(2), |
42 | | - 'xpack-ciGroup3': kibanaPipeline.getXpackCiGroupWorker(3), |
43 | | - 'xpack-ciGroup4': kibanaPipeline.getXpackCiGroupWorker(4), |
44 | | - 'xpack-ciGroup5': kibanaPipeline.getXpackCiGroupWorker(5), |
45 | | - 'xpack-ciGroup6': kibanaPipeline.getXpackCiGroupWorker(6), |
46 | | - 'xpack-ciGroup7': kibanaPipeline.getXpackCiGroupWorker(7), |
47 | | - 'xpack-ciGroup8': kibanaPipeline.getXpackCiGroupWorker(8), |
48 | | - 'xpack-ciGroup9': kibanaPipeline.getXpackCiGroupWorker(9), |
49 | | - 'xpack-ciGroup10': kibanaPipeline.getXpackCiGroupWorker(10), |
50 | | - ]), |
51 | | - ]) |
52 | | - kibanaPipeline.jobRunner('tests-l', false) { |
53 | | - kibanaPipeline.downloadCoverageArtifacts() |
54 | | - kibanaPipeline.bash( |
55 | | - ''' |
56 | | - # bootstrap from x-pack folder |
57 | | - source src/dev/ci_setup/setup_env.sh |
58 | | - cd x-pack |
59 | | - yarn kbn bootstrap --prefer-offline |
60 | | - cd .. |
61 | | - # extract archives |
62 | | - mkdir -p /tmp/extracted_coverage |
63 | | - echo extracting intakes |
64 | | - tar -xzf /tmp/downloaded_coverage/coverage/kibana-intake/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
65 | | - tar -xzf /tmp/downloaded_coverage/coverage/x-pack-intake/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
66 | | - echo extracting kibana-oss-tests |
67 | | - tar -xzf /tmp/downloaded_coverage/coverage/kibana-oss-tests/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
68 | | - echo extracting kibana-xpack-tests |
69 | | - tar -xzf /tmp/downloaded_coverage/coverage/kibana-xpack-tests/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
70 | | - # replace path in json files to have valid html report |
71 | | - pwd=$(pwd) |
72 | | - du -sh /tmp/extracted_coverage/target/kibana-coverage/ |
73 | | - echo replacing path in json files |
74 | | - for i in {1..9}; do |
75 | | - sed -i "s|/dev/shm/workspace/kibana|$pwd|g" /tmp/extracted_coverage/target/kibana-coverage/functional/${i}*.json & |
76 | | - done |
77 | | - wait |
78 | | - # merge oss & x-pack reports |
79 | | - echo merging coverage reports |
80 | | - yarn nyc report --temp-dir /tmp/extracted_coverage/target/kibana-coverage/jest --report-dir target/kibana-coverage/jest-combined --reporter=html --reporter=json-summary |
81 | | - yarn nyc report --temp-dir /tmp/extracted_coverage/target/kibana-coverage/functional --report-dir target/kibana-coverage/functional-combined --reporter=html --reporter=json-summary |
82 | | - echo copy mocha reports |
83 | | - mkdir -p target/kibana-coverage/mocha-combined |
84 | | - cp -r /tmp/extracted_coverage/target/kibana-coverage/mocha target/kibana-coverage/mocha-combined |
85 | | - ''', |
86 | | - "run `yarn kbn bootstrap && merge coverage`" |
87 | | - ) |
88 | | - sh 'tar -czf kibana-jest-coverage.tar.gz target/kibana-coverage/jest-combined/*' |
89 | | - kibanaPipeline.uploadCoverageArtifacts("coverage/jest-combined", 'kibana-jest-coverage.tar.gz') |
90 | | - sh 'tar -czf kibana-functional-coverage.tar.gz target/kibana-coverage/functional-combined/*' |
91 | | - kibanaPipeline.uploadCoverageArtifacts("coverage/functional-combined", 'kibana-functional-coverage.tar.gz') |
92 | | - sh 'tar -czf kibana-mocha-coverage.tar.gz target/kibana-coverage/mocha-combined/*' |
93 | | - kibanaPipeline.uploadCoverageArtifacts("coverage/mocha-combined", 'kibana-mocha-coverage.tar.gz') |
94 | | - } |
| 17 | + workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh')() |
95 | 18 | } |
96 | | - } |
97 | | - kibanaPipeline.sendMail() |
| 19 | + }, |
| 20 | + 'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [ |
| 21 | + 'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1), |
| 22 | + 'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2), |
| 23 | + 'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3), |
| 24 | + 'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4), |
| 25 | + 'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5), |
| 26 | + 'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6), |
| 27 | + 'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7), |
| 28 | + 'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8), |
| 29 | + 'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9), |
| 30 | + 'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10), |
| 31 | + 'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11), |
| 32 | + 'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12), |
| 33 | + ]), |
| 34 | + 'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [ |
| 35 | + 'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1), |
| 36 | + 'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2), |
| 37 | + 'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3), |
| 38 | + 'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4), |
| 39 | + 'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5), |
| 40 | + 'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6), |
| 41 | + 'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7), |
| 42 | + 'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8), |
| 43 | + 'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9), |
| 44 | + 'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10), |
| 45 | + ]), |
| 46 | + ]) |
| 47 | + workers.base(name: 'coverage-worker', label: 'tests-l', ramDisk: false, bootstrapped: false) { |
| 48 | + kibanaPipeline.downloadCoverageArtifacts() |
| 49 | + kibanaPipeline.bash( |
| 50 | + ''' |
| 51 | + # bootstrap from x-pack folder |
| 52 | + source src/dev/ci_setup/setup_env.sh |
| 53 | + cd x-pack |
| 54 | + yarn kbn bootstrap --prefer-offline |
| 55 | + cd .. |
| 56 | + # extract archives |
| 57 | + mkdir -p /tmp/extracted_coverage |
| 58 | + echo extracting intakes |
| 59 | + tar -xzf /tmp/downloaded_coverage/coverage/kibana-intake/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
| 60 | + tar -xzf /tmp/downloaded_coverage/coverage/x-pack-intake/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
| 61 | + echo extracting kibana-oss-tests |
| 62 | + tar -xzf /tmp/downloaded_coverage/coverage/kibana-oss-tests/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
| 63 | + echo extracting kibana-xpack-tests |
| 64 | + tar -xzf /tmp/downloaded_coverage/coverage/kibana-xpack-tests/kibana-coverage.tar.gz -C /tmp/extracted_coverage |
| 65 | + # replace path in json files to have valid html report |
| 66 | + pwd=$(pwd) |
| 67 | + du -sh /tmp/extracted_coverage/target/kibana-coverage/ |
| 68 | + echo replacing path in json files |
| 69 | + for i in {1..9}; do |
| 70 | + sed -i "s|/dev/shm/workspace/kibana|$pwd|g" /tmp/extracted_coverage/target/kibana-coverage/functional/${i}*.json & |
| 71 | + done |
| 72 | + wait |
| 73 | + # merge oss & x-pack reports |
| 74 | + echo merging coverage reports |
| 75 | + yarn nyc report --temp-dir /tmp/extracted_coverage/target/kibana-coverage/jest --report-dir target/kibana-coverage/jest-combined --reporter=html --reporter=json-summary |
| 76 | + yarn nyc report --temp-dir /tmp/extracted_coverage/target/kibana-coverage/functional --report-dir target/kibana-coverage/functional-combined --reporter=html --reporter=json-summary |
| 77 | + echo copy mocha reports |
| 78 | + mkdir -p target/kibana-coverage/mocha-combined |
| 79 | + cp -r /tmp/extracted_coverage/target/kibana-coverage/mocha target/kibana-coverage/mocha-combined |
| 80 | + ''', |
| 81 | + "run `yarn kbn bootstrap && merge coverage`" |
| 82 | + ) |
| 83 | + sh 'tar -czf kibana-jest-coverage.tar.gz target/kibana-coverage/jest-combined/*' |
| 84 | + kibanaPipeline.uploadCoverageArtifacts("coverage/jest-combined", 'kibana-jest-coverage.tar.gz') |
| 85 | + sh 'tar -czf kibana-functional-coverage.tar.gz target/kibana-coverage/functional-combined/*' |
| 86 | + kibanaPipeline.uploadCoverageArtifacts("coverage/functional-combined", 'kibana-functional-coverage.tar.gz') |
| 87 | + sh 'tar -czf kibana-mocha-coverage.tar.gz target/kibana-coverage/mocha-combined/*' |
| 88 | + kibanaPipeline.uploadCoverageArtifacts("coverage/mocha-combined", 'kibana-mocha-coverage.tar.gz') |
98 | 89 | } |
99 | 90 | } |
100 | 91 | } |
| 92 | + kibanaPipeline.sendMail() |
101 | 93 | } |
0 commit comments