-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
62 lines (57 loc) · 2.17 KB
/
Jenkinsfile
File metadata and controls
62 lines (57 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@Library('shared-libraries') _
pipeline{
agent none;
environment{
JAVA_HOME_DIR="/home/builder/java/jdk-17.0.2"
GRADLE_DIR =".gradle"
}
options {
checkoutToSubdirectory 'marklogic-python-client'
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '5')
}
stages{
stage('tests'){
agent {label 'devExpLinuxPool'}
steps{
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 marklogic-python-client/test-app
MARKLOGIC_LOGS_VOLUME=/tmp docker-compose up -d --build
'''
sh label:'deploy project', script: '''#!/bin/bash
export JAVA_HOME=$JAVA_HOME_DIR
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
cd marklogic-python-client/test-app
./gradlew -i mlWaitTillReady
./gradlew -i mlDeploy -PmlPassword=admin
'''
// 'set -e' causes the script to fail if any command fails.
sh label:'Run tests', script: '''#!/bin/bash
set -e
cd marklogic-python-client
python -m venv .venv;
source .venv/bin/activate;
pip install poetry;
poetry install;
pytest --junitxml=TestReport.xml || true
'''
junit 'marklogic-python-client/TestReport.xml'
}
post{
always{
updateWorkspacePermissions()
sh label:'mlcleanup', script: '''#!/bin/bash
cd marklogic-python-client/test-app
docker-compose down -v || true
'''
cleanupDocker()
}
}
}
}
}