Skip to content

Commit e560f9f

Browse files
committed
Enable jtreg job to handle jtreg v6 and v5
1 parent 94d5b59 commit e560f9f

1 file changed

Lines changed: 31 additions & 13 deletions

File tree

jenkins-job-generator/definitions/jtreg-job.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
description: 'The tag/branch to build.'
1515
- string:
1616
name: BUILD_VERSION
17-
default: '1.0'
17+
default: '9.9'
1818
description: 'Manually set the JTREG version. Only used when TAG parameter is "master"'
1919
- string:
2020
name: BUILD_NUMBER
21-
default: '0'
21+
default: '99'
2222
description: 'Manually set the JTREG build number. Only used when TAG parameter is "master"'
2323
dsl: |
2424
pipeline {
2525
agent {
2626
label 'linux_x86_64'
2727
}
2828
stages {
29-
stage("Checkout Infrastructure") {
30-
steps {
31-
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/master']], includedRegions: 'jenkins-job-generator/.*', doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'SapMachine-Infrastructure']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'SapMachine-github', url: 'https://github.com/SAP/SapMachine-infrastructure.git']]]
32-
}
33-
}
29+
stage("Checkout Infrastructure") {
30+
steps {
31+
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/master']], includedRegions: 'jenkins-job-generator/.*', doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'SapMachine-Infrastructure']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'SapMachine-github', url: 'https://github.com/SAP/SapMachine-infrastructure.git']]]
32+
}
33+
}
3434
stage('Build') {
3535
agent {
3636
dockerfile {
@@ -41,19 +41,37 @@
4141
}
4242
steps {
4343
script {
44+
def jtregVersion
45+
def jtregBuild
4446
if (params.TAG == "master") {
45-
env.BUILD_NUMBER = params.BUILD_NUMBER
46-
env.BUILD_VERSION = params.BUILD_VERSION
47+
jtregVersion = params.BUILD_VERSION
48+
jtregBuild = params.BUILD_NUMBER
49+
} else {
50+
def match = params.TAG =~ /jtreg-*([0-9]+(\.[0-9]+)*)((\+|-b)([0-9]+))*/
51+
jtregVersion = match[0][1]
52+
jtregBuild = matcher[0][5]
53+
if (jtregBuild == null) {
54+
jtregBuild = "1"
55+
} else {
56+
jtregBuild = jtregBuild.toInteger()
57+
}
58+
}
59+
if (version.toFloat() < 6) {
60+
env.BUILD_VERSION = jtregVersion
61+
env.BUILD_NUMBER = jtregBuild
62+
env.BUILD_SCRIPT = "build-all.sh"
63+
env.VM_OPT = ""
4764
} else {
48-
def match = params.TAG =~ /jtreg([0-9]+(\.[0-9]+)*)-(b[0-9]*).*/
49-
env.BUILD_NUMBER = match[0][2]
50-
env.BUILD_VERSION = match[0][1]
65+
env.JTREG_VERSION = jtregVersion
66+
env.JTREG_BUILD_NUMBER = jtregBuild
67+
env.BUILD_SCRIPT = "build.sh"
68+
env.VM_OPT = "--jdk"
5169
}
5270
}
5371
sh "rm -rf ${env.WORKSPACE}/jtreg"
5472
sh "git clone https://github.com/openjdk/jtreg.git ${env.WORKSPACE}/jtreg"
5573
sh "cd ${env.WORKSPACE}/jtreg && git checkout ${params.TAG}"
56-
sh "cd ${env.WORKSPACE}/jtreg && bash make/build.sh --jdk /usr/lib/jvm/java-8-openjdk-*"
74+
sh "cd ${env.WORKSPACE}/jtreg && bash make/${BUILD_SCRIPT} ${VM_OPT} /usr/lib/jvm/java-8-openjdk-*"
5775
sh "cp ${env.WORKSPACE}/jtreg/build/images/jtreg.zip ${env.WORKSPACE}/jtreg.zip"
5876
}
5977
post {

0 commit comments

Comments
 (0)