11@Library (' shared-libraries' ) _
22
3- def runTests (String type ,String version ){
4- copyRPM type,version
5- setUpML ' $WORKSPACE/xdmp/src/Mark*.rpm'
6- sh '''
7- export JAVA_HOME=$JAVA_HOME_DIR
8- export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
9- export PATH=$JAVA_HOME/bin:$GRADLE_USER_HOME:${NODE_HOME_DIR}/bin:$PATH
10- cd node-client-api
11- node --version
12- npm --version
13- npm ci
14- cd test-app
15- ./gradlew -i mlDeploy -g $PWD
16- cd ..
17- rm -rf $WORKSPACE/*.xml || true
18- ./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
19- ./node_modules/.bin/gulp setupProxyTests || true
20- ./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
3+ def runDockerCompose (String markLogicDockerImage ) {
4+ cleanupDocker()
5+ sh label :' mlsetup' , script : ''' #!/bin/bash
6+ echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
7+ sudo /usr/local/sbin/mladmin remove
8+ docker-compose down -v || true
9+ sudo /usr/local/sbin/mladmin cleandata
10+ cd node-client-api/test-app
11+ MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE=''' + markLogicDockerImage+ ''' docker-compose up -d --build
12+ sleep 30s;
2113 '''
14+ }
2215
16+ def runTests () {
17+ sh label :' deploy ml-gradle test application' , script : ''' #!/bin/bash
18+ export JAVA_HOME=$JAVA17_HOME_DIR
19+ export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
20+ export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
21+ cd node-client-api/test-app
22+ ./gradlew -i mlTestConnections
23+ ./gradlew -i mlDeploy
24+ '''
25+
26+ sh label :' test' , script : ''' #!/bin/bash
27+ cd node-client-api
28+ node --version
29+ npm --version
30+ npm ci
31+ rm -rf $WORKSPACE/*.xml || true
32+ ./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
33+ ./node_modules/.bin/gulp setupProxyTests || true
34+ ./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
35+ '''
2336}
37+
38+ def teardownAfterTests () {
39+ updateWorkspacePermissions()
40+ sh label :' mlcleanup' , script : ''' #!/bin/bash
41+ cd node-client-api/test-app
42+ docker-compose down -v || true
43+ '''
44+ cleanupDocker()
45+ }
46+
2447def runAuditReport (){
2548 sh '''
2649 export PATH=${NODE_HOME_DIR}/bin:$PATH
@@ -31,9 +54,7 @@ def runAuditReport(){
3154 '''
3255}
3356
34- def runE2ETests (String type ,String version ){
35- copyRPM type,version
36- setUpML ' $WORKSPACE/xdmp/src/Mark*.rpm'
57+ def runE2ETests (){
3758 sh '''
3859 export PATH=${NODE_HOME_DIR}/bin:$PATH
3960 cd node-client-api
@@ -71,34 +92,48 @@ def runE2ETests(String type,String version){
7192 junit ' **/*.xml'
7293
7394}
95+
7496pipeline{
7597 agent none
98+
7699 triggers{
77100 parameterizedCron(env. BRANCH_NAME == " develop" ? " 00 02 * * * % regressions=true" : " " )
78101 }
102+
79103 parameters{
80104 booleanParam(name : ' regressions' , defaultValue : false , description : ' indicator if build is for regressions' )
81105 }
106+
82107 options {
83108 checkoutToSubdirectory ' node-client-api'
84109 buildDiscarder logRotator(artifactDaysToKeepStr : ' 7' , artifactNumToKeepStr : ' ' , daysToKeepStr : ' 7' , numToKeepStr : ' 10' )
85110 }
111+
86112 environment{
87113 NODE_HOME_DIR = " /users/ml/builder/nodeJs/node-v22.20.0-linux-x64"
88114 DMC_USER = credentials(' MLBUILD_USER' )
89115 DMC_PASSWORD = credentials(' MLBUILD_PASSWORD' )
90116 GRADLE_DIR = " .gradle"
91117 JAVA_HOME_DIR = " /home/builder/java/jdk-17.0.2"
92118 }
93- stages{
94- stage(' runtests-11.3.1' ){
119+
120+ stages {
121+
122+ stage(' runtests-12-nightly' ){
95123 agent {label ' nodeclientpool' }
96124 steps{
97125 runAuditReport()
98- runTests(' Release' ,' 11.3.1' )
99- runE2ETests(' Release' ,' 11.3.1' )
126+ runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12' )
127+ runTests()
128+ runE2ETests()
129+ }
130+ post{
131+ always{
132+ teardownAfterTests()
133+ }
100134 }
101135 }
136+
102137 stage(' regressions' ){
103138 parallel{
104139 stage(' runtests-11-nightly' ){
@@ -110,10 +145,17 @@ pipeline{
110145 }
111146 agent {label ' nodeclientpool' }
112147 steps{
113- runTests(' Latest' ,' 11' )
114- runE2ETests(' Latest' ,' 11' )
148+ runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11' )
149+ runTests()
150+ runE2ETests()
151+ }
152+ post{
153+ always{
154+ teardownAfterTests()
155+ }
115156 }
116157 }
158+
117159 stage(' runtests-12-nightly' ){
118160 when{
119161 allOf{
@@ -123,10 +165,17 @@ pipeline{
123165 }
124166 agent {label ' nodeclientpool' }
125167 steps{
126- runTests(' Latest' ,' 12.0' )
127- runE2ETests(' Latest' ,' 12.0' )
168+ runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12' )
169+ runTests()
170+ runE2ETests()
171+ }
172+ post{
173+ always{
174+ teardownAfterTests()
175+ }
128176 }
129177 }
178+
130179 stage(' runtests-10-nightly' ){
131180 when{
132181 allOf{
@@ -136,21 +185,14 @@ pipeline{
136185 }
137186 agent {label ' nodeclientpool' }
138187 steps{
139- runTests(' Latest' ,' 10.0' )
140- runE2ETests(' Latest' ,' 10.0' )
188+ runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10' )
189+ runTests()
190+ runE2ETests()
141191 }
142- }
143- stage(' runtests-10.0-10.2' ){
144- when{
145- allOf{
146- branch ' develop'
147- expression {return params. regressions}
148- }
192+ post{
193+ always{
194+ teardownAfterTests()
149195 }
150- agent {label ' nodeclientpool' }
151- steps{
152- runTests(' Release' ,' 10.0-10.2' )
153- runE2ETests(' Release' ,' 10.0-10.2' )
154196 }
155197 }
156198 }
0 commit comments