Skip to content
Merged
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
45 changes: 26 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,28 @@ void copyRPMs() {
fi
"""
script {
// Get the RPM and Converters file names for the correct architecture (archSuffix already defined above)
// Use newest files so we don't accidentally pick a stale RPM left from a previous run.
RPM = sh(returnStdout: true, script: "cd src; ls -1t MarkLogic-*.${archSuffix}.rpm 2>/dev/null | head -1").trim()
CONVERTERS = sh(returnStdout: true, script: "cd src; (ls -1t MarkLogicConverters-*.${archSuffix}.rpm 2>/dev/null || ls -1t MarkLogicConverters-*.rpm 2>/dev/null) | head -1").trim()
// Select RPMs using version-specific patterns first to avoid picking another concurrent build's artifacts.
RPM = sh(returnStdout: true, script: "cd src; ls -1t MarkLogic-${RPMversion}*.${archSuffix}.rpm 2>/dev/null | head -1").trim()
if (!RPM) {
RPM = sh(returnStdout: true, script: "cd src; ls -1t MarkLogic-*.${archSuffix}.rpm 2>/dev/null | head -1").trim()
}

CONVERTERS = sh(returnStdout: true, script: "cd src; ls -1t MarkLogicConverters-${RPMversion}*.${archSuffix}.rpm 2>/dev/null | head -1").trim()
if (!CONVERTERS) {
CONVERTERS = sh(returnStdout: true, script: "cd src; (ls -1t MarkLogicConverters-*.${archSuffix}.rpm 2>/dev/null || ls -1t MarkLogicConverters-*.rpm 2>/dev/null) | head -1").trim()
}

if (!RPM) {
error "No MarkLogic RPM found in src/ for architecture ${archSuffix}"
}

Comment thread
barkhachoithani marked this conversation as resolved.
// Extract MarkLogic version from RPM file name (handle both x86_64 and aarch64)
marklogicVersion = sh(returnStdout: true, script: "echo ${RPM} | awk -F 'MarkLogic-' '{print \$2;}' | awk -F '.x86_64.rpm' '{print \$1;}' | awk -F '.aarch64.rpm' '{print \$1;}' | awk -F '-rhel' '{print \$1;}'").trim()

if (!marklogicVersion.startsWith("${params.marklogicVersion}.")) {
error "Resolved RPM version '${marklogicVersion}' does not match requested marklogicVersion '${params.marklogicVersion}'"
}
Comment thread
barkhachoithani marked this conversation as resolved.

echo "Selected server RPM: ${RPM}"
echo "Selected converters RPM: ${CONVERTERS}"
echo "Derived MarkLogic version from RPM: ${marklogicVersion}"
Expand Down Expand Up @@ -767,30 +783,21 @@ pipeline {
script {
unstash 'built-image-archive'
// Load image from tar if not already available (applies to all build types)
// Node's Docker daemon is shared with other concurrent builds, so only ever
// trust the exact, fully-qualified tag - never a loose repo/type match, which
// could resolve to a different build's image (e.g. a different marklogicVersion).
sh """
if ! docker image inspect ${builtImage} &>/dev/null; then
echo "Image not found locally, loading from ${WORKSPACE}/${GRAVITON3_IMAGE_ARCHIVE}..."
docker image load -i ${WORKSPACE}/${GRAVITON3_IMAGE_ARCHIVE}
else
echo "Image ${builtImage} already available locally"
fi
docker image inspect ${builtImage} >/dev/null
"""

// If builtImage doesn't exist, find the loaded image by repo pattern
def actualImage = sh(
returnStdout: true,
script: """docker images --format 'table {{.Repository}}:{{.Tag}}' | grep "marklogic/marklogic-server-${dockerImageType}:" | head -1"""
).trim()

if (!actualImage) {
actualImage = builtImage
echo "Using builtImage tag: ${actualImage}"
} else {
echo "Found loaded image: ${actualImage}"
}


// Store for use in publishToInternalRegistry
env.IMAGE_TO_PUBLISH = actualImage
env.IMAGE_TO_PUBLISH = builtImage
}
publishToInternalRegistry()
// Trigger downstream QA image build job
Expand Down
Loading