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