1+ pipeline {
2+ agent {
3+ kubernetes {
4+ cloud ' kubernetes'
5+ yaml '''
6+ apiVersion: v1
7+ kind: Pod
8+ spec:
9+ nodeSelector:
10+ node-type: edge
11+ containers:
12+ - name: maven-jdk8
13+ image: maven:3.9.9-eclipse-temurin-8-alpine
14+ command:
15+ - cat
16+ tty: true
17+ volumeMounts:
18+ - name: maven-settings-volume
19+ mountPath: /usr/share/maven/ref/settings.xml
20+ - name: maven-jdk21
21+ image: maven:3.9.9-eclipse-temurin-21-alpine
22+ command:
23+ - cat
24+ tty: true
25+ volumeMounts:
26+ - name: maven-settings-volume
27+ mountPath: /usr/share/maven/ref/settings.xml
28+ volumes:
29+ - name: maven-settings-volume
30+ configMap:
31+ # Provide the name of the ConfigMap containing the files you want
32+ # to add to the container
33+ name: ghmbd06b-maven-settings
34+ '''
35+ }
36+ }
37+
38+ stages {
39+
40+ stage (' Chekout and Compile' ) {
41+
42+ steps {
43+ container(' maven-jdk8' ){
44+ script {
45+ checkout([
46+ $class : ' GitSCM' ,
47+ branches : [
48+ [name : ' main' ]
49+ ],
50+ doGenerateSubmoduleConfigurations : false ,
51+ extensions : [],
52+ submoduleCfg : [],
53+ userRemoteConfigs : [[
54+ // credentialsId: 'Ethosengine_Jenkins_SSH',
55+ url : ' https://github.com/ethosengine/sonar-auth-oidc.git'
56+ ]]
57+ ])
58+ withMaven() {
59+ sh ' mvn clean compile -fae'
60+ }
61+ }
62+ }
63+ }
64+ }
65+
66+ stage (' Unit Test' ) {
67+ steps {
68+ container(' maven-jdk8' ){
69+ script {
70+ withMaven() {
71+ sh ' mvn test -fae'
72+ }
73+ }
74+ }
75+ }
76+ }
77+
78+ stage (' Integration Test' ) {
79+ steps {
80+ container(' maven-jdk8' ){
81+ script {
82+ withMaven() {
83+ sh ' mvn integration-test -fae'
84+ }
85+ }
86+ }
87+ }
88+ }
89+
90+ stage (' QA Scan' ) {
91+ steps {
92+ container(' maven-jdk21' ){
93+ script {
94+ withSonarQubeEnv(' ee-sonarqube' ) {
95+ sh ' mvn clean verify sonar:sonar -Dmaven.test.failure.ignore=true'
96+ }
97+ }
98+ }
99+ }
100+ }
101+ }
102+
103+ post {
104+ always {
105+ container(' maven-jdk8' ) {
106+ junit(
107+ allowEmptyResults : true ,
108+ testResults : ' **/test-reports/*.xml'
109+ )
110+ }
111+ }
112+ }
113+ }
0 commit comments