72 lines
2.2 KiB
Groovy
72 lines
2.2 KiB
Groovy
pipeline {
|
|
agent any
|
|
tools {
|
|
jdk 'jdk21'
|
|
}
|
|
environment {
|
|
BRANCH = 'main'
|
|
GIT_REPO = 'https://kamco.git.gs.dabeeo.com/MVPTeam/kamco-cd-cron.git'
|
|
JAR_NAME = 'generator-dataset-for-training.jar'
|
|
}
|
|
|
|
// NOTE: Pre-built JAR is included in the repository
|
|
// To update the JAR:
|
|
// 1. On a machine with internet, run: ./gradlew clean bootJar
|
|
// 2. Commit the updated build/libs/generator-dataset-for-training.jar
|
|
// 3. Push to repository
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout([
|
|
$class : 'GitSCM',
|
|
branches : [[name: "${env.BRANCH}"]],
|
|
userRemoteConfigs: [[
|
|
url : "${env.GIT_REPO}",
|
|
credentialsId: 'jenkins-dev-token'
|
|
]]
|
|
])
|
|
}
|
|
}
|
|
|
|
|
|
stage('Get Commit Hash') {
|
|
steps {
|
|
script {
|
|
env.COMMIT_HASH = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
|
|
echo "Current commit hash: ${env.COMMIT_HASH}"
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Verify JAR') {
|
|
steps {
|
|
dir("kamco-make-dataset-generation") {
|
|
script {
|
|
def jarPath = "build/libs/${env.JAR_NAME}"
|
|
if (!fileExists(jarPath)) {
|
|
error("JAR file not found: ${jarPath}")
|
|
}
|
|
echo "JAR file verified: ${jarPath}"
|
|
|
|
// Display JAR info
|
|
sh "ls -lh ${jarPath}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Deploy') {
|
|
steps {
|
|
dir("kamco-make-dataset-generation") {
|
|
script {
|
|
def jarPath = "build/libs/${env.JAR_NAME}"
|
|
echo "Ready to deploy: ${jarPath}"
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|