-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile.spring-framework
62 lines (62 loc) · 2.62 KB
/
Jenkinsfile.spring-framework
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
#!groovy
pipeline {
agent { node { label 'linux' } }
environment{
GRADLE_HOME = fileExists "$HOME/.gradle"
}
options {
buildDiscarder logRotator( numToKeepStr: '20' )
}
parameters {
string( defaultValue: '12.0.0-SNAPSHOT', description: 'Jetty version to use to build SpringBoot project',
name: 'JETTY_VERSION' )
string( defaultValue: '1.1.8', description: 'Jetty Reactive HttpClient version to use in the build',
name: 'JETTY_REACTIVE_HTTPCLIENT_VERSION' )
string( defaultValue: 'jdk17', description: 'JDK to use (jdk8,jdk11,jdk16)', name: 'JDK' )
string( defaultValue: 'main', description: 'spring-framework branch', name: 'SPRINGFRAMEWORK_BRANCH' )
string( defaultValue: 'spring-projects', description: 'spring-framework github org', name: 'SPRINGFRAMEWORK_ORG' )
}
stages {
stage('Create Gradle home'){
when { expression { GRADLE_HOME == 'false' } }
steps {
sh "mkdir $HOME/.gradle"
}
}
stage("Checkout SpringFramework"){
steps{
stash name: 'init.gradle.spring-framework', includes: 'init.gradle.spring-framework'
checkout([$class: 'GitSCM',
branches: [[name: "*/$SPRINGFRAMEWORK_BRANCH"]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/$SPRINGFRAMEWORK_ORG/spring-framework.git']]])
}
}
stage("Build SpringFramework"){
steps{
withEnv( ["JAVA_HOME=${tool "$jdk"}"] ) {
configFileProvider([configFile(fileId: 'init.gradle', variable: 'INIT_GRADLE')]) {
sh "cp $INIT_GRADLE $HOME/.gradle/init.gradle"
unstash name: 'init.gradle.spring-framework'
script{
def text = readFile "init.gradle.spring-framework"
text = text.replaceAll("9.4.29.v20200521", "${JETTY_VERSION}")
text = text.replaceAll("jetty-reactive-httpclient:1.1.6", "jetty-reactive-httpclient:${JETTY_REACTIVE_HTTPCLIENT_VERSION}")
writeFile file:"init.gradle.spring-framework.modified", text: text
}
sh "cat init.gradle.spring-framework.modified"
sh './gradlew build --info --no-daemon --no-build-cache --init-script init.gradle.spring-framework.modified'
}
}
}
post {
always {
script{
currentBuild.description = "Build SpringFramework branch ${SPRINGFRAMEWORK_BRANCH}, Jetty Version ${JETTY_VERSION}, jdk ${jdk}"
}
junit '**/build/test-results/test/*.xml'
}
}
}
}
}