Skip to content

Commit 6bbfaf3

Browse files
committed
Adding the bare minimum to switch to Docker
1 parent 8078b80 commit 6bbfaf3

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed

Jenkinsfile

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,51 @@ def runTests(String type,String version){
2121
'''
2222

2323
}
24+
25+
def runDockerCompose(String markLogicDockerImage) {
26+
cleanupDocker()
27+
sh label:'mlsetup', script: '''#!/bin/bash
28+
echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
29+
sudo /usr/local/sbin/mladmin remove
30+
docker-compose down -v || true
31+
sudo /usr/local/sbin/mladmin cleandata
32+
cd node-client-api/test-app
33+
MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE='''+markLogicDockerImage+''' docker-compose up -d --build
34+
sleep 60s;
35+
'''
36+
}
37+
38+
def runDockerTests() {
39+
sh label:'deploy ml-gradle test application', script: '''#!/bin/bash
40+
export JAVA_HOME=$JAVA17_HOME_DIR
41+
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
42+
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH:${NODE_HOME_DIR}/bin:$PATH
43+
44+
cd node-client-api/test-app
45+
./gradlew -i mlTestConnections
46+
./gradlew -i mlDeploy
47+
48+
cd ..
49+
node --version
50+
npm --version
51+
npm ci
52+
rm -rf $WORKSPACE/*.xml || true
53+
54+
./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
55+
./node_modules/.bin/gulp setupProxyTests || true
56+
./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
57+
'''
58+
}
59+
60+
def teardownAfterTests() {
61+
updateWorkspacePermissions()
62+
sh label:'mlcleanup', script: '''#!/bin/bash
63+
cd node-client-api/test-app
64+
docker-compose down -v || true
65+
'''
66+
cleanupDocker()
67+
}
68+
2469
def runAuditReport(){
2570
sh '''
2671
export PATH=${NODE_HOME_DIR}/bin:$PATH
@@ -69,20 +114,24 @@ def runE2ETests(String type,String version){
69114
../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
70115
'''
71116
junit '**/*.xml'
72-
73117
}
118+
74119
pipeline{
75120
agent none
121+
76122
triggers{
77123
parameterizedCron(env.BRANCH_NAME == "develop" ? "00 02 * * * % regressions=true" : "")
78124
}
125+
79126
parameters{
80127
booleanParam(name: 'regressions', defaultValue: false, description: 'indicator if build is for regressions')
81128
}
129+
82130
options {
83131
checkoutToSubdirectory 'node-client-api'
84132
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10')
85133
}
134+
86135
environment{
87136
NODE_HOME_DIR= "/users/ml/builder/nodeJs/node-v22.20.0-linux-x64"
88137
DMC_USER = credentials('MLBUILD_USER')
@@ -95,8 +144,15 @@ pipeline{
95144
agent {label 'nodeclientpool'}
96145
steps{
97146
runAuditReport()
98-
runTests('Release','11.3.1')
99-
runE2ETests('Release','11.3.1')
147+
runDockerCompose('progressofficial/marklogic-db:latest-11.3')
148+
runDockerTests()
149+
// runTests('Release','11.3.1')
150+
// runE2ETests('Release','11.3.1')
151+
}
152+
post{
153+
always{
154+
teardownAfterTests()
155+
}
100156
}
101157
}
102158
stage('regressions'){

0 commit comments

Comments
 (0)