diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..4ec15f7c7 --- /dev/null +++ b/Jenkinsfile @@ -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' + } + } + } +} \ No newline at end of file diff --git a/hi b/hi new file mode 100644 index 000000000..45b983be3 --- /dev/null +++ b/hi @@ -0,0 +1 @@ +hi diff --git a/jenkins-pipeline b/jenkins-pipeline new file mode 100644 index 000000000..c0bcfb5e9 --- /dev/null +++ b/jenkins-pipeline @@ -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' + } + } + } +} \ No newline at end of file