This commit is contained in:
qtrajkumar 2023-03-25 08:04:59 +00:00 committed by GitHub
commit baa0b71281
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 105 additions and 0 deletions

80
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,80 @@
pipeline {
agent 'any'
triggers { pollSCM '* * * * *' }
parameters {
choice(name: 'MAVEN_GOAL', choices: ['package', 'install', 'clean'], description: 'MAVEN_GOAL')
}
stages {
stage( 'version control sysytem') {
steps {
git url: 'https://github.com/spring-projects/spring-petclinic.git',
branch: 'main'
}
}
stage('package') {
steps {
sh 'mvn package'
}
}
stage('build') {
steps {
sh 'export PATH="/usr/lib/jvm/java-1.17.0-openjdk-amd64/bin:$PATH" && mvn package'
}
}
stage('Artifactory configuration') {
steps {
rtServer (
id: "ARTIFACTORY_SERVER",
url: 'https://qtsivajijfrog.jfrog.io/artifactory',
credentialsId: 'JFROG_TOKEN'
)
rtMavenDeployer (
id: "MAVEN_DEPLOYER",
serverId: "ARTIFACTORY_SERVER",
releaseRepo: 'libs-release',
snapshotRepo: 'libs-snapshot'
)
rtMavenResolver (
id: "MAVEN_RESOLVER",
serverId: "ARTIFACTORY_SERVER",
releaseRepo: 'libs-release',
snapshotRepo: 'libs-snapshot'
)
}
}
stage('packaged') {
tools {
jdk 'JDK_17'
}
steps {
rtMavenRun (
tool: 'MAVEN_DEFAULT',
pom: 'pom.xml',
goals: 'clean install',
deployerId: "MAVEN_DEPLOYER"
)
rtPublishBuildInfo (
serverId: "ARTIFACTORY_SERVER"
)
//sh "mvn ${params.MAVEN_GOAL}"
}
}
stage('sonar analysis') {
steps {
withSonarQubeEnv('SONAR_TOKEN') {
sh 'mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=qtsonarqube_qtsonarqube-token -Dsonar.organization=qtsonarqube'
}
}
}
stage('postbuild') {
steps {
archiveArtifacts artifacts: '**/target/spring-petclinic-3.0.0-SNAPSHOT.jar',
followSymlinks: false
junit '**/surefire-reports/TEST-*.xml'
}
}
}
}

1
hi Normal file
View file

@ -0,0 +1 @@
hi

24
jenkins-pipeline Normal file
View file

@ -0,0 +1,24 @@
pipeliene {
agent { label 'any' }
triggers { pollSCM '* * * * *' }
stages {
stage( 'version control sysytem') {
steps {
git url: 'https://github.com/spring-projects/spring-petclinic.git',
branch: 'main'
}
}
stage( 'package' ) {
steps {
sh: 'export PATH="/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH" && ./gradlew build',
}
}
stage( 'post build' ) {
steps {
archiveArtifacts artifacts: '**/libs/spring-petclinic-3.0.0/jar'
onlyIfSuccesful: true
junit testresults: '**/test-results/test/TEST-*.xml'
}
}
}
}