Update Jenkinsfile

This commit is contained in:
nagarjuna33 2023-04-18 16:04:29 +05:30 committed by GitHub
parent 2fe319a540
commit e05ad47a2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

49
Jenkinsfile vendored
View file

@ -1,9 +1,9 @@
pipeline{ pipeline{
agent { label 'node' } agent { label 'node1' }
// triggers { pollSCM ('H * * * 1-5') } // triggers { pollSCM ('H * * * 1-5') }
parameters { parameters {
choice (name: 'BRANCH_TO_BUILD', choices: ['main'], description: 'Branch to build') choice (name: 'BRANCH_TO_BUILD', choices: ['main', 'Dev', 'Test'], description: 'Branch to build')
string (name: 'MAVEN_GOAL', defaultValue: 'clean install', description: 'maven goal') string (name: 'MAVEN_GOAL', defaultValue: 'clean package', description: 'maven goal')
} }
stages { stages {
stage('scm') { stage('scm') {
@ -13,14 +13,45 @@ stages {
} }
} }
stage ('sonarqube') { stage ('SONAR QUBE SCAN') {
steps{ steps{
withSonarQubeEnv('sonarqube') { withSonarQubeEnv('SONAR_SCAN') {
sh 'mvn clean package sonar:sonar -Dsonar.login=sonartoken' sh 'mvn clean package sonar:sonar'
} }
} }
} }
} stage('Quality Gate') {
steps {
timeout(time: 20, unit: 'MINUTES'){
waitForQualityGate abortPipeline: true
}
}
}
stage('upload package to the jfrog ') {
steps {
rtUpload (
serverId: 'JFROG_ID',
spec: '''{
"files": [
{
"pattern": "./target/*.jar",
"target": "libs-release-local/"
}
]
}''',
buildName: "$env.JOB_NAME",
buildNumber: "$env.BUILD_NUMBER",
project: 'springpet'
)
}
}
stage ('Publish build info') {
steps {
rtPublishBuildInfo (
serverId: "JFROG_ID"
)
}
}
} }
}