forked from chrishantha/sample-java-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
35 lines (29 loc) · 919 Bytes
/
Jenkinsfile
File metadata and controls
35 lines (29 loc) · 919 Bytes
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
def nlabel = "jenkins-project-${UUID.randomUUID().toString()}"
podTemplate(label: nlabel,
containers: [
containerTemplate(name: 'maven', image: 'maven', ttyEnabled: true, command: 'cat' ),
containerTemplate(name: 'docker', image: 'docker', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl', ttyEnabled: true, command: 'cat')
],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'),
persistentVolumeClaim(mountPath: '/root/.m2', claimName: 'jenkins-maven-pvc')
]
)
{
node (nlabel) {
stage ('Checkout') {
checkout scm
}
stage ('maven build') {
container('maven') {
sh ("mvn clean install")
}
}
stage ('analysis') {
container('maven') {
sh ("mvn clean package sonar:sonar -Dsonar.host.url=http://192.168.0.244:9000")
}
}
}
}