-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (52 loc) · 2.17 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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '20'))
}
triggers {
cron '@midnight'
}
parameters {
string(name: 'engineSource', defaultValue: 'https://product.ivyteam.io', description: 'Engine page url')
}
stages {
stage('build') {
steps {
script {
def random = (new Random()).nextInt(10000000)
def networkName = "build-" + random
def seleniumName = "selenium-" + random
sh "docker network create ${networkName}"
try {
docker.image("selenium/standalone-firefox:4").withRun("-e START_XVFB=false --shm-size=2g --name ${seleniumName} --network ${networkName}") {
docker.build('maven').inside("--network ${networkName}") {
withCredentials([string(credentialsId: 'gpg.password.axonivy', variable: 'GPG_PWD'), file(credentialsId: 'gpg.keystore.axonivy', variable: 'GPG_FILE')]) {
sh "gpg --batch --import ${env.GPG_FILE}"
def phase = isReleaseOrMasterBranch() ? 'deploy' : 'verify'
maven cmd: "clean ${phase} " +
"-f pom.test.xml " +
"-Dmaven.test.failure.ignore=true " +
"-Dengine.page.url=${params.engineSource} " +
"-Divy.engine.version.latest.minor=true " +
"-Dskip.gpg=false " +
"-Dgpg.passphrase='${env.GPG_PWD}' " +
"-Dselenide.remote=http://${seleniumName}:4444/wd/hub "
}
}
}
} finally {
sh "docker network rm ${networkName}"
}
}
archiveArtifacts '**/target/*.jar'
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: '**/target/*-reports/**/*.xml'
recordIssues tools: [mavenConsole(), eclipse(), javaDoc()], qualityGates: [[threshold: 1, type: 'TOTAL']], filters: [
excludeMessage('.*JAR will be empty.*'), // for unit tester
]
}
}
}
}
def isReleaseOrMasterBranch() {
return env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('release/')
}