11@Library (' shared-libraries' ) _
22
3- def runTests (){
4- sh '''
5- export JAVA_HOME=$JAVA_HOME_DIR
6- export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
7- export PATH=$JAVA_HOME/bin:$GRADLE_USER_HOME:${NODE_HOME_DIR}/bin:$PATH
8- cd node-client-api
9- node --version
10- npm --version
11- npm ci
12-
13- cd test-app
14- ./gradlew -i mlTestConnections
15- ./gradlew -i mlDeploy
16-
17- cd ..
18- rm -rf $WORKSPACE/*.xml || true
19- ./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
20- ./node_modules/.bin/gulp setupProxyTests || true
21- ./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
22- '''
3+ def runTests () {
4+ sh label : ' deploy-test-app-and-run-tests' , script : '''
5+ export JAVA_HOME=$JAVA_HOME_DIR
6+ export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
7+ export PATH=$JAVA_HOME/bin:$GRADLE_USER_HOME:${NODE_HOME_DIR}/bin:$PATH
8+ cd node-client-api
9+ node --version
10+ npm --version
11+ npm ci
12+
13+ cd test-app
14+ ./gradlew -i mlTestConnections
15+ ./gradlew -i mlDeploy
2316
17+ cd ..
18+ rm -rf $WORKSPACE/*.xml || true
19+ ./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
20+ ./node_modules/.bin/gulp setupProxyTests || true
21+ ./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
22+ '''
2423}
2524
2625def runDockerCompose (String markLogicDockerImage ) {
27- cleanupDocker()
28- sh label :' mlsetup ' , script : ''' #!/bin/bash
26+ cleanupDocker()
27+ sh label : ' run-docker-compose ' , script : ''' #!/bin/bash
2928 echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
3029 sudo /usr/local/sbin/mladmin remove
3130 docker-compose down -v || true
3231 sudo /usr/local/sbin/mladmin cleandata
3332 cd node-client-api/test-app
34- MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE=''' + markLogicDockerImage+ ''' docker-compose up -d --build
33+ MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE=''' + markLogicDockerImage + ''' docker-compose up -d --build
3534 sleep 60s;
36- '''
35+ '''
3736}
3837
3938def teardownAfterTests () {
40- updateWorkspacePermissions()
41- sh label :' mlcleanup ' , script : ''' #!/bin/bash
39+ updateWorkspacePermissions()
40+ sh label : ' teardown-docker ' , script : ''' #!/bin/bash
4241 cd node-client-api/test-app
4342 docker-compose down -v || true
4443 '''
45- cleanupDocker()
44+ cleanupDocker()
4645}
4746
48- def runAuditReport (){
49- sh '''
50- export PATH=${NODE_HOME_DIR}/bin:$PATH
51- cd node-client-api
52- npm ci
53- rm -rf $WORKSPACE/npm-audit-report.json || true
54- npm audit -json || true > $WORKSPACE/npm-audit-report.json
55- '''
47+ def runAuditReport () {
48+ sh label : ' run-audit-report ' , script : '''
49+ export PATH=${NODE_HOME_DIR}/bin:$PATH
50+ cd node-client-api
51+ npm ci
52+ rm -rf $WORKSPACE/npm-audit-report.json || true
53+ npm audit -json || true > $WORKSPACE/npm-audit-report.json
54+ '''
5655}
5756
58- def runE2ETests (){
59- sh '''
60- export PATH=${NODE_HOME_DIR}/bin:$PATH
61- cd node-client-api
62- node --version
63- npm --version
64- npm ci
65- node etc/test-setup-qa.js
66- # Adding sleep for the setups to complete before running test-complete
67- sleep 10
68- node etc/test-setup-dmsdk-qa.js
69- sleep 10
70- node config-optic/setupqa.js
71- sleep 30
72- cd test-complete-app
73- ./gradlew -i mlDeploy -g $PWD
74- cd ..
75- ./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
76- cd test-complete-proxy
77- npm install gulp-cli
78- gulp loadToModulesDB
79- gulp generateFnClasses
80- gulp copyFnClasses
81- # Adding sleep for the gulp commands to complete.
82- sleep 30
83- cp *.js ../test-complete/
84- cp -R ml-modules/ ../test-complete
85- cd ../test-complete
86- ../node_modules/.bin/mocha -R xunit --timeout 60000 nodejs-ds-setup-docs.js
87- ../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
88- ../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
89- ../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
90- ../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
91- ../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
92- '''
93- junit ' **/*.xml'
57+ def runE2ETests () {
58+ sh label : ' run-e2e-tests ' , script : '''
59+ export PATH=${NODE_HOME_DIR}/bin:$PATH
60+ cd node-client-api
61+ node --version
62+ npm --version
63+ npm ci
64+ node etc/test-setup-qa.js
65+ # Adding sleep for the setups to complete before running test-complete
66+ sleep 10
67+ node etc/test-setup-dmsdk-qa.js
68+ sleep 10
69+ node config-optic/setupqa.js
70+ sleep 30
71+ cd test-complete-app
72+ ./gradlew -i mlDeploy -g $PWD
73+ cd ..
74+ ./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
75+ cd test-complete-proxy
76+ npm install gulp-cli
77+ gulp loadToModulesDB
78+ gulp generateFnClasses
79+ gulp copyFnClasses
80+ # Adding sleep for the gulp commands to complete.
81+ sleep 30
82+ cp *.js ../test-complete/
83+ cp -R ml-modules/ ../test-complete
84+ cd ../test-complete
85+ ../node_modules/.bin/mocha -R xunit --timeout 60000 nodejs-ds-setup-docs.js
86+ ../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
87+ ../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
88+ ../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
89+ ../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
90+ ../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
91+ '''
92+ junit ' **/*.xml'
9493}
9594
96- pipeline{
97- agent none
98-
99- triggers{
100- parameterizedCron(env. BRANCH_NAME == " develop" ? " 00 02 * * * % regressions=true" : " " )
101- }
102-
103- parameters{
104- booleanParam(name : ' regressions' , defaultValue : false , description : ' indicator if build is for regressions' )
105- }
106-
107- options {
108- checkoutToSubdirectory ' node-client-api'
109- buildDiscarder logRotator(artifactDaysToKeepStr : ' 7' , artifactNumToKeepStr : ' ' , daysToKeepStr : ' 7' , numToKeepStr : ' 10' )
110- }
111-
112- environment{
113- NODE_HOME_DIR = " /users/ml/builder/nodeJs/node-v22.20.0-linux-x64"
114- DMC_USER = credentials(' MLBUILD_USER' )
115- DMC_PASSWORD = credentials(' MLBUILD_PASSWORD' )
116- GRADLE_DIR = " .gradle"
117- JAVA_HOME_DIR = " /home/builder/java/jdk-17.0.2"
118- }
119- stages{
120- stage(' runtests-11.3.1' ){
121- agent {label ' nodeclientpool' }
122- steps{
123- runAuditReport()
124- runDockerCompose(' progressofficial/marklogic-db:latest-11.3' )
125- runTests()
126- runE2ETests()
127- }
128- post{
129- always{
130- teardownAfterTests()
131- }
132- }
133- }
134- stage(' regressions' ){
135- parallel{
136- stage(' runtests-11-nightly' ){
137- when{
138- allOf{
139- branch ' develop'
140- expression {return params. regressions}
141- }
142- }
143- agent {label ' nodeclientpool' }
144- steps{
145- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11' )
146- runTests()
147- runE2ETests()
148- }
149- post{
150- always{
151- teardownAfterTests()
152- }
153- }
154- }
155- stage(' runtests-12-nightly' ){
156- when{
157- allOf{
158- branch ' develop'
159- expression {return params. regressions}
160- }
161- }
162- agent {label ' nodeclientpool' }
163- steps{
164- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12' )
165- runTests()
166- runE2ETests()
167- }
168- post{
169- always{
170- teardownAfterTests()
171- }
172- }
173- }
174- stage(' runtests-10-nightly' ){
175- when{
176- allOf{
177- branch ' develop'
178- expression {return params. regressions}
179- }
180- }
181- agent {label ' nodeclientpool' }
182- steps{
183- runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10' )
184- runTests()
185- runE2ETests()
186- }
187- post{
188- always{
189- teardownAfterTests()
190- }
191- }
192- }
193- }
194- }
195- }
196- }
95+ pipeline {
96+ agent none
97+
98+ triggers {
99+ parameterizedCron(env. BRANCH_NAME == " develop" ? " 00 02 * * * % regressions=true" : " " )
100+ }
101+
102+ parameters {
103+ booleanParam(name : ' regressions' , defaultValue : false , description : ' indicator if build is for regressions' )
104+ }
105+
106+ options {
107+ checkoutToSubdirectory ' node-client-api'
108+ buildDiscarder logRotator(artifactDaysToKeepStr : ' 7' , artifactNumToKeepStr : ' ' , daysToKeepStr : ' 7' , numToKeepStr : ' 10' )
109+ }
110+
111+ environment {
112+ NODE_HOME_DIR = " /users/ml/builder/nodeJs/node-v22.20.0-linux-x64"
113+ DMC_USER = credentials(' MLBUILD_USER' )
114+ DMC_PASSWORD = credentials(' MLBUILD_PASSWORD' )
115+ GRADLE_DIR = " .gradle"
116+ JAVA_HOME_DIR = " /home/builder/java/jdk-17.0.2"
117+ }
118+
119+ stages {
120+
121+ stage(' runtests-11.3.1' ) {
122+ agent { label ' nodeclientpool' }
123+ steps {
124+ runAuditReport()
125+ runDockerCompose(' progressofficial/marklogic-db:latest-11.3' )
126+ runTests()
127+ runE2ETests()
128+ }
129+ post {
130+ always {
131+ teardownAfterTests()
132+ }
133+ }
134+ }
135+
136+ stage(' regressions' ) {
137+ parallel {
138+
139+ stage(' runtests-11-nightly' ) {
140+ when {
141+ allOf {
142+ branch ' develop'
143+ expression { return params. regressions }
144+ }
145+ }
146+ agent { label ' nodeclientpool' }
147+ steps {
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+ }
156+ }
157+ }
158+
159+ stage(' runtests-12-nightly' ) {
160+ when {
161+ allOf {
162+ branch ' develop'
163+ expression { return params. regressions }
164+ }
165+ }
166+ agent { label ' nodeclientpool' }
167+ steps {
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+ }
176+ }
177+ }
178+
179+ stage(' runtests-10-nightly' ) {
180+ when {
181+ allOf {
182+ branch ' develop'
183+ expression { return params. regressions }
184+ }
185+ }
186+ agent { label ' nodeclientpool' }
187+ steps {
188+ runDockerCompose(' ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10' )
189+ runTests()
190+ runE2ETests()
191+ }
192+ post {
193+ always {
194+ teardownAfterTests()
195+ }
196+ }
197+ }
198+ }
199+ }
200+ }
201+ }
0 commit comments