From e7ebf84c6238b6bd8d5b4dd59d4bf319316e4403 Mon Sep 17 00:00:00 2001 From: srikanth Date: Fri, 6 Jan 2023 12:18:46 +0530 Subject: [PATCH] added jenkinsfile --- Jenkinsfile | 68 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 717dbfd0b..fb2678ff3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,39 +1,49 @@ pipeline { - agent {label 'java-11'} - stages{ - stage ('git') { + agent { label 'jenkins123' } + triggers { pollSCM(* * * * *) } + stages { + stage('git') { steps { - git branch: 'main', - url: 'https://github.com/Srikanthreddy1000/spring-petclinic.git' + git branch: "main", + url: "https://github.com/Srikanthreddy1000/spring-petclinic.git" } - stage('jfrog deployment') { + } + stage('Mvn Build') { steps { - rtMavenDeployer ( - id: "jfrog-artifact", + sh "mvn package" + } + } + stage('sonarqube analysis') { + steps { + withSonarQubeEnv('My SonarQube Server') { + sh 'mvn clean package sonar:sonar' + } + } + } + stage('qualitygate') { + steps { + timeout(time: 1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } + } + } + stage('Jfrog') { + steps { + rtMavenDeployer ( + id: "Jfrog-id-deployer", serverId: "srikanthjfrog", - releaseRepo: default-libs-release-local, - snapshotRepo: default-libs-snapshot-local + releaseRepo: libs-release-local, + snapshotRepo: libs-snapshot-local ) + rtMavenResolver ( + id: "Jfrog-id-resolver", + serverId: "srikanthjfrog", + releaseRepo: libs-release-local, + snapshotRepo: libs-snapshot-local + ) } - } - stage ('Maven') { - steps { - rtMavenRun ( - tool: maven-build - pom: 'pom.xml', - goals: 'clean install', - deployerId: "srikanthjfrog" - ) - } - } - stage ('Publish build info') { - steps { - rtPublishBuildInfo ( - serverId: "srikanthjfrog" - ) - } - + + } } } - } } \ No newline at end of file