updating and testing ImageMatcher pipeline

This commit is contained in:
dzaitsev
2025-05-03 15:09:28 +03:00
parent 0153634166
commit 6d17632c23
2 changed files with 129 additions and 57 deletions
-10
View File
@@ -46,16 +46,6 @@ pipeline {
} }
} }
// Optional: Archive ImageMatcher build artifacts if needed by Azaion Build
// stage('Archive ImageMatcher Artifacts') {
// steps {
// echo 'Archiving ImageMatcher artifacts...'
// // Path is relative to the current directory (which will be SHARED_WORKSPACE due to the outer dir)
// dir(env.SHARED_WORKSPACE) { // Ensure this also runs in the shared workspace
// archiveArtifacts artifacts: 'path/to/imagematcher/build/output/**' // Adjust path relative to SHARED_WORKSPACE
// }
// }
// }
} }
post { post {
+107 -25
View File
@@ -1,3 +1,4 @@
// Add this into polling for 2 minutes ----- */2 * * * *
pipeline { pipeline {
agent { label 'Win10-BuildMachine' } agent { label 'Win10-BuildMachine' }
@@ -7,72 +8,153 @@ pipeline {
} }
environment { environment {
REPO_ANNOTATOR_URL = 'https://github.com/azaion/annotator.git' REPO_ANNOTATOR_URL = 'git@github.com:azaion/annotator.git'
REPO_GPS_DENIED_URL = 'https://github.com/azaion/gps-denied.git' REPO_GPS_DENIED_URL = 'git@github.com:azaion/gps-denied.git'
PROJECT_PATH = 'Azaion.Suite/suite/Azaion.Suite.csproj' PROJECT_PATH = 'Azaion.Suite/suite/Azaion.Suite.csproj'
CONFIGURATION = 'Release' CONFIGURATION = 'Release'
nexusUrl = 'http://<nexus-server>:8081' nexusUrl = 'http://192.168.1.101:8081'
nexusRepo = 'generic-hosted' nexusRepo = 'AzaionSuite'
nexusCreds = 'nexus-credentials-id' // Jenkins credential ID for Nexus nexusCreds = 'a42c7b91-bf8e-4229-be4c-c7edf518dd50' // Jenkins credential ID for Nexus
// CUDA environment variables
CUDA_PATH = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2" // Path to CUDA Toolkit
CUDNN_INCLUDE_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/include" // cuDNN include path (optional)
CUDNN_LIB_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/lib/x64" // cuDNN library path (optional)
// Inno Setup Compiler path
INNO_SETUP_PATH = "C:/Program Files (x86)/Inno Setup 6" // Path where Inno Setup is installed
// Set the PATH environment variable combining CUDA, cuDNN (if applicable), and Inno Setup paths
PATH = "${INNO_SETUP_PATH};${CUDA_PATH}/bin;${CUDNN_INCLUDE_DIR};${CUDNN_LIB_DIR};${env.PATH}" // Add Inno Setup, CUDA, and cuDNN to PATH
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
//Suite // Checkout Suite repo using SSH
sshagent(credentials: ['DZ-id']) {
checkout([ checkout([
$class: 'GitSCM', $class: 'GitSCM',
branches: [[name: '*/dev']], branches: [[name: '*/dev']],
userRemoteConfigs: [[ userRemoteConfigs: [[
url: "${env.REPO_ANNOTATOR_URL}" url: "${env.REPO_ANNOTATOR_URL}", // Use SSH URL
]], ]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'suite']] extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'suite']]
]) ])
}
//GPS-Denied // Checkout GPS-Denied repo using SSH
sshagent(credentials: ['DZ-id']) {
checkout([ checkout([
$class: 'GitSCM', $class: 'GitSCM',
branches: [[name: '*/image-matcher']], branches: [[name: '*/image-matcher']],
userRemoteConfigs: [[ userRemoteConfigs: [[
url: "${env.REPO_GPS_DENIED_URL}" url: "${env.REPO_GPS_DENIED_URL}", // Use SSH URL
]], ]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'gps-denied']] extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'gps-denied']]
]) ])
} }
} }
}
stage('Compile Gps Denied') { stage('Compile Gps Denied') {
steps { steps {
call "AzaionSuite\gps-denied\image-matcher\build.cmd" // Run build.cmd in the gps-denied\image-matcher directory
bat 'gps-denied\\image-matcher\\build.cmd'
} }
} }
stage('Run publish.cmd') { stage('Run publish.cmd') {
steps { steps {
call "AzaionSuite\suite\build\publish.cmd" // Run publish.cmd in the suite\build directory
bat 'suite\\build\\publish.cmd'
} }
} }
stage('Deploy to Nexus') { stage('Deploy to Nexus RAW') {
steps { steps {
script { script {
// Use Nexus Artifact Uploader in the pipeline echo "Starting 'Deploy to Nexus RAW' stage."
nexusArtifactUploader( def targetDirectory = 'C:/Jenkins/workspace/AzaionSuite/suite'
nexusUrl: nexusUrl, def version = '1.0.0' // Default version
credentialsId: nexusCreds, def filesToUpload = []
repository: nexusRepo,
artifacts: [ // Define the date formatter
[artifactId: 'myapp', def dateTimeFormat = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss")
version: "${BUILD_NUMBER}",
file: "target/myapp-${BUILD_NUMBER}.zip", // Artifact path from the build dir(targetDirectory) {
type: 'zip', // Find both exe and bin files (returns an array)
classifier: '', def exeFiles = findFiles(glob: 'AzaionSuite*.exe')
extension: 'zip'] def binFiles = findFiles(glob: 'AzaionSuite*.bin')
] filesToUpload = exeFiles + binFiles // Combine arrays
// --- Version Extraction (only from .exe if present) ---
if (exeFiles.size() > 0) {
def exeFilePath = exeFiles[0].path // Use path from the first found exe
// Regex to find version like 1.2.3 or 1.2.3-4
def matcher = (exeFilePath =~ /AzaionSuite(\d+\.\d+\.\d+(-\d+)?)/)
if (matcher.find()) {
version = matcher.group(1)
echo "Found version: ${version}"
} else {
echo "Warning: Could not extract version from '${exeFiles[0].name}'. Using default: ${version}"
}
} else {
echo "Warning: No executable found to extract version. Using default: ${version}"
}
// --- Upload Logic ---
if (filesToUpload.size() > 0) {
def now = new Date()
def buildDateTime = dateTimeFormat.format(now) // Format the current date
def uploadFolderName = "AzaionSuite.${version}-${buildDateTime}"
echo "Preparing to upload ${filesToUpload.size()} file(s) to Nexus folder: ${uploadFolderName}"
withCredentials([usernamePassword(credentialsId: nexusCreds, usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASSWORD')]) {
filesToUpload.each { file ->
def fileName = file.getName()
def filePath = file.path // file.path should give the full agent path
def uploadUrl = "${nexusUrl}/repository/${nexusRepo}/${uploadFolderName}/${fileName}"
echo "Uploading: ${fileName} to ${uploadUrl}" // Single log per file upload start
// Use bat step for Windows agent commands
bat """
@echo off
echo Uploading ${filePath} to ${uploadUrl}
curl -v -f -X PUT -u "${NEXUS_USER}:${NEXUS_PASSWORD}" --upload-file "${filePath}" "${uploadUrl}"
if %errorlevel% neq 0 (
echo Error uploading ${fileName}. Curl exit code: %errorlevel%
exit /b %errorlevel%
) )
"""
}
}
} else {
echo "No files to upload to Nexus."
} }
} }
} }
} }
} }
}
post {
success {
echo 'Build successful. Triggering Google Drive upload pipeline...'
// Trigger the Google Drive upload pipeline
// Replace 'YourGoogleDriveUploadPipelineName' with the actual name of your Google Drive upload pipeline job
build job: 'GoogleDriveUpload'
}
failure {
echo 'Build failed. Google Drive upload pipeline will not be triggered.'
// Optional: Add other actions for failure, like sending notifications
}
// Optional: Add always, unstable, etc. blocks if needed
}
}