Skip to content

Commit 93d08ee

Browse files
authored
Merge pull request #778 from marklogic/release/6.0.0
MLE-22591 Merge release/6.0.0 into master
2 parents 5dbed0b + 3e98d60 commit 93d08ee

File tree

1,024 files changed

+9400
-15299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,024 files changed

+9400
-15299
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MARKLOGIC_IMAGE=ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12
2+
MARKLOGIC_LOGS_PATH=./docker/marklogic/logs

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ out
1616
gradle-local.properties
1717
snyk
1818
.vscode
19+
docker
20+
dep.txt

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Each line is a file pattern followed by one or more owners.
33

44
# These owners will be the default owners for everything in the repo.
5-
* @anu3990 @billfarber @rjrudin
5+
* @anu3990 @billfarber @rjrudin @stevebio

CONTRIBUTING.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@
22

33
Here's how to get started with making contributions to this project:
44

5-
1. Install a JDK (Java Development Kit) version 9 or higher. (If you're working with ml-gradle 2.x or 3.x, you only need Java 8.)
5+
1. Install a JDK (Java Development Kit) version 8 or higher.
66
1. Clone this repository.
7-
1. Assuming you want to use Eclipse for development, run "gradlew eclipse" (or "gradle eclipse" if you have Gradle installed locally). This will generate Eclipse project files.
8-
1. Import your repository folder as a new project in Eclipse. Everything should compile successfully and you should be good to go.
9-
10-
To make contributions, check out the issues in the project and follow the below, subject-to-change process:
11-
12-
1. For a given issue, create a local branch with the name of the issue (I'll use issue #9 as an example): git checkout issue-9
13-
1. Track the local branch to a remote one: git push -u origin issue-9
14-
1. Do your work on that local feature branch, ideally making small commits. Push to remote as often as you'd like.
15-
1. When you're ready, submit a pull request from your feature branch for review.
16-
17-
Currently, I don't have any tests for ml-gradle, as most of the interesting functionality is in ml-app-deployer, where
18-
there are many automated tests. I also haven't found an easy way to test tasks or the MarkLogicPlugin class. So for the
19-
time being, don't worry about automated tests.
7+
1. Import your repository folder as a new project into your IDE. Everything should compile successfully and you should be good to go.
208

219
## Formatting
2210

@@ -25,14 +13,17 @@ either install that or follow the guidelines set in the file.
2513

2614
## How to test ml-gradle changes
2715

28-
This part is a little tricky - in order to really test ml-gradle, you need to build it and publish it to your local
29-
Maven repository (~/.m2) and then reference it in a separate Gradle file. Fortunately, the ./examples directory in this
30-
project has many projects that you can use for testing out your change to ml-gradle. Here's how to go about doing so:
16+
In order to test ml-gradle as a Gradle plugin, you need to build it and publish it to your local
17+
Maven repository (~/.m2) and then reference it in a separate Gradle file. The `./examples` directory in this
18+
project has many projects that you can use for testing out your change to ml-gradle, with the
19+
`./examples/local-testing-project` being intended for testing local changes to ml-gradle.
3120

32-
1. Make your changes to the ml-gradle source code
33-
1. Run "gradle -Pversion=issue-number publishToMavenLocal" (the version can be anything you want)
21+
To build and publish ml-gradle locally, perform the following steps:
3422

35-
Then pick a project under ./examples, and replace the "plugins" block with the following code:
23+
1. Make your changes to the ml-gradle source code.
24+
1. Run `gradle publishToMavenLocal`.
25+
26+
Then pick a project under `./examples`, and replace the `plugins` block with the following code:
3627

3728
buildscript {
3829
repositories {
@@ -45,15 +36,38 @@ Then pick a project under ./examples, and replace the "plugins" block with the f
4536
}
4637
apply plugin: "com.marklogic.ml-gradle"
4738

48-
The above unfortunately has to be done because while the "plugins" DSL in Gradle is very concise,
49-
it can't be used for finding plugins in your local Maven repository. So we have to
50-
replace it with the much more verbose syntax. Of course, after you're done testing with this, change the Gradle file
51-
back to just use the plugins DSL.
39+
The above has to be done because while the "plugins" DSL in Gradle is very concise, it can't be used for finding
40+
plugins in your local Maven repository.
5241

5342
After making the above changes, when you run any Gradle task, Gradle will use the ml-gradle plugin that you published
5443
to your local Maven repository.
5544

5645
You can then repeat this process as often as you want - i.e. make more changes in the ml-gradle source, publish a new
5746
copy to your local Maven repo, and test it in the project you chose.
5847

59-
For a real example, see the "local-testing-project" project in the examples directory.
48+
## Automated Testing
49+
50+
The automated tests for each of the three subprojects require access to a MarkLogic server, and the ml-javaclient-util &
51+
ml-gradle subprojects also require a test application deployed to it. To deploy that
52+
application in a new Docker container, run the following commands:
53+
54+
```
55+
docker compose up -d --build
56+
cd test-app
57+
../gradlew -i mlDeploy
58+
cd ..
59+
```
60+
61+
Once the test server and application are set up, you are ready to run the tests for each subproject. Those tests can be
62+
run in multiple ways, but the easiest is to simply use Gradle on the command-line as shown below.
63+
64+
```
65+
./gradlew ml-javaclient-util:test
66+
./gradlew ml-app-deployer:test
67+
./gradlew ml-gradle:test
68+
```
69+
70+
You can also run all tests via:
71+
72+
./gradlew test
73+

Jenkinsfile

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,76 @@
11
@Library('shared-libraries') _
22

3-
def runTests(String mlVersion, String javaVersion){
4-
copyRPM 'Release',mlVersion
5-
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'
6-
sh label:'test', script: '''#!/bin/bash
7-
export JAVA_HOME=$'''+javaVersion+'''
8-
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
9-
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
10-
cd $WORKSPACE/ml-gradle/ml-javaclient-util-test-app
11-
echo "mlPassword=admin" > gradle-local.properties
12-
../gradlew -i :mlDeploy
13-
cd $WORKSPACE/ml-gradle/
14-
./gradlew ml-javaclient-util:test || true
15-
./gradlew ml-app-deployer:test || true
16-
./gradlew ml-gradle:test || true
3+
def setupDockerMarkLogic(String image) {
4+
sh label:'mlsetup', script: '''#!/bin/bash
5+
echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
6+
sudo /usr/local/sbin/mladmin remove
7+
sudo /usr/local/sbin/mladmin cleandata
8+
cd ml-gradle
9+
docker-compose down -v || true
10+
docker volume prune -f
11+
echo "Using image: "'''+image+'''
12+
docker pull '''+image+'''
13+
MARKLOGIC_IMAGE='''+image+''' MARKLOGIC_LOGS_PATH=/tmp/marklogic/logs docker compose up -d --build
14+
echo "Waiting for MarkLogic server to initialize."
15+
sleep 60s
1716
'''
18-
junit '**/build/**/*.xml'
1917
}
2018

21-
pipeline{
22-
agent none
19+
def tearDownDocker() {
20+
sh label:'tearDownDocker', script: '''#!/bin/bash
21+
cd ml-gradle
22+
docker compose down -v || true
23+
docker volume prune -f
24+
sudo rm -rf /tmp/marklogic/logs
25+
'''
26+
}
27+
28+
pipeline {
29+
agent {label 'devExpLinuxPool'}
30+
2331
options {
2432
checkoutToSubdirectory 'ml-gradle'
25-
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
33+
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '5')
2634
}
27-
environment{
28-
JAVA11_HOME_DIR="/home/builder/java/jdk-11.0.20"
29-
JAVA8_HOME_DIR="/home/builder/java/openjdk-1.8.0-262"
30-
JAVA17_HOME_DIR="/home/builder/java/jdk-17.0.2"
31-
JAVA21_HOME_DIR="/home/builder/java/jdk-21.0.1"
35+
36+
environment {
37+
JAVA_HOME_DIR="/home/builder/java/jdk-17.0.2"
3238
GRADLE_DIR =".gradle"
3339
DMC_USER = credentials('MLBUILD_USER')
3440
DMC_PASSWORD = credentials('MLBUILD_PASSWORD')
3541
}
36-
stages{
37-
stage('tests-java11'){
38-
agent {label 'devExpLinuxPool'}
39-
steps{
40-
runTests('11.3.1','JAVA11_HOME_DIR')
41-
}
42-
}
43-
stage('regressions'){
44-
when {
45-
anyOf {
46-
branch 'dev'
47-
branch 'master'
48-
}
49-
beforeAgent true
50-
}
51-
parallel{
52-
stage('tests-java8'){
53-
agent {label 'devExpLinuxPool'}
54-
steps{
55-
runTests('11.3.1','JAVA8_HOME_DIR')
56-
}
57-
}
58-
stage('tests-java17'){
59-
agent {label 'devExpLinuxPool'}
60-
steps{
61-
runTests('11.3.1','JAVA17_HOME_DIR')
62-
}
63-
}
64-
stage('tests-java21'){
65-
agent {label 'devExpLinuxPool'}
66-
steps{
67-
runTests('11.3.1','JAVA21_HOME_DIR')
68-
}
69-
}
42+
43+
stages {
44+
45+
stage('tests') {
46+
steps {
47+
cleanupDocker()
48+
setupDockerMarkLogic("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12")
49+
sh label:'test', script: '''#!/bin/bash
50+
# 'set -e' causes the script to fail if any command fails.
51+
set -e
52+
export JAVA_HOME=$JAVA_HOME_DIR
53+
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
54+
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
55+
cd ml-gradle
56+
cd test-app
57+
../gradlew -i mlDeploy
58+
cd ..
59+
# Running these separately to decrease likelihood of connection resets.
60+
./gradlew ml-javaclient-util:test || true
61+
./gradlew ml-app-deployer:test || true
62+
./gradlew ml-gradle:test || true
63+
'''
64+
junit '**/build/**/*.xml'
7065
}
66+
post {
67+
always {
68+
tearDownDocker()
69+
cleanupDocker()
70+
}
71+
}
7172
}
73+
7274
stage('publish'){
7375
agent {label 'devExpLinuxPool'}
7476
when {
@@ -81,7 +83,7 @@ pipeline{
8183
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
8284
cp ~/.gradle/gradle.properties $GRADLE_USER_HOME;
8385
cd ml-gradle
84-
./gradlew publish
86+
./gradlew publish
8587
'''
8688
}
8789
}

0 commit comments

Comments
 (0)