-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
executable file
·50 lines (46 loc) · 1.08 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
pipeline {
agent any
tools {
maven 'Maven 3.8.5'
jdk 'OpenJDK11'
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
skipStagesAfterUnstable()
timestamps()
}
environment {
JETTY_PORT = getPort()
}
stages {
stage('Maven build: Main project') {
steps {
configFileProvider([
configFile(fileId: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709', variable: 'MAVEN_SETTINGS')
]) {
sh 'mvn -s ${MAVEN_SETTINGS} -Djetty.port=${JETTY_PORT} clean test verify dependency:analyze -Pclb-build -U'
}
}
}
stage('Build and push Docker images: Checklistbank workflow') {
steps {
sh 'build/checklistbank-workflow-docker-build.sh'
}
}
}
post {
success {
echo 'Pipeline executed successfully!'
}
failure {
echo 'Pipeline execution failed!'
}
}
}
def getPort() {
try {
return new ServerSocket(0).getLocalPort()
} catch (IOException ex) {
System.err.println("no available ports");
}
}