11pipeline {
2- agent none
3- triggers {cron ' @daily' }
2+ agent {
3+ label ' docker-amt'
4+ }
45 options {
56 buildDiscarder(logRotator(numToKeepStr : ' 5' , daysToKeepStr : ' 30' ))
67 timestamps()
78 timeout(unit : ' HOURS' , time : 2 )
89 }
910
11+
1012 stages {
11- stage (' Parallel' ) {
12- parallel {
13- stage (' Linux' ) {
14- agent { label ' docker-amt' }
15- stages {
16- stage (' Cloning Repository' ) {
17- steps {
18- script {
19- scmCheckout {
20- clean = true
21- }
22- }
23- }
24- }
25- }
26- }
27- stage (' Windows' ) {
28- agent { label ' openamt-win' }
29- stages {
30- stage (' Cloning Repository' ) {
31- steps {
32- script {
33- scmCheckout {
34- clean = true
35- }
36- }
37- }
38- }
13+ stage (' Cloning Repository' ) {
14+ steps {
15+ script {
16+ scmCheckout {
17+ clean = true
3918 }
4019 }
4120 }
4221 }
43- stage (' Static Code Scan - Protex' ) {
44- agent { label ' docker-amt' }
22+ stage(' Static Code Scan - Protex' ) {
23+ environment{
24+ PROJECT_NAME = ' OpenAMT - RPC'
25+ SCANNERS = ' protex'
26+ }
4527 steps {
46- script {
47- staticCodeScan {
48- // generic
49- scanners = [' protex' ]
50- scannerType = [' c' ,' c++' ]
51-
52- protexProjectName = ' OpenAMT - RPC'
53- // internal, do not change
54- protexBuildName = ' rrs-generic-protex-build'
55- }
56- }
28+ rbheStaticCodeScan()
5729 }
5830 }
59-
6031 stage (' Parallel Builds' ) {
6132 parallel {
6233 stage (' Linux' ) {
@@ -72,14 +43,14 @@ pipeline {
7243 steps {
7344 sh ' ./scripts/jenkins-pre-build.sh'
7445 sh ' ./scripts/jenkins-build.sh'
46+ stash includes : ' build/rpc' , name : ' linux-rpc-app'
7547 }
7648 }
7749 stage (' Archive' ) {
7850 steps {
7951 archiveArtifacts allowEmptyArchive : true , artifacts : ' build/rpc' , caseSensitive : false , onlyIfSuccessful : true
8052 }
8153 }
82-
8354 }
8455 }
8556 stage (' Windows' ) {
@@ -90,7 +61,7 @@ pipeline {
9061 bat ' scripts\\ jenkins-pre-build.cmd'
9162 bat ' scripts\\ jenkins-build.cmd'
9263 // prepare stash for the binary scan
93- stash includes : " **/*.exe" , name : ' rpc-app'
64+ stash includes : ' **/*.exe' , name : ' win- rpc-app'
9465 }
9566 }
9667 stage (' Archive' ) {
@@ -102,71 +73,82 @@ pipeline {
10273 }
10374 }
10475 }
105- stage (' Parallel Scans' ) {
106- parallel {
107- stage (' Static Code Scan Linux' ) {
108- agent { label ' docker-amt' }
109- steps {
110- script {
111- staticCodeScan {
112- // generic
113- scanners = [' bdba' ,' klocwork' ]
114- scannerType = ' c++'
11576
116- protecodeGroup = ' 25'
117- protecodeScanName = ' rpc-zip'
118- protecodeDirectory = ' ./build/rpc'
119-
120- klockworkPreBuildScript = ' ./scripts/jenkins-pre-build.sh'
121- klockworkBuildCommand = ' ./scripts/jenkins-build.sh'
122- klockworkProjectName = ' Panther Point Creek'
123- klockworkIgnoreCompileErrors = true
124- }
125- }
126- }
77+ stage(' Prep Binary' ) {
78+ steps {
79+ sh ' mkdir -p ./bin'
80+ dir(' ./bin' ) {
81+ unstash ' linux-rpc-app'
82+ unstash ' win-rpc-app'
12783 }
128- stage (' Static Code Scan Windows' ) {
129- stages {
130- stage (' Static Code Scan Windows - Klockwork' ) {
131- agent { label ' openamt-win' }
132- steps {
133- script {
134- staticCodeScan {
135- // generic
136- scanners = [' klocwork' ]
137- scannerType = ' c++'
138-
139- klockworkPreBuildScript = ' scripts\\ jenkins-pre-build.cmd'
140- klockworkBuildCommand = ' scripts\\ jenkins-build.cmd'
141- klockworkProjectName = ' Panther Point Creek'
142- klockworkIgnoreCompileErrors = true
143- }
144- }
145- }
146- }
147- stage (' Static Code Scan Windows - BDBA' ) {
148- agent { label ' docker-amt' }
149- steps {
150- script {
151- sh " mkdir -p bdbaScanDir"
152- dir(" bdbaScanDir" ) {
153- unstash ' rpc-app'
154- }
155- staticCodeScan {
156- // generic
157- scanners = [' bdba' ]
158- scannerType = ' c++'
159-
160- protecodeGroup = ' 25'
161- protecodeScanName = ' rpc-zip'
162- protecodeDirectory = ' bdbaScanDir'
163- }
164- }
165- }
84+ }
85+ }
86+ stage(' Linux Scans' ) {
87+ environment{
88+ PROJECT_NAME = ' OpenAMT - RPC - Linux'
89+ SCANNERS = ' bdba,klocwork'
90+
91+ // protecode details
92+ PROTECODE_BIN_DIR = ' ./bin'
93+ PROTECODE_INCLUDE_SUB_DIRS = true
94+
95+ // klocwork details
96+ KLOCWORK_SCAN_TYPE = ' c++'
97+ KLOCWORK_PRE_BUILD_SCRIPT = ' ./scripts/jenkins-pre-build.sh'
98+ KLOCWORK_BUILD_COMMAND = ' ./scripts/jenkins-build.sh'
99+ KLOCWORK_IGNORE_COMPILE_ERRORS = true
100+
101+ // publishArtifacts details
102+ PUBLISH_TO_ARTIFACTORY = true
103+ }
104+ steps {
105+ rbheStaticCodeScan()
106+ dir(' artifacts/Klockwork' ){
107+ sh ' cp kw_report.html kw_report_linux.html'
108+ sh ' cp kw_report.csv kw_report_linux.csv'
109+ archiveArtifacts allowEmptyArchive : true , artifacts : ' kw_report_linux.html'
110+ archiveArtifacts allowEmptyArchive : true , artifacts : ' kw_report_linux.csv'
111+ }
112+
113+ }
114+ }
115+ stage(' Windows Scans' ){
116+ agent { label ' openamt-win' }
117+ stages{
118+ stage (' Windows Scans - klocwork' ) {
119+ environment {
120+ PROJECT_NAME = ' OpenAMT - RPC - Windows'
121+ SCANNERS = ' klocwork'
122+
123+ // klocwork details
124+ KLOCWORK_SCAN_TYPE = ' c++'
125+ KLOCWORK_PRE_BUILD_SCRIPT = ' scripts\\ jenkins-pre-build.cmd'
126+ KLOCWORK_BUILD_COMMAND = ' scripts\\ jenkins-build.cmd'
127+ KLOCWORK_IGNORE_COMPILE_ERRORS = true
128+
129+ // publishArtifacts details
130+ PUBLISH_TO_ARTIFACTORY = true
131+ }
132+ steps {
133+ rbheStaticCodeScan()
134+ dir(' artifacts\\ Klockwork' ){
135+ bat ' copy kw_report.html kw_report_windows.html'
136+ bat ' copy kw_report.csv kw_report_windows.csv'
137+ stash includes : ' kw_report_windows.*' , name : ' win-kwreports'
138+ archiveArtifacts allowEmptyArchive : true , artifacts : ' kw_report_windows.html'
139+ archiveArtifacts allowEmptyArchive : true , artifacts : ' kw_report_windows.csv'
166140 }
167141 }
168142 }
169143 }
170144 }
145+ stage(' Publish Artifacts' ){
146+ steps{
147+ dir(' artifacts/Klockwork' ){
148+ unstash ' win-kwreports'
149+ }
150+ publishArtifacts()
151+ }
152+ }
171153 }
172154}
0 commit comments