mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-29 14:49:38 +00:00
jenmkinsfile
This commit is contained in:
parent
a1fa74c029
commit
58efeb410c
1 changed files with 14 additions and 18 deletions
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
|
@ -2,7 +2,6 @@ pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
tools {
|
tools {
|
||||||
// This is your Jenkins-managed Maven tool
|
|
||||||
maven 'maven-3'
|
maven 'maven-3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,16 +9,16 @@ pipeline {
|
||||||
JFROG_CLI_BUILD_NAME = "spring-petclinic"
|
JFROG_CLI_BUILD_NAME = "spring-petclinic"
|
||||||
JFROG_CLI_BUILD_NUMBER = "${BUILD_ID}"
|
JFROG_CLI_BUILD_NUMBER = "${BUILD_ID}"
|
||||||
ARTIFACTORY_URL = "http://artifactory.artifactory.svc.cluster.local:8081/artifactory"
|
ARTIFACTORY_URL = "http://artifactory.artifactory.svc.cluster.local:8081/artifactory"
|
||||||
|
JF = "${WORKSPACE}/jf"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
stage('Download JFrog CLI') {
|
stage('Download JFrog CLI') {
|
||||||
steps {
|
steps {
|
||||||
// Download a *confirmed* ARM64 version – 2.44.0
|
|
||||||
sh '''
|
sh '''
|
||||||
curl -fL https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/2.44.0/jfrog-cli-linux-arm64/jf -o jf
|
curl -fL https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/2.44.0/jfrog-cli-linux-arm64/jf -o "$JF"
|
||||||
chmod +x jf
|
chmod +x "$JF"
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +27,10 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(credentialsId: 'jfrog-platform-creds', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
|
withCredentials([usernamePassword(credentialsId: 'jfrog-platform-creds', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
|
||||||
sh '''
|
sh '''
|
||||||
./jf c add petclinic \
|
"$JF" c add petclinic \
|
||||||
--url=${ARTIFACTORY_URL} \
|
--url="${ARTIFACTORY_URL}" \
|
||||||
--user=$ARTIFACTORY_USER \
|
--user="$ARTIFACTORY_USER" \
|
||||||
--password=$ARTIFACTORY_PASSWORD \
|
--password="$ARTIFACTORY_PASSWORD" \
|
||||||
--interactive=false
|
--interactive=false
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
@ -40,33 +39,30 @@ pipeline {
|
||||||
|
|
||||||
stage('Validate Connection') {
|
stage('Validate Connection') {
|
||||||
steps {
|
steps {
|
||||||
// Switch to "petclinic" config & ping Artifactory
|
sh '"$JF" c use petclinic'
|
||||||
sh './jf c use petclinic'
|
sh '"$JF" rt ping'
|
||||||
sh './jf rt ping'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Maven') {
|
stage('Build Maven') {
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x mvnw'
|
sh 'chmod +x mvnw'
|
||||||
// Configure Maven resolution + deployment in Artifactory
|
|
||||||
sh '''
|
sh '''
|
||||||
./jf mvnc --global \
|
"$JF" mvnc --global \
|
||||||
--repo-resolve-releases=petclinic-maven-dev-virtual \
|
--repo-resolve-releases=petclinic-maven-dev-virtual \
|
||||||
--repo-resolve-snapshots=petclinic-maven-dev-virtual \
|
--repo-resolve-snapshots=petclinic-maven-dev-virtual \
|
||||||
--repo-deploy-releases=petclinic-maven-dev-local \
|
--repo-deploy-releases=petclinic-maven-dev-local \
|
||||||
--repo-deploy-snapshots=petclinic-maven-dev-local
|
--repo-deploy-snapshots=petclinic-maven-dev-local
|
||||||
'''
|
'''
|
||||||
// Perform the actual build + deploy
|
sh '"$JF" mvn clean deploy -DskipTests -Dcheckstyle.skip=true'
|
||||||
sh './jf mvn clean deploy -DskipTests -Dcheckstyle.skip=true'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish Build Info') {
|
stage('Publish Build Info') {
|
||||||
steps {
|
steps {
|
||||||
sh './jf rt build-collect-env'
|
sh '"$JF" rt build-collect-env'
|
||||||
sh './jf rt build-add-git'
|
sh '"$JF" rt build-add-git'
|
||||||
sh './jf rt build-publish'
|
sh '"$JF" rt build-publish'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue