From 4a58dacfbcc5b3170b489af93ec06405c66982d0 Mon Sep 17 00:00:00 2001 From: Hammy Date: Thu, 10 Jun 2021 22:46:11 +0100 Subject: [PATCH] Modify Dockerfile & Jenkinsfile --- Dockerfile | 8 ++------ Jenkinsfile | 42 +++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20c696a..411a3dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,5 @@ FROM maven:3.8.1-adoptopenjdk-11 MAINTAINER Goudham Suresh -RUN ls -la - -RUN apt-get -y update && \ - apt-get -y upgrade && \ - apt-get -y dist-upgrade && \ - apt-get -y install gpg +RUN apt-get update && apt-get install -y \ + gpg diff --git a/Jenkinsfile b/Jenkinsfile index 5cde786..8d92a5f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,25 +21,34 @@ pipeline { stages { stage("Import GPG Keys") { steps { - sh """ - gpg --batch --import ${GPG_SECRET_KEY} - gpg --import-ownertrust ${GPG_OWNER_TRUST} - """ + sh 'gpg --batch --import $GPG_SECRET_KEY' + sh 'gpg --import-ownertrust $GPG_OWNER_TRUST' } } - stage("Building") { + stage("Build") { steps { withCredentials([file(credentialsId: '076a36e8-d448-46fc-af11-7e7181a6cb99', variable: 'MAVEN_SETTINGS')]) { - sh 'mvn -s $MAVEN_SETTINGS -B -DskipTests clean install' + sh 'mvn -s $MAVEN_SETTINGS -B -DskipTests clean package' } } } - stage("Testing") { + stage("Test") { steps { sh "mvn test" } + post { + success { + echo "Generating Test Report..." + publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')] + + echo "Sending Report to CodeCov..." + sh '''#!/bin/bash + bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" + ''' + } + } } - stage("Deploying To Nexus") { + stage("Deploy To Nexus") { when { branch 'release' } @@ -77,23 +86,18 @@ pipeline { } } } + post { + success { + echo "Archiving Artifacts" + archiveArtifacts artifacts: 'target/*.jar' + } + } } } post { success { echo "I'm Feeling Swag!" - - echo "Archiving Artifacts" - archiveArtifacts artifacts: 'target/*.jar' - - echo "Generating Test Report..." - publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')] - - echo "Sending Report to CodeCov..." - sh '''#!/bin/bash - bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN || echo "Codecov did not collect coverage reports" - ''' } failure { echo 'Not Very Swag :('