-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathJenkinsfile
154 lines (139 loc) · 6.1 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!groovy
pipeline {
agent {
label 'general-purpose'
}
tools {
maven "maven-3.6.3"
}
stages {
stage('Build payara-maven-plugins-common') {
environment {
JAVA_HOME = tool("zulu-11")
PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
MAVEN_OPTS = '-Xmx2G -Djavax.net.ssl.trustStore=${JAVA_HOME}/jre/lib/security/cacerts'
payaraBuildNumber = "${BUILD_NUMBER}"
}
steps {
script {
sh '''
ls -lrt
cd payara-maven-plugins-common
echo *#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
mvn -B -V -ff -e clean install --strict-checksums \
com.github.spotbugs:spotbugs-maven-plugin:spotbugs \
-Dfindbugs.skip=false -Djavadoc.skip=true -Dsource.skip=true \
-Dspotbugs.effort=max -Dspotbugs.htmlOutput=true
echo *#*#*#*#*#*#*#*#*#*#*#*# Built SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'''
}
}
}
stage('Build payara-micro-maven-plugin') {
environment {
JAVA_HOME = tool("zulu-11")
PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
MAVEN_OPTS = '-Xmx2G -Djavax.net.ssl.trustStore=${JAVA_HOME}/jre/lib/security/cacerts'
payaraBuildNumber = "${BUILD_NUMBER}"
}
steps {
script {
sh '''
ls -lrt
cd payara-micro-maven-plugin
echo *#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
mvn -B -V -ff -e clean install --strict-checksums \
com.github.spotbugs:spotbugs-maven-plugin:spotbugs \
-Dfindbugs.skip=false -Djavadoc.skip=true -Dsource.skip=true \
-Dspotbugs.effort=max -Dspotbugs.htmlOutput=true
echo *#*#*#*#*#*#*#*#*#*#*#*# Built SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'''
}
}
}
stage('Build payara-cloud-maven-plugin') {
environment {
JAVA_HOME = tool("zulu-11")
PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
MAVEN_OPTS = '-Xmx2G -Djavax.net.ssl.trustStore=${JAVA_HOME}/jre/lib/security/cacerts'
payaraBuildNumber = "${BUILD_NUMBER}"
}
steps {
script {
sh '''
ls -lrt
cd payara-cloud-maven-plugin
echo *#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
mvn -B -V -ff -e clean install --strict-checksums \
com.github.spotbugs:spotbugs-maven-plugin:spotbugs \
-Dfindbugs.skip=false -Djavadoc.skip=true -Dsource.skip=true \
-Dspotbugs.effort=max -Dspotbugs.htmlOutput=true
echo *#*#*#*#*#*#*#*#*#*#*#*# Built SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'''
}
}
}
stage('Build payara-micro-maven-archetype') {
environment {
JAVA_HOME = tool("zulu-11")
PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
MAVEN_OPTS = '-Xmx2G -Djavax.net.ssl.trustStore=${JAVA_HOME}/jre/lib/security/cacerts'
payaraBuildNumber = "${BUILD_NUMBER}"
}
steps {
script {
sh '''
ls -lrt
cd payara-micro-maven-archetype
echo *#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
mvn -B -V -ff -e clean install --strict-checksums \
com.github.spotbugs:spotbugs-maven-plugin:spotbugs \
-Dfindbugs.skip=false -Djavadoc.skip=true -Dsource.skip=true \
-Dspotbugs.effort=max -Dspotbugs.htmlOutput=true
echo *#*#*#*#*#*#*#*#*#*#*#*# Built SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
'''
}
}
}
stage('Aggregate Reports') {
steps {
script {
sh '''#!/bin/bash
# Define the directory where you want to copy the SpotBugs HTML files
OUTPUT_DIR="./all-spotbugs-html-reports"
# Create the output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Find all spotbugs.html files and process each
find . -name "spotbugs.html" | while read -r file; do
# Extract the project name (assuming the project name is the immediate directory containing the spotbugs.html file)
project_name=$(basename "$(dirname "$(dirname "$file")")")
# Copy the spotbugs.html file to the output directory with a new name
cp "$file" "$OUTPUT_DIR/${project_name}-spotbugs.html"
done
echo "All spotbugs.html files have been copied to $OUTPUT_DIR with their project names."
'''
sh '''#!/bin/bash
# Define the directory where you want to copy the SpotBugs HTML files
OUTPUT_DIR="./all-spotbugs-xml-reports"
# Create the output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Find all spotbugs.html files and process each
find . -name "spotbugsXml.xml" | while read -r file; do
# Extract the project name (assuming the project name is the immediate directory containing the spotbugs.html file)
project_name=$(basename "$(dirname "$(dirname "$file")")")
# Copy the spotbugs.html file to the output directory with a new name
cp "$file" "$OUTPUT_DIR/${project_name}-spotbugsXml.xml"
done
echo "All spotbugsXml.xml files have been copied to $OUTPUT_DIR with their project names."
'''
}
}
}
stage('Publish SpotBugs Results') {
steps {
// Publish SpotBugs results using the Warnings NG plugin
recordIssues tools: [spotBugs(pattern: 'all-spotbugs-xml-reports/*.xml')]
}
}
}
}