forked from nuxeo/nuxeo-java-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
88 lines (83 loc) · 4.94 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* (C) Copyright 2017-2018 Nuxeo (http://nuxeo.com/) and others.
*
* Contributors:
* Thomas Roger <[email protected]>
* Kevin Leturc <[email protected]>
*/
properties([
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', daysToKeepStr: '60', numToKeepStr: '60', artifactNumToKeepStr: '1']],
disableConcurrentBuilds(),
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
pipelineTriggers([
triggers: [
[
$class : 'ReverseBuildTrigger',
upstreamProjects: "${env.UPSTREAM_PROJECT}",
threshold : hudson.model.Result.SUCCESS
]
]
])
])
node(env.SLAVE) {
try {
timestamps {
timeout(30) {
def masterBuild = env.BRANCH_NAME == 'master' && env.STATUS_CONTEXT_NAME == 'nuxeo/master'
stage('checkout') {
checkout scm
}
stage('build and test') {
step([$class : 'GitHubCommitStatusSetter',
reposSource : [$class: 'ManuallyEnteredRepositorySource', url: 'https://github.com/nuxeo/nuxeo-java-client'],
contextSource : [$class: 'ManuallyEnteredCommitContextSource', context: "${env.STATUS_CONTEXT_NAME}"],
statusResultSource: [$class : 'ConditionalStatusResultSource',
results: [[$class: 'AnyBuildResult', message: 'Building on Nuxeo CI', state: 'PENDING']]]])
def jdk = tool name: 'java-8-oracle'
env.JAVA_HOME = "${jdk}"
def mvnHome = tool name: 'maven-3', type: 'hudson.tasks.Maven$MavenInstallation'
def mvnGoals = 'clean install'
if (masterBuild) {
mvnGoals += ' deploy'
}
sh "${mvnHome}/bin/mvn ${mvnGoals} -P ${env.TARGET_PLATFORM}"
}
stage('post build') {
step([$class : 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false,
consoleParsers: [[parserName: 'Maven']], defaultEncoding: '', excludePattern: '',
healthy : '', includePattern: '', messagesPattern: '', unHealthy: ''])
archive 'nuxeo-java-client/target/*.jar, nuxeo-java-client-test/target/tomcat/log/*.log'
junit 'nuxeo-java-client/target/surefire-reports/*.xml'
junit 'nuxeo-java-client-test/target/failsafe-reports/*.xml'
if (masterBuild) {
step([$class: 'JiraIssueUpdater', issueSelector: [$class: 'DefaultIssueSelector'], scm: scm])
}
if (currentBuild.getPreviousBuild() != null && 'SUCCESS' != currentBuild.getPreviousBuild().getResult()) {
mail(to: '[email protected]', subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}) - Back to normal",
body: "Build back to normal: ${env.BUILD_URL}.")
}
step([$class : 'GitHubCommitStatusSetter',
reposSource : [$class: 'ManuallyEnteredRepositorySource', url: 'https://github.com/nuxeo/nuxeo-java-client'],
contextSource : [$class: 'ManuallyEnteredCommitContextSource', context: "${env.STATUS_CONTEXT_NAME}"],
statusResultSource: [$class : 'ConditionalStatusResultSource',
results: [[$class: 'AnyBuildResult', message: 'Successfully built on Nuxeo CI', state: 'SUCCESS']]]])
}
}
}
} catch (e) {
currentBuild.result = "FAILURE"
step([$class: 'ClaimPublisher'])
archive 'nuxeo-java-client/target/*.jar, nuxeo-java-client-test/target/tomcat/log/*.log'
mail(to: '[email protected]', subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}) - Failure!",
body: "Build failed ${env.BUILD_URL}.")
step([$class : 'GitHubCommitStatusSetter',
reposSource : [$class: 'ManuallyEnteredRepositorySource', url: 'https://github.com/nuxeo/nuxeo-java-client'],
contextSource : [$class: 'ManuallyEnteredCommitContextSource', context: "${env.STATUS_CONTEXT_NAME}"],
statusResultSource: [$class : 'ConditionalStatusResultSource',
results: [[$class: 'AnyBuildResult', message: 'Failed to build on Nuxeo CI', state: 'FAILURE']]]])
throw e
} finally {
step([$class : 'CheckStylePublisher', canComputeNew: false, defaultEncoding: '', healthy: '',
pattern: 'ftest/target/checkstyle-result.xml', unHealthy: ''])
}
}