mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
jenmkinsfile
This commit is contained in:
parent
c030b8386a
commit
af797a30c4
1 changed files with 37 additions and 17 deletions
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
|
@ -9,39 +9,59 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Configure JFrog CLI') {
|
||||||
steps {
|
steps {
|
||||||
jf 'c show'
|
withCredentials([usernamePassword(credentialsId: 'artifactory-creds', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASSWORD')]) {
|
||||||
jf 'rt ping'
|
sh '''
|
||||||
|
jf c show petclinic || jf c add petclinic \
|
||||||
|
--url=${ARTIFACTORY_URL} \
|
||||||
|
--user=${ARTIFACTORY_USER} \
|
||||||
|
--password=${ARTIFACTORY_PASSWORD} \
|
||||||
|
--interactive=false
|
||||||
|
jf use petclinic
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Validate Connection') {
|
||||||
|
steps {
|
||||||
|
sh 'jf rt ping'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Maven') {
|
stage('Build Maven') {
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x mvnw'
|
sh 'chmod +x mvnw'
|
||||||
jf '''mvnc --global \
|
sh '''
|
||||||
--repo-resolve-releases=petclinic-maven-dev-virtual \
|
jf mvnc --global \
|
||||||
--repo-resolve-snapshots=petclinic-maven-dev-virtual'''
|
--repo-resolve-releases=petclinic-maven-dev-virtual \
|
||||||
jf "mvn clean deploy -DskipTests -Dcheckstyle.skip=true"
|
--repo-resolve-snapshots=petclinic-maven-dev-virtual \
|
||||||
}
|
--repo-deploy-releases=petclinic-maven-dev-local \
|
||||||
}
|
--repo-deploy-snapshots=petclinic-maven-dev-local
|
||||||
|
'''
|
||||||
stage('Docker') {
|
sh 'jf mvn clean deploy -DskipTests -Dcheckstyle.skip=true'
|
||||||
steps {
|
|
||||||
sh "docker build -t localhost:8081/petclinic-docker-dev-local/spring-petclinic:$BUILD_ID ."
|
|
||||||
jf "docker-push localhost:8081/petclinic-docker-dev-local/spring-petclinic:$BUILD_ID petclinic-docker-dev-local"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish Build Info') {
|
stage('Publish Build Info') {
|
||||||
steps {
|
steps {
|
||||||
jf "rt build-collect-env"
|
sh '''
|
||||||
jf "rt build-add-git"
|
jf rt build-collect-env
|
||||||
jf "rt build-publish"
|
jf rt build-add-git
|
||||||
|
jf rt build-publish
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
echo "Build complete: $JFROG_CLI_BUILD_NAME #$JFROG_CLI_BUILD_NUMBER"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue