From 7d3204febe4b5475755e44e2654eabe7b580202c Mon Sep 17 00:00:00 2001 From: namita-git <54328810+namita-git@users.noreply.github.com> Date: Tue, 27 Jul 2021 17:29:51 +0530 Subject: [PATCH] updated added pipeline code --- Jenkinsfile | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11e754464..4be940d94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,55 +1,44 @@ -#!/usr/bin/env groovy -def gv pipeline { agent none tools { // Install the Maven version configured as "M3" and add it to the path. jdk 'myjava' - maven 'mymaven' + maven "mymaven" + } stages { stage('Compile') { agent any steps { - script{ - git 'https://github.com/devops-trainer/DevOpsClassCodes.git' - gv = load "script.groovy" - gv.compile() - } - + sh "mvn compile" } } - stage('UnitTest') { - + + stage('CodeReview') { agent any steps { - script{ - gv = load "script.groovy" - gv.UnitTest() - } - + sh "mvn pmd:pmd" } - } - stage('Package') { + stage('UnitTest') { agent any steps { - script{ - gv = load "script.groovy" - gv.package() - } - + sh "mvn test" } - } - stage('Build docker image'){ + stage('MetricCheck') { agent any - steps{ - script{ - - } -} + steps { + sh "mvn cobertura:cobertura -Dcobertura.report.format=xml" + } + } + stage('Package') { + agent any + steps { + sh "mvn package" + } } } +}