-
Notifications
You must be signed in to change notification settings - Fork 76
/
Jenkinsfile-k8s-workspace-caching
54 lines (54 loc) · 1.13 KB
/
Jenkinsfile-k8s-workspace-caching
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
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: eclipse-temurin
image: eclipse-temurin:17-jdk
command:
- cat
tty: true
"""
}
}
options {
timestamps()
}
stages {
stage('cleanWs') {
steps {
cleanWs()
}
}
stage('checkout') {
steps {
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/darinpope/java-web-app.git']])
}
}
stage('readCache') {
steps {
readCache name: 'mvn-cache'
}
}
stage('build') {
steps {
container('eclipse-temurin') {
sh './mvnw clean verify -Dmaven.repo.local=./maven-repo -DskipTests'
}
}
post {
success {
writeCache name: 'mvn-cache', includes: 'maven-repo/**'
}
}
}
}
post {
always {
cleanWs()
}
}
}