From 2afdb382b684264ad4256d23d69461fc448d0cc8 Mon Sep 17 00:00:00 2001 From: sukrucakmak Date: Mon, 20 Mar 2023 00:39:31 +0300 Subject: [PATCH] supports jenkinsfile with dockerfile --- Jenkinsfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4d017e291..19abbb1a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,18 @@ -pipeline { - agent { dockerfile true } - stages { - stage('Build') { - steps { - sh 'mvn clean install' - } - } - stage('Test') { - steps { - sh 'java --version' - } - } +node { + stage("Clone the project") { + git branch: 'main', url: 'https://github.com/sukrucakmak/spring-petclinic.git' + } + + stage("Compilation") { + sh "./mvnw clean install -DskipTests" + } + + stage("Tests and Deployment") { + stage("Runing unit tests") { + sh "./mvnw test -Punit" } + stage("Deployment") { + sh 'nohup ./mvnw spring-boot:run -Dserver.port=8001 &' + } + } }