Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 64 additions & 27 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@Library('shared-libraries') _

def runTests(String type,String version){
copyRPM type,version
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
def runTests(){
sh '''
export JAVA_HOME=$JAVA_HOME_DIR
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
Expand All @@ -11,8 +9,11 @@ def runTests(String type,String version){
node --version
npm --version
npm ci
cd test-app
./gradlew -i mlDeploy -g $PWD
./gradlew -i mlTestConnections
./gradlew -i mlDeploy
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
Expand All @@ -21,6 +22,29 @@ def runTests(String type,String version){
'''

}

def runDockerCompose(String markLogicDockerImage) {
cleanupDocker()
sh label:'mlsetup', script: '''#!/bin/bash
echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
sudo /usr/local/sbin/mladmin remove
docker-compose down -v || true
sudo /usr/local/sbin/mladmin cleandata
cd node-client-api/test-app
MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE='''+markLogicDockerImage+''' docker-compose up -d --build
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using /tmp for log volume could lead to log loss and potential disk space issues. Consider using a more persistent location or making this configurable.

Suggested change
MARKLOGIC_LOGS_VOLUME=/tmp MARKLOGIC_IMAGE='''+markLogicDockerImage+''' docker-compose up -d --build
MARKLOGIC_LOGS_VOLUME=$WORKSPACE/marklogic-logs MARKLOGIC_IMAGE='''+markLogicDockerImage+''' docker-compose up -d --build

Copilot uses AI. Check for mistakes.
sleep 60s;
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded 60-second sleep is a fragile approach for waiting for container readiness. Consider using a health check or polling mechanism to verify MarkLogic is actually ready before proceeding.

Suggested change
sleep 60s;
# Wait for MarkLogic to be ready by polling the HTTP endpoint
echo "Waiting for MarkLogic to become ready..."
for i in {1..30}; do
if curl -s http://localhost:8001/ > /dev/null; then
echo "MarkLogic is ready!"
break
else
echo "MarkLogic not ready yet, waiting..."
sleep 2
fi
if [ $i -eq 30 ]; then
echo "MarkLogic did not become ready in time." >&2
exit 1
fi
done

Copilot uses AI. Check for mistakes.
'''
}

def teardownAfterTests() {
updateWorkspacePermissions()
sh label:'mlcleanup', script: '''#!/bin/bash
cd node-client-api/test-app
docker-compose down -v || true
'''
cleanupDocker()
}

def runAuditReport(){
sh '''
export PATH=${NODE_HOME_DIR}/bin:$PATH
Expand All @@ -31,9 +55,7 @@ def runAuditReport(){
'''
}

def runE2ETests(String type,String version){
copyRPM type,version
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
def runE2ETests(){
sh '''
export PATH=${NODE_HOME_DIR}/bin:$PATH
cd node-client-api
Expand Down Expand Up @@ -69,20 +91,24 @@ def runE2ETests(String type,String version){
../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= "/users/ml/builder/nodeJs/node-v22.20.0-linux-x64"
DMC_USER = credentials('MLBUILD_USER')
Expand All @@ -95,8 +121,14 @@ pipeline{
agent {label 'nodeclientpool'}
steps{
runAuditReport()
runTests('Release','11.3.1')
runE2ETests('Release','11.3.1')
runDockerCompose('progressofficial/marklogic-db:latest-11.3')
runTests()
runE2ETests()
}
post{
always{
teardownAfterTests()
}
}
}
stage('regressions'){
Expand All @@ -110,8 +142,14 @@ pipeline{
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','11')
runE2ETests('Latest','11')
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-11')
runTests()
runE2ETests()
}
post{
always{
teardownAfterTests()
}
}
}
stage('runtests-12-nightly'){
Expand All @@ -123,8 +161,14 @@ pipeline{
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','12.0')
runE2ETests('Latest','12.0')
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-12')
runTests()
runE2ETests()
}
post{
always{
teardownAfterTests()
}
}
}
stage('runtests-10-nightly'){
Expand All @@ -136,21 +180,14 @@ pipeline{
}
agent {label 'nodeclientpool'}
steps{
runTests('Latest','10.0')
runE2ETests('Latest','10.0')
runDockerCompose('ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi:latest-10')
runTests()
runE2ETests()
}
}
stage('runtests-10.0-10.2'){
when{
allOf{
branch 'develop'
expression {return params.regressions}
}
post{
always{
teardownAfterTests()
}
agent {label 'nodeclientpool'}
steps{
runTests('Release','10.0-10.2')
runE2ETests('Release','10.0-10.2')
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"serialize-javascript": "6.0.2",
"supports-color": "7.2.0",
"strip-ansi": "6.0.0",
"tar-fs": "2.1.3",
"tar-fs": "2.1.4",
"tmp": "0.2.4",
"wrap-ansi": "6.2.0"
}
Expand Down
27 changes: 0 additions & 27 deletions test-app/docker-compose-nightlies.yaml

This file was deleted.

7 changes: 4 additions & 3 deletions test-app/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: node-client
name: docker-tests-node-client

services:

Expand All @@ -13,5 +13,6 @@ services:
volumes:
- ${MARKLOGIC_LOGS_VOLUME}:/var/opt/MarkLogic/Logs
ports:
- 8000-8002:8000-8002
- 8015-8017:8015-8017
- 8000-8017:8000-8017
- 8024-8029:8024-8029
- 8079:8079