Skip to content

MLE-22604 Converting Jenkinsfile to use Docker #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MARKLOGIC_IMAGE=ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12
MARKLOGIC_LOGS_PATH=./docker/marklogic/logs
55 changes: 47 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
@Library('shared-libraries') _
pipeline{

def setupDockerMarkLogic(String image) {
sh label:'mlsetup', script: '''#!/bin/bash
echo "Removing any running MarkLogic server and clean up MarkLogic data directory"
sudo /usr/local/sbin/mladmin remove
sudo /usr/local/sbin/mladmin cleandata
cd ml-gradle
docker-compose down -v || true
docker volume prune -f
echo "Using image: "'''+image+'''
docker pull '''+image+'''
MARKLOGIC_IMAGE='''+image+''' MARKLOGIC_LOGS_PATH=/tmp/marklogic/logs docker compose up -d --build
echo "Waiting for MarkLogic server to initialize."
sleep 60s
'''
}

def tearDownDocker() {
sh label:'tearDownDocker', script: '''#!/bin/bash
cd ml-gradle
docker compose down -v || true
docker volume prune -f
sudo rm -rf /tmp/marklogic/logs
'''
}

pipeline {
agent {label 'devExpLinuxPool'}

options {
checkoutToSubdirectory 'ml-gradle'
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '5')
}
environment{

environment {
JAVA_HOME_DIR="/home/builder/java/jdk-17.0.2"
GRADLE_DIR =".gradle"
DMC_USER = credentials('MLBUILD_USER')
DMC_PASSWORD = credentials('MLBUILD_PASSWORD')
}
stages{
stage('tests'){
steps{
copyRPM 'Release','11.3.0'
setUpML '$WORKSPACE/xdmp/src/Mark*.rpm'

stages {

stage('tests') {
steps {
cleanupDocker()
setupDockerMarkLogic("ml-docker-db-dev-tierpoint.bed-artifactory.bedford.progress.com/marklogic/marklogic-server-ubi-rootless:latest-12")
sh label:'test', script: '''#!/bin/bash
# 'set -e' causes the script to fail if any command fails.
set -e
export JAVA_HOME=$JAVA_HOME_DIR
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
Expand All @@ -31,7 +63,14 @@ pipeline{
'''
junit '**/build/**/*.xml'
}
post {
always {
tearDownDocker()
cleanupDocker()
}
}
}

stage('publish'){
when {
branch 'dev'
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: docker-tests-ml-gradle
services:

marklogic:
image: "progressofficial/marklogic-db:latest"
image: "${MARKLOGIC_IMAGE}"
platform: linux/amd64
environment:
- MARKLOGIC_INIT=true
- MARKLOGIC_ADMIN_USERNAME=admin
- MARKLOGIC_ADMIN_PASSWORD=admin
volumes:
- ./docker/marklogic/logs:/var/opt/MarkLogic/Logs
- ${MARKLOGIC_LOGS_PATH}:/var/opt/MarkLogic/Logs
ports:
- "8000-8008:8000-8008"
- "8028:8028"
Expand Down