mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
f155e0ad3b
commit
3b4d052871
3 changed files with 48 additions and 36 deletions
|
@ -4,23 +4,25 @@ library 'kibana-pipeline-library'
|
|||
kibanaLibrary.load()
|
||||
|
||||
kibanaPipeline(timeoutMinutes: 120) {
|
||||
ciStats.trackBuild {
|
||||
catchError {
|
||||
parallel([
|
||||
'oss-visualRegression': {
|
||||
workers.ci(name: 'oss-visualRegression', size: 's-highmem', ramDisk: true) {
|
||||
kibanaPipeline.functionalTestProcess('oss-visualRegression', './test/scripts/jenkins_visual_regression.sh')(1)
|
||||
}
|
||||
},
|
||||
'xpack-visualRegression': {
|
||||
workers.ci(name: 'xpack-visualRegression', size: 's-highmem', ramDisk: true) {
|
||||
kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')(1)
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
githubCommitStatus.trackBuild(params.commit, 'kibana-ci-baseline') {
|
||||
ciStats.trackBuild {
|
||||
catchError {
|
||||
parallel([
|
||||
'oss-visualRegression': {
|
||||
workers.ci(name: 'oss-visualRegression', size: 's-highmem', ramDisk: true) {
|
||||
kibanaPipeline.functionalTestProcess('oss-visualRegression', './test/scripts/jenkins_visual_regression.sh')(1)
|
||||
}
|
||||
},
|
||||
'xpack-visualRegression': {
|
||||
workers.ci(name: 'xpack-visualRegression', size: 's-highmem', ramDisk: true) {
|
||||
kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')(1)
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
kibanaPipeline.sendMail()
|
||||
slackNotifications.onFailure()
|
||||
kibanaPipeline.sendMail()
|
||||
slackNotifications.onFailure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class GithubCommitStatusTest extends KibanaBasePipelineTest {
|
|||
|
||||
interface BuildState {
|
||||
Object get(String key)
|
||||
Object has(String key)
|
||||
}
|
||||
|
||||
interface GithubApi {
|
||||
|
@ -25,6 +26,7 @@ class GithubCommitStatusTest extends KibanaBasePipelineTest {
|
|||
buildStateMock = mock(BuildState)
|
||||
githubApiMock = mock(GithubApi)
|
||||
|
||||
when(buildStateMock.has('checkoutInfo')).thenReturn(true)
|
||||
when(buildStateMock.get('checkoutInfo')).thenReturn([ commit: 'COMMIT_HASH', ])
|
||||
when(githubApiMock.post(any(), any())).thenReturn(null)
|
||||
|
||||
|
|
|
@ -1,39 +1,47 @@
|
|||
def shouldCreateStatuses() {
|
||||
return !githubPr.isPr() && buildState.get('checkoutInfo')
|
||||
}
|
||||
|
||||
def onStart() {
|
||||
catchError {
|
||||
if (!shouldCreateStatuses()) {
|
||||
return
|
||||
}
|
||||
|
||||
def checkoutInfo = buildState.get('checkoutInfo')
|
||||
create(checkoutInfo.commit, 'pending', 'Build started.')
|
||||
def defaultCommit() {
|
||||
if (buildState.has('checkoutInfo')) {
|
||||
return buildState.get('checkoutInfo').commit
|
||||
}
|
||||
}
|
||||
|
||||
def onFinish() {
|
||||
def onStart(commit = defaultCommit(), context = 'kibana-ci') {
|
||||
catchError {
|
||||
if (!shouldCreateStatuses()) {
|
||||
if (githubPr.isPr() || !commit) {
|
||||
return
|
||||
}
|
||||
|
||||
create(commit, 'pending', 'Build started.', context)
|
||||
}
|
||||
}
|
||||
|
||||
def onFinish(commit = defaultCommit(), context = 'kibana-ci') {
|
||||
catchError {
|
||||
if (githubPr.isPr() || !commit) {
|
||||
return
|
||||
}
|
||||
|
||||
def checkoutInfo = buildState.get('checkoutInfo')
|
||||
def status = buildUtils.getBuildStatus()
|
||||
|
||||
if (status == 'SUCCESS' || status == 'UNSTABLE') {
|
||||
create(checkoutInfo.commit, 'success', 'Build completed successfully.')
|
||||
create(commit, 'success', 'Build completed successfully.', context)
|
||||
} else if(status == 'ABORTED') {
|
||||
create(checkoutInfo.commit, 'error', 'Build aborted or timed out.')
|
||||
create(commit, 'error', 'Build aborted or timed out.', context)
|
||||
} else {
|
||||
create(checkoutInfo.commit, 'error', 'Build failed.')
|
||||
create(commit, 'error', 'Build failed.', context)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def trackBuild(commit, context, Closure closure) {
|
||||
onStart(commit, context)
|
||||
catchError {
|
||||
closure()
|
||||
}
|
||||
onFinish(commit, context)
|
||||
}
|
||||
|
||||
// state: error|failure|pending|success
|
||||
def create(sha, state, description, context = 'kibana-ci') {
|
||||
def create(sha, state, description, context) {
|
||||
withGithubCredentials {
|
||||
return githubApi.post("repos/elastic/kibana/statuses/${sha}", [
|
||||
state: state,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue