2025-03-25 19:11:30 +00:00
|
|
|
pipeline {
|
2025-03-27 19:04:44 +00:00
|
|
|
agent any
|
|
|
|
tools {
|
|
|
|
maven 'maven-3'
|
2025-03-25 23:59:54 +00:00
|
|
|
}
|
2025-03-27 19:04:44 +00:00
|
|
|
environment {
|
|
|
|
JFROG_URL = "https://trialt0zppb.jfrog.io"
|
|
|
|
JFROG_REPO_RELEASES = "petclinic-maven-dev-local"
|
|
|
|
JFROG_REPO_SNAPSHOTS = "petclinic-maven-dev-virtual"
|
2025-03-27 19:17:07 +00:00
|
|
|
JFROG_CREDENTIALS_ID = 'jfrog-saas'
|
2025-03-27 19:04:44 +00:00
|
|
|
JFROG_CLI_BUILD_NAME = "spring-petclinic"
|
|
|
|
JFROG_CLI_BUILD_NUMBER = "${BUILD_ID}"
|
2025-03-27 19:49:31 +00:00
|
|
|
JF = "${WORKSPACE}/jfrog"
|
2025-03-27 18:36:36 +00:00
|
|
|
}
|
2025-03-27 19:04:44 +00:00
|
|
|
stages {
|
2025-03-27 19:17:07 +00:00
|
|
|
stage('Download JFrog CLI') {
|
2025-03-27 19:04:44 +00:00
|
|
|
steps {
|
2025-03-27 19:49:31 +00:00
|
|
|
sh """
|
|
|
|
curl -fL https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/2.74.1/jfrog-cli-linux-amd64/jf -o "${JF}"
|
|
|
|
chmod +x "${JF}"
|
|
|
|
"""
|
2025-03-27 19:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-03-27 19:17:07 +00:00
|
|
|
stage('Configure JFrog CLI') {
|
2025-03-27 19:04:44 +00:00
|
|
|
steps {
|
2025-03-27 19:17:07 +00:00
|
|
|
withCredentials([usernamePassword(credentialsId: "${JFROG_CREDENTIALS_ID}", usernameVariable: 'JFROG_USER', passwordVariable: 'JFROG_API_KEY')]) {
|
2025-03-27 19:37:08 +00:00
|
|
|
sh """
|
|
|
|
${JF} config add jenkins-config \
|
|
|
|
--artifactory-url=${JFROG_URL}/artifactory \
|
|
|
|
--user=${JFROG_USER} \
|
2025-03-27 19:52:16 +00:00
|
|
|
--password=${JFROG_API_KEY} \
|
2025-03-27 19:49:31 +00:00
|
|
|
--interactive=false \
|
|
|
|
--overwrite=true
|
2025-03-27 19:37:08 +00:00
|
|
|
"""
|
2025-03-27 19:17:07 +00:00
|
|
|
}
|
2025-03-27 19:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-03-27 19:17:07 +00:00
|
|
|
stage('Build Maven') {
|
2025-03-27 19:04:44 +00:00
|
|
|
steps {
|
2025-03-27 19:49:31 +00:00
|
|
|
sh """
|
|
|
|
${JF} mvnc --global \
|
2025-03-27 19:17:07 +00:00
|
|
|
--repo-resolve-releases=${JFROG_REPO_SNAPSHOTS} \
|
|
|
|
--repo-resolve-snapshots=${JFROG_REPO_SNAPSHOTS} \
|
|
|
|
--repo-deploy-releases=${JFROG_REPO_RELEASES} \
|
|
|
|
--repo-deploy-snapshots=${JFROG_REPO_RELEASES}
|
2025-03-27 19:49:31 +00:00
|
|
|
"""
|
|
|
|
sh """
|
|
|
|
${JF} mvn clean deploy -DskipTests -Dcheckstyle.skip=true \
|
|
|
|
--build-name=${JFROG_CLI_BUILD_NAME} \
|
|
|
|
--build-number=${JFROG_CLI_BUILD_NUMBER}
|
|
|
|
"""
|
2025-03-27 19:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Publish Build Info') {
|
|
|
|
steps {
|
2025-03-27 19:49:31 +00:00
|
|
|
sh """
|
|
|
|
${JF} rt build-collect-env
|
|
|
|
${JF} rt build-add-git
|
|
|
|
${JF} rt build-publish
|
|
|
|
"""
|
2025-03-27 19:04:44 +00:00
|
|
|
}
|
|
|
|
}
|
2025-03-27 18:36:36 +00:00
|
|
|
}
|
2025-03-27 19:04:44 +00:00
|
|
|
post {
|
|
|
|
always {
|
|
|
|
echo "Build complete: ${env.JFROG_CLI_BUILD_NAME} #${env.BUILD_NUMBER}"
|
|
|
|
}
|
2025-03-25 23:48:12 +00:00
|
|
|
}
|
2025-03-27 19:04:44 +00:00
|
|
|
}
|