11@Library (' shared-libraries' ) _
2+
23pipeline{
4+
35 agent none;
6+
47 environment{
5- JAVA_HOME_DIR = " /home/builder/java/jdk-11 .0.2"
8+ JAVA_HOME_DIR = " /home/builder/java/jdk-17 .0.2"
69 GRADLE_DIR = " .gradle"
710 }
11+
812 options {
913 checkoutToSubdirectory ' marklogic-python-client'
10- buildDiscarder logRotator(artifactDaysToKeepStr : ' 7' , artifactNumToKeepStr : ' ' , daysToKeepStr : ' 30' , numToKeepStr : ' ' )
14+ buildDiscarder logRotator(artifactDaysToKeepStr : ' 7' , artifactNumToKeepStr : ' ' , daysToKeepStr : ' 30' , numToKeepStr : ' 5 ' )
1115 }
16+
1217 stages{
1318 stage(' tests' ){
1419 agent {label ' devExpLinuxPool' }
1520 steps{
16- script{
17- copyRPM ' Latest' ,' 11'
18- setUpML ' $WORKSPACE/xdmp/src/Mark*.rpm'
19- sh label :' deploy project' , script : ''' #!/bin/bash
20- export JAVA_HOME=$JAVA_HOME_DIR
21- export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
22- export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
23- cd marklogic-python-client/test-app
24- ./gradlew -i mlDeploy -PmlPassword=admin
25- '''
26- sh label :' Run tests' , script : ''' #!/bin/bash
27- cd marklogic-python-client
28- python -m venv .venv;
29- source .venv/bin/activate;
30- pip install poetry;
31- poetry install;
32- pytest --junitxml=TestReport.xml || true
33- '''
34- junit ' marklogic-python-client/TestReport.xml'
35- }
21+ cleanupDocker()
22+ sh label :' mlsetup' , script : ''' #!/bin/bash
23+ echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
24+ sudo /usr/local/sbin/mladmin remove
25+ docker-compose down -v || true
26+ sudo /usr/local/sbin/mladmin cleandata
27+ cd marklogic-python-client/test-app
28+ MARKLOGIC_LOGS_VOLUME=/tmp docker-compose up -d --build
29+ echo "Waiting for MarkLogic server to initialize."
30+ sleep 30s
31+ '''
32+ sh label :' deploy project' , script : ''' #!/bin/bash
33+ export JAVA_HOME=$JAVA_HOME_DIR
34+ export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
35+ export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
36+ cd marklogic-python-client/test-app
37+ ./gradlew -i mlDeploy -PmlPassword=admin
38+ '''
39+ sh label :' Run tests' , script : ''' #!/bin/bash
40+ cd marklogic-python-client
41+ python -m venv .venv;
42+ source .venv/bin/activate;
43+ pip install poetry;
44+ poetry install;
45+ pytest --junitxml=TestReport.xml || true
46+ '''
47+ junit ' marklogic-python-client/TestReport.xml'
48+ }
49+ post{
50+ always{
51+ updateWorkspacePermissions()
52+ sh label :' mlcleanup' , script : ''' #!/bin/bash
53+ cd marklogic-python-client/test-app
54+ docker-compose down -v || true
55+ '''
56+ cleanupDocker()
57+ }
3658 }
3759 }
3860 }
39- }
61+ }
0 commit comments