mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:55:49 +00:00
added cnew repo
This commit is contained in:
parent
d9f669a826
commit
1ba785013d
1 changed files with 100 additions and 38 deletions
138
Jenkinsfile
vendored
138
Jenkinsfile
vendored
|
@ -1,51 +1,113 @@
|
||||||
pipeline{
|
pipeline{
|
||||||
agent{label 'java-17'}
|
agent{label 'java'}
|
||||||
|
tools {
|
||||||
|
maven 'maven 3.9.4'
|
||||||
|
}
|
||||||
stages{
|
stages{
|
||||||
stage('VCS'){
|
stage('VCS'){
|
||||||
steps{
|
steps{
|
||||||
git credentialsId: 'GIT_HUB_CREDENTIALS',
|
git credentialsId: 'GIT_HUB_CREDENTIALS',
|
||||||
url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git',
|
url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git',
|
||||||
branch: 'main'
|
branch: 'spcbranch'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('artifact build'){
|
// stage('nexus'){
|
||||||
steps{
|
// steps{
|
||||||
sh 'docker image build -t spc-mvn .'
|
// nexusArtifactUploader artifacts: [[artifactId: 'spring-petclinic', classifier: '', file: '/home/ubuntu/spring-petclinic/target/spring-petclinic-3.1.0-SNAPSHOT.jar', type: 'jar']], credentialsId: 'nexus', groupId: 'org.springframework.samples', nexusUrl: '54.237.114.152:8081', nexusVersion: 'nexus3', protocol: 'http', repository: 'maven-snapshots', version: '3.1.0-SNAPSHOT'
|
||||||
sh 'docker image list'
|
// }
|
||||||
|
// }
|
||||||
}
|
stage('Build & SonarQube Scan') {
|
||||||
}
|
steps {
|
||||||
stage('artifact') {
|
sh 'mvn --version'
|
||||||
steps {
|
// withSonarQubeEnv('SONAR_CLOUD') {
|
||||||
archiveArtifacts artifacts: '**/target/spring-petclinic-3.1.0-SNAPSHOT.jar',
|
// sh 'mvn clean install sonar:sonar -Dsonar.organization=qtdevopssohail123 -Dsonar.token=8c15adacf466a5ccd721f4f7cdb2c4bf17df84ab -Dsonar.projectKey=qtdevopssohail123'
|
||||||
onlyIfSuccessful: true
|
}
|
||||||
junit testResults: '**/surefire-reports/TEST-*.xml'
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// pipeline{
|
||||||
|
// agent{label 'java-17'}
|
||||||
|
// stages{
|
||||||
|
// stage('VCS'){
|
||||||
|
// steps{
|
||||||
|
// git credentialsId: 'GIT_HUB_CREDENTIALS',
|
||||||
|
// url: 'https://github.com/Cloud-and-devops-notes/spring-petclinic-jenkins.git',
|
||||||
|
// branch: 'main'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// stage('artifact build'){
|
||||||
|
// steps{
|
||||||
|
// sh 'docker image build -t spc-mvn .'
|
||||||
|
// sh 'docker image list'
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// stage('artifact') {
|
||||||
|
// steps {
|
||||||
|
// archiveArtifacts artifacts: '**/target/spring-petclinic-3.1.0-SNAPSHOT.jar',
|
||||||
|
// onlyIfSuccessful: true
|
||||||
|
// junit testResults: '**/surefire-reports/TEST-*.xml'
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
stage('docker login'){
|
// stage('docker login'){
|
||||||
steps{
|
// steps{
|
||||||
withCredentials([string(credentialsId: 'DOCKER_HUB_PASSWORD',variable: 'PASSWORD')]) {
|
// withCredentials([string(credentialsId: 'DOCKER_HUB_PASSWORD',variable: 'PASSWORD')]) {
|
||||||
sh 'docker login -u sridhar006 -p $PASSWORD'
|
// sh 'docker login -u sridhar006 -p $PASSWORD'
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
stage('docker push image '){
|
// stage('docker push image '){
|
||||||
steps{
|
// steps{
|
||||||
sh 'docker image tag spc-mvn sridhar006/spc-mvn:${BUILD_ID}'
|
// sh 'docker image tag spc-mvn sridhar006/spc-mvn:${BUILD_ID}'
|
||||||
sh 'docker push sridhar006/spc-mvn:${BUILD_ID}'
|
// sh 'docker push sridhar006/spc-mvn:${BUILD_ID}'
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
stage("kubernetes deployment"){
|
// stage("kubernetes deployment"){
|
||||||
steps{
|
// steps{
|
||||||
sh """
|
// sh 'kubectl apply -f deployement.yaml'
|
||||||
|
// }
|
||||||
"""
|
|
||||||
sh 'kubectl apply -f deployement.yaml'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
Loading…
Reference in a new issue