-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathJenkinsfile
160 lines (156 loc) · 6.54 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
155
156
157
158
159
160
@Library('shared-libraries') _
def runTests(String type,String version){
copyRPM type,version
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
sh '''
export JAVA_HOME=$JAVA_HOME_DIR
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
export PATH=$JAVA_HOME/bin:$GRADLE_USER_HOME:${NODE_HOME_DIR}/bin:$PATH
cd node-client-api
node --version
npm --version
npm ci
cd test-app
./gradlew -i mlDeploy -g $PWD
cd ..
rm -rf $WORKSPACE/*.xml || true
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-reports.xml -g \'logging|archivePath\' --invert || true
./node_modules/.bin/gulp setupProxyTests || true
./node_modules/.bin/mocha --timeout 10000 -R xunit test-basic-proxy/lib/**/*.js --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-basic-proxy-reports.xml -g \'logging|archivePath\' --invert || true
node etc/test-teardown.js -u admin:admin
'''
}
def runAuditReport(){
sh '''
export PATH=${NODE_HOME_DIR}/bin:$PATH
cd node-client-api
npm ci
rm -rf $WORKSPACE/npm-audit-report.json || true
npm audit -json || true > $WORKSPACE/npm-audit-report.json
'''
}
def runE2ETests(String type,String version){
copyRPM type,version
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
sh '''
export PATH=${NODE_HOME_DIR}/bin:$PATH
cd node-client-api
node --version
npm --version
npm ci
node etc/test-setup-qa.js
# Adding sleep for the setups to complete before running test-complete
sleep 10
node etc/test-setup-dmsdk-qa.js
sleep 10
node config-optic/setupqa.js
sleep 30
cd test-complete-app
./gradlew -i mlDeploy -g $PWD
cd ..
./node_modules/.bin/mocha --no-parallel -R xunit --timeout 60000 test-complete/ --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/test-complete-results.xml || true
cd test-complete-proxy
npm install --global gulp-cli
gulp loadToModulesDB
gulp generateFnClasses
gulp copyFnClasses
# Adding sleep for the gulp commands to complete.
sleep 30
cp *.js ../test-complete/
cp -R ml-modules/ ../test-complete
cd ../test-complete
../node_modules/.bin/mocha -R xunit --timeout 60000 nodejs-ds-setup-docs.js
../node_modules/.bin/mocha -R xunit --timeout 60000 "nodejs-ds-required-params.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-required-params-results.xml || true
../node_modules/.bin/mocha -R xunit --timeout 60000 "nodejs-ds-error-map.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
../node_modules/.bin/mocha -R xunit --timeout 60000 -R xunit "nodejs-ds-multipleWorker.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-multipleWorker-results.xml || true
../node_modules/.bin/mocha -R xunit --timeout 60000 -R xunit "nodejs-ds-transactions.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-transactions-results.js.xml || true
../node_modules/.bin/mocha -R xunit --timeout 60000 -R xunit "nodejs-ds-dynamic.js" --reporter mocha-junit-reporter --reporter-options mochaFile=$WORKSPACE/ds-dynamic-results.xml || true
'''
junit '**/*.xml'
}
pipeline{
agent none
triggers{
parameterizedCron(env.BRANCH_NAME == "develop" ? "00 02 * * * % regressions=true" : "")
}
parameters{
booleanParam(name: 'regressions', defaultValue: false, description: 'indicator if build is for regressions')
}
options {
checkoutToSubdirectory 'node-client-api'
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10')
}
environment{
NODE_HOME_DIR= "/home/builder/nodeJs/node-v18.14.0-linux-x64"
DMC_USER = credentials('MLBUILD_USER')
DMC_PASSWORD = credentials('MLBUILD_PASSWORD')
GRADLE_DIR=".gradle"
JAVA_HOME_DIR="/home/builder/java/openjdk-1.8.0-262"
}
stages{
stage('runtests-11.3.0'){
agent {label 'nodeclientpool'}
steps{
runAuditReport()
runTests('Release','11.3.0')
runE2ETests('Release','11.3.0')
}
}
stage('regressions'){
parallel{
stage('runtests-11-nightly'){
when{
allOf{
branch 'develop'
expression {return params.regressions}
}
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','11')
runE2ETests('Latest','11')
}
}
stage('runtests-12-nightly'){
when{
allOf{
branch 'develop'
expression {return params.regressions}
}
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','12.0')
runE2ETests('Latest','12.0')
}
}
stage('runtests-10-nightly'){
when{
allOf{
branch 'develop'
expression {return params.regressions}
}
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','10.0')
runE2ETests('Latest','10.0')
}
}
stage('runtests-10.0-10.2'){
when{
allOf{
branch 'develop'
expression {return params.regressions}
}
}
agent {label 'nodeclientpool'}
steps{
runTests('Release','10.0-10.2')
runE2ETests('Release','10.0-10.2')
}
}
}
}
}
}