@@ -7,15 +7,17 @@ kind: Pod
7
7
spec:
8
8
containers:
9
9
- name: maven
10
- image: maven:3.6.3-jdk-8
10
+ # In a real Jenkinsfile, it is recommended to pin to a specific version and use Dependabot or Renovate to bump it.
11
+ image: maven:latest
11
12
command:
12
13
- sleep
13
14
args:
14
15
- infinity
15
16
''' ) {
16
- node(POD_LABEL ) {
17
- // or, for example: git 'https://github.com/jglick/simple-maven-project-with-tests'
18
- writeFile file : ' pom.xml' , text : '''
17
+ retry(count : 2 , conditions : [kubernetesAgent(), nonresumable()]) {
18
+ node(POD_LABEL ) {
19
+ // or, for example: git 'https://github.com/jglick/simple-maven-project-with-tests'
20
+ writeFile file : ' pom.xml' , text : '''
19
21
<project xmlns="http://maven.apache.org/POM/4.0.0">
20
22
<modelVersion>4.0.0</modelVersion>
21
23
<groupId>sample</groupId>
@@ -45,17 +47,18 @@ spec:
45
47
</properties>
46
48
</project>
47
49
'''
48
- writeFile file : ' src/test/java/sample/SomeTest.java' , text : '''
50
+ writeFile file : ' src/test/java/sample/SomeTest.java' , text : '''
49
51
package sample;
50
52
public class SomeTest {
51
53
@org.junit.Test
52
54
public void checks() {}
53
55
}
54
56
'''
55
- container(' maven' ) {
56
- sh ' mvn -B -ntp -Dmaven.test.failure.ignore verify'
57
+ container(' maven' ) {
58
+ sh ' mvn -B -ntp -Dmaven.test.failure.ignore verify'
59
+ }
60
+ junit ' **/target/surefire-reports/TEST-*.xml'
61
+ archiveArtifacts ' **/target/*.jar'
57
62
}
58
- junit ' **/target/surefire-reports/TEST-*.xml'
59
- archiveArtifacts ' **/target/*.jar'
60
63
}
61
64
}
0 commit comments