#!/bin/groovy library 'kibana-pipeline-library' kibanaLibrary.load() // load from the Jenkins instance kibanaPipeline(timeoutMinutes: 300) { catchErrors { def timestamp = new Date(currentBuild.startTimeInMillis).format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")) withEnv([ "TIME_STAMP=${timestamp}", 'CODE_COVERAGE=1', // Enables coverage. Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc. ]) { workers.base(name: 'coverage-worker', size: 'xl', ramDisk: false, bootstrapped: false) { catchError { kibanaPipeline.bash(""" echo '${TIME_STAMP}' """, "### Print Canonical Time Stamp") kibanaCoverage.runTests() handleIngestion(TIME_STAMP) } handleFail() } } kibanaPipeline.sendMail() } } def handleIngestion(timestamp) { def previousSha = handlePreviousSha() kibanaPipeline.downloadCoverageArtifacts() kibanaCoverage.prokLinks("### Process HTML Links") kibanaCoverage.collectVcsInfo("### Collect VCS Info") kibanaCoverage.generateReports("### Merge coverage reports") kibanaCoverage.uploadCombinedReports() kibanaCoverage.uploadCoverageStaticSite(timestamp) kibanaCoverage.ingest(env.JOB_NAME, BUILD_NUMBER, BUILD_URL, timestamp, previousSha, teamAssignmentsPath(), '### Generate Team Assignments && Ingest') } def handlePreviousSha() { def previous = kibanaCoverage.downloadPrevious('### Download OLD Previous') kibanaCoverage.uploadPrevious('### Upload NEW Previous') return previous } def handleFail() { def buildStatus = buildUtils.getBuildStatus() if (params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED' && buildStatus != 'UNSTABLE') { slackNotifications.sendFailedBuild( channel: '#kibana-qa', username: 'Kibana QA' ) } } def teamAssignmentsPath() { return 'src/dev/code_coverage/ingest_coverage/team_assignment/team_assignments.txt' }