added BuildDependencies Jenkins pipeline file

This commit is contained in:
dzaitsev
2025-05-03 13:28:30 +03:00
parent 6ac1fdb14b
commit 756806bdeb
+96
View File
@@ -0,0 +1,96 @@
// Jenkinsfile for Dependencies pipeline
pipeline {
// Ensure this runs on your Windows agent
agent {
label 'Win10-BuildMachine' // Specify the agent label type
// Explicitly set the workspace to the AzaionSuite workspace within the label block
// This ensures dependencies are installed in the correct location
// for the Azaion Build pipeline and covers both repos.
// Adjust this path if needed
// Note: The workspace path should typically be relative to the Jenkins agent root,
// or an absolute path that the agent has access to.
// 'C:/Jenkins/workspace/AzaionSuite' is a common pattern.
workspace 'C:/Jenkins/workspace/AzaionSuite'
}
tools {
// Define any tools needed specifically for dependency installation
// e.g., NuGet, package managers, etc.
git 'Default' // Git is needed for checkout
dotnetsdk 'dotnet-sdk' // Assuming dotnet restore is part of dependencies
}
environment {
// Define any environment variables needed for dependency installation
// e.g., paths to package sources, etc.
REPO_ANNOTATOR_URL = 'git@github.com:azaion/annotator.git' // URL for Azaion repo
REPO_GPS_DENIED_URL = 'git@github.com:azaion/gps-denied.git' // URL for ImageMatcher repo
}
stages {
stage('Checkout') {
steps {
echo 'Checking out Azaion Suite and ImageMatcher code for dependencies...'
// Checkout Suite repo using SSH
sshagent(credentials: ['DZ-id']) { // Replace 'DZ-id' with your actual Jenkins credential ID
checkout([
$class: 'GitSCM',
branches: [[name: '*/dev']], // Adjust branch name if needed
userRemoteConfigs: [[
url: "${env.REPO_ANNOTATOR_URL}", // Use SSH URL
]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'suite']] // Checkout into 'suite' subdirectory
])
}
// Checkout GPS-Denied repo using SSH
sshagent(credentials: ['DZ-id']) { // Replace 'DZ-id' with your actual Jenkins credential ID
checkout([
$class: 'GitSCM',
branches: [[name: '*/image-matcher']], // Adjust branch name if needed
userRemoteConfigs: [[
url: "${env.REPO_GPS_DENIED_URL}", // Use SSH URL
]],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'gps-denied']] // Checkout into 'gps-denied' subdirectory
])
}
}
}
stage('Install Dependencies') {
steps {
echo 'Installing build dependencies...'
echo 'We do nothing here so far'
// Add steps here to install dependencies using PowerShell, command line, etc.
// Examples:
// powershell 'nuget restore suite/YourSolution.sln' // Assuming NuGet is in PATH or configured as a tool
// bat 'install_some_tool.bat'
// sh 'apt-get update && apt-get install -y some-package' // If using a mixed environment or WSL
// Example: Installing .NET dependencies using dotnet restore
// Assumes your solution file is within the 'suite' subdirectory and includes the gps-denied project
dir('suite') { // Change directory to the suite subdirectory where the solution file is
bat 'dotnet restore' // Assuming dotnet is in PATH or configured as a tool
}
// If your solution file is at the workspace root, you would use:
// bat 'dotnet restore'
}
}
}
post {
success {
echo 'Dependencies installed successfully. Triggering ImageMatcher Build pipeline...'
// Trigger the ImageMatcher Build pipeline job upon success
// Replace 'ImageMatcher Build' with the exact name of your ImageMatcher Jenkins job
build job: 'ImageMatcher Build',
wait: false // Set to true if you want Dependencies to wait for ImageMatcher to finish
// No parameters are passed by default, add if needed
}
failure {
echo 'Dependencies installation failed. ImageMatcher Build pipeline will NOT be triggered.'
// Optional: Add other actions for failure, like sending notifications
}
// Optional: Add always, unstable, etc. blocks if needed
}
}