From ab52d6baffdc0d4f9d2aef6e3b5acaa28f6f8108 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 17:52:34 +0300 Subject: [PATCH 01/82] Create Jenkinsfile --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..0482a7c0 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent { + docker { + image 'maven:3-alpine' + args '-v /root/.m2:/root/.m2' + } + } + stages { + stage('Build') { + steps { + sh 'mvn -B -DskipTests clean package' + } + } + } +} From d4e7cbe18334bc3766f2eabdf7fabd4a7f0827f8 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:27:54 +0300 Subject: [PATCH 02/82] Update Jenkinsfile --- Jenkinsfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0482a7c0..c12b8548 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,5 +11,15 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } - } + stage('Test') { + steps { + sh 'mvn test' + } + post { + always { + junit 'target/surefire-reports/*.xml + } + } + } + } } From 115ebca1c961adbfd490de48f683a1ae7a10bb84 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:28:34 +0300 Subject: [PATCH 03/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c12b8548..0d589321 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { } post { always { - junit 'target/surefire-reports/*.xml + junit 'target/surefire-reports/*.xml' } } } From 1109c3b6f825a77e9351aec08be6470909e93935 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:52:06 +0300 Subject: [PATCH 04/82] Update Jenkinsfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0d589321..14d622eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,5 +21,10 @@ pipeline { } } } + stage('Deploy') + steps { + sh './jenkins/scripts/deliver.sh' + } + } } } From d6bd35d1be2f5a2ad2c284a0ee51a9a172e5ef6e Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:52:54 +0300 Subject: [PATCH 05/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 14d622eb..8a0a7718 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { } } } - stage('Deploy') + stage('Deploy') { steps { sh './jenkins/scripts/deliver.sh' } From 8cb126a99ebd018ff5b875e5b4352eda4a213204 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:34:21 +0300 Subject: [PATCH 06/82] Update Jenkinsfile --- Jenkinsfile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a0a7718..3f267b0f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,14 +5,24 @@ pipeline { args '-v /root/.m2:/root/.m2' } } +node { + def mvnHome + def scannerHome + mvnHome = tool 'Maven' + scannerHome = tool 'Sonar' +} stages { + stage('Build') { steps { + echo '-------Build Started mf--------' + git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' sh 'mvn -B -DskipTests clean package' } } stage('Test') { steps { + echo '-----Unit Tests------' sh 'mvn test' } post { @@ -21,9 +31,11 @@ pipeline { } } } - stage('Deploy') { - steps { - sh './jenkins/scripts/deliver.sh' + stage('Sonar Analysis') { + steps { + echo '---SonarAnalysis-----' + bat(/"$scannerHome}\bin-sonnar-scanner" -Dsonar.projectKey=java-maven-junit-helloworld -Dsonar.sources=./) + } } } From 57bed91062f5fdd3c1eb5db3028b4497ee4711bb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:35:47 +0300 Subject: [PATCH 07/82] Update Jenkinsfile --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3f267b0f..86400078 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,11 +5,11 @@ pipeline { args '-v /root/.m2:/root/.m2' } } -node { - def mvnHome - def scannerHome - mvnHome = tool 'Maven' - scannerHome = tool 'Sonar' + node { + def mvnHome + def scannerHome + mvnHome = tool 'Maven' + scannerHome = tool 'Sonar' } stages { From fd114f198c654383d6252922d1516514af5b8746 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:41:52 +0300 Subject: [PATCH 08/82] Update Jenkinsfile --- Jenkinsfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 86400078..d0f10ee8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,11 +5,6 @@ pipeline { args '-v /root/.m2:/root/.m2' } } - node { - def mvnHome - def scannerHome - mvnHome = tool 'Maven' - scannerHome = tool 'Sonar' } stages { @@ -32,10 +27,16 @@ pipeline { } } stage('Sonar Analysis') { + environment { + scannerHome = tool 'SonarQubeScanner' + } steps { - echo '---SonarAnalysis-----' - bat(/"$scannerHome}\bin-sonnar-scanner" -Dsonar.projectKey=java-maven-junit-helloworld -Dsonar.sources=./) + withSonarQubeEnv('sonarqube') { + sh "${scannerHome}/bin/sonar-scanner" + } + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true } } } From 43b4833abed4dd194edf3494206137bf65b602d2 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:43:14 +0300 Subject: [PATCH 09/82] Update Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d0f10ee8..d96f5c0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,6 @@ pipeline { args '-v /root/.m2:/root/.m2' } } -} stages { stage('Build') { From 0198f38c3d841ade3643e5b524c409a1e192bce4 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:51:10 +0300 Subject: [PATCH 10/82] Update Jenkinsfile --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d96f5c0c..1238f07b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,8 @@ pipeline { timeout(time: 10, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } - } - } + } + } + } + } } From 0ae9274ac7fcdb744bae514379b07599547b9053 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 20:57:20 +0300 Subject: [PATCH 11/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1238f07b..6c9f0eaa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { } } } - stage('Sonar Analysis') { + stage('SonarQube') { environment { scannerHome = tool 'SonarQubeScanner' } From 96a3053e64381e97566ed204ed743285bf5927b1 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:16:51 +0300 Subject: [PATCH 12/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6c9f0eaa..683b29ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { } stage('SonarQube') { environment { - scannerHome = tool 'SonarQubeScanner' + scannerHome = tool 'SonarQubeAnalysis' } steps { withSonarQubeEnv('sonarqube') { From 5e1ef8e567f9c9786bff73afab0e253d0051178f Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:21:38 +0300 Subject: [PATCH 13/82] Update Jenkinsfile --- Jenkinsfile | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 683b29ea..f252391d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,17 +14,7 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } - stage('Test') { - steps { - echo '-----Unit Tests------' - sh 'mvn test' - } - post { - always { - junit 'target/surefire-reports/*.xml' - } - } - } + stage('SonarQube') { environment { scannerHome = tool 'SonarQubeAnalysis' From 8ef75666e18ac2b6f329e74c39f35c4813c4b92d Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:22:49 +0300 Subject: [PATCH 14/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f252391d..ba009c5e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { stage('SonarQube') { environment { - scannerHome = tool 'SonarQubeAnalysis' + scannerHome = tool 'SonarQube' } steps { withSonarQubeEnv('sonarqube') { From ec4568a073b7ab93fbeaad35dc8509e065b002ed Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:38:34 +0300 Subject: [PATCH 15/82] Update Jenkinsfile --- Jenkinsfile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba009c5e..e0da91d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,16 +14,23 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } + - stage('SonarQube') { - environment { - scannerHome = tool 'SonarQube' - } + stage('SCM') { + git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' + } + + + stage('SonarQube Analysis'){ steps { - withSonarQubeEnv('sonarqube') { - sh "${scannerHome}/bin/sonar-scanner" + withSonarQubeEnv(installationName:'sonarqube') { + sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar' } - + + + stage("Quality Gate") { + steps { + echo '---------Quality Gate--------' timeout(time: 10, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } From 6af21f4bc6a1f07c47c03a019df855d06223b927 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:39:23 +0300 Subject: [PATCH 16/82] Update Jenkinsfile From d79e8e840c5a4ceefde333317f90e2722abce16e Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:40:49 +0300 Subject: [PATCH 17/82] Update Jenkinsfile From ce6b8f0cfbfa589fdaeb1d6c5dfc4fd8c26eaceb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:41:19 +0300 Subject: [PATCH 18/82] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index e0da91d3..d0a84773 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,3 +38,4 @@ pipeline { } } } + } From b9f68d2d428029a06703dce9fe23595e2a4f8192 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:41:47 +0300 Subject: [PATCH 19/82] Update Jenkinsfile --- Jenkinsfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d0a84773..93b880a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,5 +37,3 @@ pipeline { } } } -} - } From ab64177e3841b64565d26f161d7f45dabffd128c Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:44:38 +0300 Subject: [PATCH 20/82] Update Jenkinsfile --- Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 93b880a1..37e746a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,8 +7,8 @@ pipeline { } stages { - stage('Build') { - steps { + stage('Build') { + steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' sh 'mvn -B -DskipTests clean package' @@ -37,3 +37,6 @@ pipeline { } } } + + } +} From d1c3be49c5fb84dc109893169298072d8f3e01cb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:47:05 +0300 Subject: [PATCH 21/82] Update Jenkinsfile --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 37e746a2..2fa42924 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,7 @@ pipeline { withSonarQubeEnv(installationName:'sonarqube') { sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar' } + } stage("Quality Gate") { @@ -37,6 +38,4 @@ pipeline { } } } - - } -} +} From e398881789963325a58099a496ef10b24fbf2621 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:48:03 +0300 Subject: [PATCH 22/82] Update Jenkinsfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2fa42924..be49cd88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,7 @@ pipeline { sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar' } } + } stage("Quality Gate") { @@ -39,3 +40,7 @@ pipeline { } } } + + + + From 1df647fb66f3295fd7e465acde9471ac1e839159 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:49:16 +0300 Subject: [PATCH 23/82] Update Jenkinsfile --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index be49cd88..051c2b87 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,8 +17,10 @@ pipeline { stage('SCM') { + steps{ git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' } + } stage('SonarQube Analysis'){ From 772e338c1cd14d3962e9ed70a7f457820df43225 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 00:12:28 +0300 Subject: [PATCH 24/82] Update Jenkinsfile --- Jenkinsfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 051c2b87..da8b794e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,8 +14,17 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } - - + stage('Test') { + steps { + sh 'mvn test' + } + post { + always { + junit 'target/surefire-reports/*.xml' + } + } + } + stage('SCM') { steps{ git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' From 4c4d04194255c73f8481cd9c8a1d694884279213 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 15:46:57 +0300 Subject: [PATCH 25/82] Update Jenkinsfile --- Jenkinsfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index da8b794e..1d0384a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,6 +39,25 @@ pipeline { } } } + stage ('Download arts') { + steps { + sh'mkdir testart' + sh 'echo "artifact file" > generatedfile.zip' + + } + } + + post { + always { + archiveArtifacts artifacts: '**/*', + only successful: true + } + + + } + + + stage("Quality Gate") { @@ -52,6 +71,3 @@ pipeline { } } - - - From 4a898741ed7f7c26f6e4b9791577ff01dce1632a Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:03:19 +0300 Subject: [PATCH 26/82] Update Jenkinsfile --- Jenkinsfile | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1d0384a5..59923f34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,18 +47,13 @@ pipeline { } } - post { - always { - archiveArtifacts artifacts: '**/*', - only successful: true - } - - - } - - - - + post { + always { + archiveArtifacts artifacts: '**/*', + onlyIfSuccessful: true + } + } + stage("Quality Gate") { steps { @@ -71,3 +66,6 @@ pipeline { } } + + + From d7af79450d385086d28468452b782a4233563b87 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:08:57 +0300 Subject: [PATCH 27/82] Update Jenkinsfile --- Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 59923f34..7252ac50 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { } } stage ('Download arts') { - steps { + steps { sh'mkdir testart' sh 'echo "artifact file" > generatedfile.zip' @@ -54,6 +54,17 @@ pipeline { } } + + + + + + + + + + + stage("Quality Gate") { steps { From 4ee23ebbba4dc5c260c9866c0fe404abd8ba842c Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:10:06 +0300 Subject: [PATCH 28/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7252ac50..af14e89c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { } } - post { + post { always { archiveArtifacts artifacts: '**/*', onlyIfSuccessful: true From 4f169419e836a4f83493b3b1c9c3c57f9cacabee Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:13:13 +0300 Subject: [PATCH 29/82] Update Jenkinsfile --- Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index af14e89c..d34a495c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,12 +47,7 @@ pipeline { } } - post { - always { - archiveArtifacts artifacts: '**/*', - onlyIfSuccessful: true - } - } + @@ -75,6 +70,12 @@ pipeline { } } } + post { + always { + archiveArtifacts artifacts: '**/*', + onlyIfSuccessful: true + } + } } From 08b1cfae3a4722c1476a72651e3d41b4fa8a7442 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:22:33 +0300 Subject: [PATCH 30/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d34a495c..c209663c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,7 +72,7 @@ pipeline { } post { always { - archiveArtifacts artifacts: '**/*', + archiveArtifacts artifacts: 'home/jenkins/arts/*.zip', onlyIfSuccessful: true } } From 8eaf1509cc3b231a5d07740e5daa3b176254c382 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 16:37:34 +0300 Subject: [PATCH 31/82] Update Jenkinsfile --- Jenkinsfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c209663c..c67be257 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,25 +41,13 @@ pipeline { } stage ('Download arts') { steps { - sh'mkdir testart' + sh'mkdir /home/jenkins/testart' sh 'echo "artifact file" > generatedfile.zip' } } - - - - - - - - - - - - stage("Quality Gate") { steps { @@ -72,7 +60,7 @@ pipeline { } post { always { - archiveArtifacts artifacts: 'home/jenkins/arts/*.zip', + archiveArtifacts artifacts: 'build/generated.zip', onlyIfSuccessful: true } } From d2aa851ca34bcee4d71358b1e2b8e90d01d58cb2 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 17:05:59 +0300 Subject: [PATCH 32/82] Update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c67be257..124c582c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,11 +61,12 @@ pipeline { post { always { archiveArtifacts artifacts: 'build/generated.zip', - onlyIfSuccessful: true + fingerprint:true + junit 'build/reports/**/*.zip' } } } - + From 5b68238e8c9365a7ea8c80b55b0bbae855e9fc49 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 17:14:17 +0300 Subject: [PATCH 33/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 124c582c..99fa3dc8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { } stage ('Download arts') { steps { - sh'mkdir /home/jenkins/testart' + /*sh'mkdir /home/jenkins/testart'*/ sh 'echo "artifact file" > generatedfile.zip' } From d8280f3186d77cda2a81a422f07d1eae3c47bce6 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 17:23:16 +0300 Subject: [PATCH 34/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 99fa3dc8..9bea9d93 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { } stage ('Download arts') { steps { - /*sh'mkdir /home/jenkins/testart'*/ + sh 'echo "artifact file" > generatedfile.zip' } From 2ab597cbe8d31a786dc800d42dad831453a10a82 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 19 Apr 2020 19:27:15 +0300 Subject: [PATCH 35/82] Update Jenkinsfile --- Jenkinsfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9bea9d93..8737119b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,11 +18,7 @@ pipeline { steps { sh 'mvn test' } - post { - always { - junit 'target/surefire-reports/*.xml' - } - } + } stage('SCM') { @@ -41,12 +37,18 @@ pipeline { } stage ('Download arts') { steps { - - sh 'echo "artifact file" > generatedfile.zip' + + sh 'echo "artifact file" > generatedfile.txt' } } - + + stage ('Deploy') { + sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' + sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' + sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' + sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' + } stage("Quality Gate") { @@ -59,14 +61,12 @@ pipeline { } } post { - always { - archiveArtifacts artifacts: 'build/generated.zip', - fingerprint:true - junit 'build/reports/**/*.zip' + always { + archiveArtifacts artifacts: '**/*.jar', + fingerprint:true + junit 'target/surefire-reports/*.xml' } } } - - - + From 1ea2076213e0d7f92f23fe84a16e3dd502f8cc1e Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 14:01:58 +0300 Subject: [PATCH 36/82] Update Jenkinsfile --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 8737119b..d9ef3a4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,10 +44,12 @@ pipeline { } stage ('Deploy') { + steps { sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' + } } From fc89787ef2376ff1e38ab6e3b78aef7270b2648b Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 14:13:15 +0300 Subject: [PATCH 37/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9ef3a4c..f24fb04e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ pipeline { agent { - docker { + any { image 'maven:3-alpine' args '-v /root/.m2:/root/.m2' } From 19bb435e088e546073e2173ac912f79da7c8914d Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 14:18:27 +0300 Subject: [PATCH 38/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f24fb04e..d9ef3a4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ pipeline { agent { - any { + docker { image 'maven:3-alpine' args '-v /root/.m2:/root/.m2' } From 00561aca2a775634481e3fd6f3dd88913efdbaa1 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 18:44:11 +0300 Subject: [PATCH 39/82] Update Jenkinsfile --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9ef3a4c..9823fe34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,6 @@ pipeline { agent { - docker { - image 'maven:3-alpine' - args '-v /root/.m2:/root/.m2' + label "aws-slave" } } stages { From 53ddc86464a495b6ecc2b773af6291fe9247bbdb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 18:48:49 +0300 Subject: [PATCH 40/82] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9823fe34..52f5cdea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,6 @@ pipeline { agent { label "aws-slave" } - } stages { stage('Build') { @@ -12,6 +11,7 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } + stage('Test') { steps { sh 'mvn test' @@ -25,7 +25,6 @@ pipeline { } } - stage('SonarQube Analysis'){ steps { withSonarQubeEnv(installationName:'sonarqube') { @@ -33,6 +32,7 @@ pipeline { } } } + stage ('Download arts') { steps { @@ -50,7 +50,6 @@ pipeline { } } - stage("Quality Gate") { steps { echo '---------Quality Gate--------' @@ -60,6 +59,7 @@ pipeline { } } } + post { always { archiveArtifacts artifacts: '**/*.jar', From 7c2e52e2db14965a5db1c60ca0ddab49c5fc2b1b Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:06:06 +0300 Subject: [PATCH 41/82] Update Jenkinsfile --- Jenkinsfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 52f5cdea..6691a011 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,15 @@ pipeline { agent { label "aws-slave" } + stages { + stage('Clean') { + steps{ + cleanWs() + } + } + + stage('Build') { steps { @@ -11,7 +19,6 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } - stage('Test') { steps { sh 'mvn test' @@ -25,6 +32,7 @@ pipeline { } } + stage('SonarQube Analysis'){ steps { withSonarQubeEnv(installationName:'sonarqube') { @@ -32,7 +40,6 @@ pipeline { } } } - stage ('Download arts') { steps { @@ -50,6 +57,7 @@ pipeline { } } + stage("Quality Gate") { steps { echo '---------Quality Gate--------' @@ -59,7 +67,6 @@ pipeline { } } } - post { always { archiveArtifacts artifacts: '**/*.jar', @@ -67,6 +74,8 @@ pipeline { junit 'target/surefire-reports/*.xml' } } + + } From 23377f7c14f934fbd8c6f6d3379a426d5333e131 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:19:58 +0300 Subject: [PATCH 42/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6691a011..dd48caea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn -B -DskipTests clean package' + sh 'mvn clean package' } } stage('Test') { From a6d673e1ed9601585cf80b506a75968beedd27ff Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:24:46 +0300 Subject: [PATCH 43/82] Update Jenkinsfile --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dd48caea..d768a647 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,13 +10,11 @@ pipeline { } } - - stage('Build') { steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn clean package' + sh 'mvn -Dmaven.test.failure.ignore=true install' } } stage('Test') { From 9c32b4bad13202250a84e9de6978358579e8ddb0 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:31:30 +0300 Subject: [PATCH 44/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d768a647..9b6ebc5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn -Dmaven.test.failure.ignore=true install' + sh 'mvn install -DskipTests' } } stage('Test') { From 20ea4260e1cad3dbf654cfe3ce4f1fb043e71025 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:42:58 +0300 Subject: [PATCH 45/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9b6ebc5a..51c9a51d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn install -DskipTests' + sh 'mvn -B -DskipTests clean package' } } stage('Test') { From 25d69e1f9a61ba0f2ffbbe2e0492b8812cf2cf59 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Thu, 23 Apr 2020 19:46:22 +0300 Subject: [PATCH 46/82] Update Jenkinsfile --- Jenkinsfile | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 51c9a51d..a0833c7d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,16 +20,8 @@ pipeline { stage('Test') { steps { sh 'mvn test' - } - - } - - stage('SCM') { - steps{ - git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - } - } - + } + } stage('SonarQube Analysis'){ steps { @@ -38,13 +30,7 @@ pipeline { } } } - stage ('Download arts') { - steps { - - sh 'echo "artifact file" > generatedfile.txt' - } - } stage ('Deploy') { steps { From 0f6407f3fd9639f79b5d564cdf80c9f3f5631793 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 13:50:53 +0300 Subject: [PATCH 47/82] Update Jenkinsfile --- Jenkinsfile | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0833c7d..b1100dbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,17 @@ pipeline { agent { - label "aws-slave" - } - + docker { + image 'maven:3-alpine' + label 'aws-slave' + args '-v /tmp:/tmp' + } +} stages { - stage('Clean') { + /* stage('Clean') { steps{ cleanWs() } - } + } */ stage('Build') { steps { @@ -17,11 +20,19 @@ pipeline { sh 'mvn -B -DskipTests clean package' } } + stage('Test') { steps { sh 'mvn test' - } - } + } + + } + + stage('SCM') { + steps{ + git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' + } + } stage('SonarQube Analysis'){ steps { @@ -30,15 +41,19 @@ pipeline { } } } + stage ('Download arts') { + steps { + + sh 'echo "artifact file" > generatedfile.txt' + } + } stage ('Deploy') { - steps { sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' - } } @@ -52,14 +67,10 @@ pipeline { } } post { - always { + success { archiveArtifacts artifacts: '**/*.jar', fingerprint:true junit 'target/surefire-reports/*.xml' } } - - } - - From c9927bb7c35421412a707afc58efa8f9d0561727 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 13:51:42 +0300 Subject: [PATCH 48/82] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b1100dbe..8a11aa0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,10 +50,12 @@ pipeline { } stage ('Deploy') { + steps { sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' + sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' + } } From b30698c3810032e7e0a1e6c97bbc5cc833774d1f Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:12:31 +0300 Subject: [PATCH 49/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a11aa0e..ca28707f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'maven:3-alpine' + image 'maven:3.6.3-openjdk-15' label 'aws-slave' args '-v /tmp:/tmp' } From a4cf4ddf597478f6bdc7f6632675df0eb3e71a54 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:14:36 +0300 Subject: [PATCH 50/82] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca28707f..01b7ff78 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,11 @@ pipeline { } } stages { - /* stage('Clean') { + stage('Clean') { steps{ cleanWs() } - } */ + } stage('Build') { steps { From 516770dcc5a737fdc4e21cc65d57bdcb6cdae979 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:32:52 +0300 Subject: [PATCH 51/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 01b7ff78..6152b09b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'maven:3.6.3-openjdk-15' + image 'maven:3-alpine' label 'aws-slave' args '-v /tmp:/tmp' } From ccd7c17b10dc20553cfeefc843d936db111de841 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:37:05 +0300 Subject: [PATCH 52/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6152b09b..b4e2bb61 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { docker { image 'maven:3-alpine' label 'aws-slave' - args '-v /tmp:/tmp' + args '-v /root/.m2:/root/.m2' } } stages { From 8fc7255d96f492819a55a240b7e4fc25e0c09704 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:39:22 +0300 Subject: [PATCH 53/82] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4e2bb61..1e569c31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,11 @@ pipeline { } } stages { - stage('Clean') { + /*stage('Clean') { steps{ cleanWs() } - } + } */ stage('Build') { steps { From c40b435b4bd7ce64668eecd7bf53754f76a47f49 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:02:03 +0300 Subject: [PATCH 54/82] Update Jenkinsfile --- Jenkinsfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1e569c31..9ebb59c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,10 +51,8 @@ pipeline { stage ('Deploy') { steps { - sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' - sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' + sh './jenkins/scripts/deliver.sh' + } } From 3c9a7fb62bbc852fa350d32dee212e5541137c27 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:03:01 +0300 Subject: [PATCH 55/82] Update Jenkinsfile --- Jenkinsfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ebb59c6..b356b68a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,11 @@ pipeline { } } stages { - /*stage('Clean') { + stage('Clean') { steps{ cleanWs() } - } */ + } stage('Build') { steps { @@ -51,12 +51,10 @@ pipeline { stage ('Deploy') { steps { - sh './jenkins/scripts/deliver.sh' - + sh './jenkins/scripts/deliver.sh' } } - stage("Quality Gate") { steps { echo '---------Quality Gate--------' From 8a5c08c2f539d247f4bbbf90c7a83604d14f9e71 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:03:59 +0300 Subject: [PATCH 56/82] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b356b68a..700da5ee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,11 @@ pipeline { } } stages { - stage('Clean') { + /* stage('Clean') { steps{ cleanWs() } - } + } */ stage('Build') { steps { From bc606518bbefba8bec618c57a1e68a88241d1e40 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:13:30 +0300 Subject: [PATCH 57/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 700da5ee..2444f773 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,7 +49,7 @@ pipeline { } } - stage ('Deploy') { + stage ('Deliver') { steps { sh './jenkins/scripts/deliver.sh' } From 73ea49b5e59a31560230eb37b1c3f8b6d28fd689 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:20:09 +0300 Subject: [PATCH 58/82] Update Jenkinsfile --- Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2444f773..5b53e360 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,6 +6,9 @@ pipeline { args '-v /root/.m2:/root/.m2' } } + options { + skipStagesAfterUnstable() + } stages { /* stage('Clean') { steps{ @@ -41,13 +44,13 @@ pipeline { } } } - stage ('Download arts') { + /*stage ('Download arts') { steps { sh 'echo "artifact file" > generatedfile.txt' } - } + } */ stage ('Deliver') { steps { From 92c42e613ebe36994cde0e81f8633449d7e77a03 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:26:25 +0300 Subject: [PATCH 59/82] Update Jenkinsfile --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5b53e360..dfec6514 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,12 @@ pipeline { steps { sh 'mvn test' } - + post { + always{ + junit 'target/surefire-reports/*.xml' + } + } + } stage('SCM') { @@ -71,7 +76,6 @@ pipeline { success { archiveArtifacts artifacts: '**/*.jar', fingerprint:true - junit 'target/surefire-reports/*.xml' } } } From 93d64ac2b1a92f18bc0bf800b4d9889dbc9cdebb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:32:52 +0300 Subject: [PATCH 60/82] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dfec6514..47dc110f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,11 +57,11 @@ pipeline { } } */ - stage ('Deliver') { + /*stage ('Deliver') { steps { sh './jenkins/scripts/deliver.sh' } - } + } */ stage("Quality Gate") { steps { From 509f1b3509f050db1d81531db760e96002a5d89b Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:37:36 +0300 Subject: [PATCH 61/82] Update Jenkinsfile --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 47dc110f..dee7578a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,7 +62,15 @@ pipeline { sh './jenkins/scripts/deliver.sh' } } */ - + stage ('Deliver') { + steps { + sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' + sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' + sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' + sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example" + } + } + stage("Quality Gate") { steps { echo '---------Quality Gate--------' From 9f7bae3e5d6039899f6cc242be234624b86c8abb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:39:36 +0300 Subject: [PATCH 62/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index dee7578a..69a0f81b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,7 +67,7 @@ pipeline { sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example" + sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' } } From 95dd5d5550ab483a9d8651fa40ca07a604ee756d Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 15:48:38 +0300 Subject: [PATCH 63/82] Update Jenkinsfile --- Jenkinsfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 69a0f81b..26f2dd53 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,15 +62,7 @@ pipeline { sh './jenkins/scripts/deliver.sh' } } */ - stage ('Deliver') { - steps { - sh 'ssh jenkins@3.125.242.200 rm -rf /temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 mkdir -p /temp_deploy' - sh 'scp -r dist jenkins@3.125.242.200"/temp_deploy/dist' - sh 'ssh jenkins@3.125.242.200 "rm -rf /var/temp_deploy/dist && mv /var/temp_deploy/dist /var/example"' - } - } - + stage("Quality Gate") { steps { echo '---------Quality Gate--------' From 5c2323dac804bab6ba535a8573ca3fd34b0997be Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:01:08 +0300 Subject: [PATCH 64/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 26f2dd53..a0c73aac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -66,7 +66,7 @@ pipeline { stage("Quality Gate") { steps { echo '---------Quality Gate--------' - timeout(time: 10, unit: 'MINUTES') { + timeout(time: 50, unit: 'SECONDS') { waitForQualityGate abortPipeline: true } } From 599ea970c4956de71dc7aa547a0077f2f528cc6d Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:22:48 +0300 Subject: [PATCH 65/82] Update Jenkinsfile --- Jenkinsfile | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0c73aac..97942a1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { steps { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn -B -DskipTests clean package' + sh 'mvn clean package sonar:sonar' } } @@ -35,20 +35,7 @@ pipeline { } } - - stage('SCM') { - steps{ - git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - } - } - stage('SonarQube Analysis'){ - steps { - withSonarQubeEnv(installationName:'sonarqube') { - sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar' - } - } - } /*stage ('Download arts') { steps { @@ -66,8 +53,12 @@ pipeline { stage("Quality Gate") { steps { echo '---------Quality Gate--------' - timeout(time: 50, unit: 'SECONDS') { - waitForQualityGate abortPipeline: true + timeout(time: 5, unit: 'MINUTES') { + def qg = waitForQualityGate() + if (qg.status = OK){ + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } } } From 1eea95f35c0d06a7b43f5ee1a5756b5a0dd689d3 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:23:56 +0300 Subject: [PATCH 66/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 97942a1d..a908647e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { echo '---------Quality Gate--------' timeout(time: 5, unit: 'MINUTES') { def qg = waitForQualityGate() - if (qg.status = OK){ + if (qg.status != 'OK'){ error "Pipeline aborted due to quality gate failure: ${qg.status}" } From c648408c4d9026ef7745037323f57e6e20811b4a Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:25:39 +0300 Subject: [PATCH 67/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a908647e..79576031 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { echo '---------Quality Gate--------' timeout(time: 5, unit: 'MINUTES') { def qg = waitForQualityGate() - if (qg.status != 'OK'){ + if (qg.status != 'OK') { error "Pipeline aborted due to quality gate failure: ${qg.status}" } From 68c600d06749392123c3794a6922e483ad23a6e0 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:32:15 +0300 Subject: [PATCH 68/82] Update Jenkinsfile --- Jenkinsfile | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 79576031..43874db2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,13 +16,13 @@ pipeline { } } */ - stage('Build') { - steps { - echo '-------Build Started mf--------' - git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' - sh 'mvn clean package sonar:sonar' + stage("build & SonarQube analysis") { + steps { + withSonarQubeEnv('My SonarQube Server') { + sh 'mvn clean package sonar:sonar' + } } - } + } stage('Test') { steps { @@ -53,18 +53,13 @@ pipeline { stage("Quality Gate") { steps { echo '---------Quality Gate--------' - timeout(time: 5, unit: 'MINUTES') { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - - } + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } } } - } post { - success { + always { archiveArtifacts artifacts: '**/*.jar', fingerprint:true } From c16b112b63a0a741a8f2b6a1ea21ba6ee4478fb1 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:32:56 +0300 Subject: [PATCH 69/82] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 43874db2..226bc02e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -65,3 +65,4 @@ pipeline { } } } +} From 2396a18bdd6a75e9331c2e6efeea867482d04dfb Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:38:47 +0300 Subject: [PATCH 70/82] Update Jenkinsfile --- Jenkinsfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 226bc02e..29b30f2e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,9 +6,6 @@ pipeline { args '-v /root/.m2:/root/.m2' } } - options { - skipStagesAfterUnstable() - } stages { /* stage('Clean') { steps{ @@ -55,8 +52,8 @@ pipeline { echo '---------Quality Gate--------' timeout(time: 10, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } } + } } post { always { @@ -64,5 +61,5 @@ pipeline { fingerprint:true } } -} + } } From a3e474ff1a5810c34ec12abc2d5efca861148697 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sat, 25 Apr 2020 16:39:16 +0300 Subject: [PATCH 71/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 29b30f2e..6ed1ac9a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ pipeline { } } } - post { + post { always { archiveArtifacts artifacts: '**/*.jar', fingerprint:true From 4fc3704c8328734d4bff6469e5cfb6d2c2b4e573 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Sun, 26 Apr 2020 21:55:19 +0300 Subject: [PATCH 72/82] Create build.sh --- build.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..25b27dc7 --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +echo 'The following Maven command installs your Maven-built Java application' +echo 'into the local Maven repository, which will ultimately be stored in' +echo 'Jenkins''s local Maven repository (and the "maven-repository" Docker data' +echo 'volume).' +set -x +mvn jar:jar install:install help:evaluate -Dexpression=project.name +set +x + +echo 'The following complex command extracts the value of the element' +echo 'within of your Java/Maven project''s "pom.xml" file.' +set -x +NAME=`mvn help:evaluate -Dexpression=project.name | grep "^[^\[]"` +set +x + +echo 'The following complex command behaves similarly to the previous one but' +echo 'extracts the value of the element within instead.' +set -x +VERSION=`mvn help:evaluate -Dexpression=project.version | grep "^[^\[]"` +set +x + +echo 'The following command runs and outputs the execution of your Java' +echo 'application (which Jenkins built using Maven) to the Jenkins UI.' +set -x +java -jar target/${NAME}-${VERSION}.jar From 5f32b579d066a301b993016fe6e27cb3229c1128 Mon Sep 17 00:00:00 2001 From: radjaafa Date: Mon, 27 Apr 2020 13:17:53 +0300 Subject: [PATCH 73/82] updated chmod build.sh --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From 7ef5c7eaf70a8d67ff8123c60892a4e157c91943 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Mon, 27 Apr 2020 13:41:08 +0300 Subject: [PATCH 74/82] Update pom.xml --- pom.xml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1c0d7dda..6723be4e 100644 --- a/pom.xml +++ b/pom.xml @@ -171,7 +171,23 @@ - + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + true + lib/ + com.mypackage.MyClass + + + + + From 738eb83ff165b63109c2f9b668305bfd3e0471bc Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Mon, 27 Apr 2020 14:16:43 +0300 Subject: [PATCH 75/82] Update Jenkinsfile --- Jenkinsfile | 78 +++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6ed1ac9a..ccd91141 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,60 +6,68 @@ pipeline { args '-v /root/.m2:/root/.m2' } } + options { + skipStagesAfterUnstable() + } + stages { - /* stage('Clean') { - steps{ - cleanWs() - } - } */ - stage("build & SonarQube analysis") { - steps { - withSonarQubeEnv('My SonarQube Server') { - sh 'mvn clean package sonar:sonar' - } + stage('Build') { + steps { + echo '-------Build Started mf--------' + git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' + sh 'mvn -B -DskipTests clean package' + archiveArtifacts artifacts: '**/*.jar', fingerprint:true } - } + } stage('Test') { steps { sh 'mvn test' + sh 'mvn verify' } - post { - always{ - junit 'target/surefire-reports/*.xml' + + } + + stage('SCM') { + steps{ + git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' + } + } + + stage('SonarQube Analysis') { + steps { + withSonarQubeEnv(installationName:'SonarQube') { + sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar' } } - } - /*stage ('Download arts') { - steps { - - sh 'echo "artifact file" > generatedfile.txt' - - } - } */ + /*stage ('Deploy') { + when{ + expression { + currentBuild.result == null || currentBuild.result == 'SUCCESS' + } + } + steps{ + sh './build.sh' + } + } */ - /*stage ('Deliver') { - steps { - sh './jenkins/scripts/deliver.sh' - } - } */ - stage("Quality Gate") { steps { echo '---------Quality Gate--------' - timeout(time: 10, unit: 'MINUTES') { + timeout(time: 5, unit: 'MINUTES') { waitForQualityGate abortPipeline: true + } } - } } - post { - always { - archiveArtifacts artifacts: '**/*.jar', - fingerprint:true + } + post { + success { + junit 'target/surefire-reports/*Test.xml' + junit 'target/failsafe-reports/*IT.xml' + archive 'target/*jar' } } - } } From 49da18aeccd65db1052b5ad7a7feed3fca37f8e9 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:03:58 +0300 Subject: [PATCH 76/82] Update Jenkinsfile --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index ccd91141..f1da20c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,4 +70,11 @@ pipeline { archive 'target/*jar' } } + stage('Push'){ + steps{ + sshagent (credentials['jenkins']){ + sh 'scp -o StrictHostKeyChecking=no target/*.jar jenkins@3.125.242.200' + } + } + } } From a82e56e16d12e94bcc82d1eb8c4cbc82a051d6e4 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:05:07 +0300 Subject: [PATCH 77/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f1da20c3..f3e1adb8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ pipeline { archive 'target/*jar' } } - stage('Push'){ + stage('Push'){ steps{ sshagent (credentials['jenkins']){ sh 'scp -o StrictHostKeyChecking=no target/*.jar jenkins@3.125.242.200' From e52c8b3145d955bf46696ad47326c0a2a87c9c05 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:07:14 +0300 Subject: [PATCH 78/82] Update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f3e1adb8..894019d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,7 +43,7 @@ pipeline { } } - /*stage ('Deploy') { + /*stage ('Deploy or build') { when{ expression { currentBuild.result == null || currentBuild.result == 'SUCCESS' @@ -62,7 +62,7 @@ pipeline { } } } - } + post { success { junit 'target/surefire-reports/*Test.xml' @@ -77,4 +77,5 @@ pipeline { } } } + } } From 7349e814e4e1099b9d5cc83df4fc2712fe0ab763 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:12:40 +0300 Subject: [PATCH 79/82] Update Jenkinsfile --- Jenkinsfile | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 894019d5..23052da2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { echo '-------Build Started mf--------' git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' sh 'mvn -B -DskipTests clean package' - archiveArtifacts artifacts: '**/*.jar', fingerprint:true + archiveArtifacts artifacts: 'target/*.jar', fingerprint:true } } @@ -25,6 +25,8 @@ pipeline { steps { sh 'mvn test' sh 'mvn verify' + junit 'target/surefire-reports/*Test.xml' + junit 'target/failsafe-reports/*IT.xml' } } @@ -34,7 +36,7 @@ pipeline { git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' } } - + stage('SonarQube Analysis') { steps { withSonarQubeEnv(installationName:'SonarQube') { @@ -43,17 +45,6 @@ pipeline { } } - /*stage ('Deploy or build') { - when{ - expression { - currentBuild.result == null || currentBuild.result == 'SUCCESS' - } - } - steps{ - sh './build.sh' - } - } */ - stage("Quality Gate") { steps { echo '---------Quality Gate--------' @@ -62,14 +53,7 @@ pipeline { } } } - - post { - success { - junit 'target/surefire-reports/*Test.xml' - junit 'target/failsafe-reports/*IT.xml' - archive 'target/*jar' - } - } + stage('Push'){ steps{ sshagent (credentials['jenkins']){ @@ -77,5 +61,10 @@ pipeline { } } } + post { + success { + echo 'Build finished contrary to common sense' + } + } } } From 21a81ae1abb6a3b4e2e48bb1ebc3a031729400b6 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:15:07 +0300 Subject: [PATCH 80/82] Update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 23052da2..608ad2fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { git 'https://github.com/radjaafa/java-maven-junit-helloworld.git' } } - + stage('SonarQube Analysis') { steps { withSonarQubeEnv(installationName:'SonarQube') { @@ -61,10 +61,11 @@ pipeline { } } } + } post { success { echo 'Build finished contrary to common sense' } } - } + } From afaa0c42b26d854a086b981dd16839d1489f3a49 Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:18:26 +0300 Subject: [PATCH 81/82] Update Jenkinsfile --- Jenkinsfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 608ad2fd..62c707c8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,6 +44,14 @@ pipeline { } } } + + stage('Push'){ + steps{ + sshagent (credentials['jenkins']){ + sh 'scp -o StrictHostKeyChecking=no target/*.jar jenkins@3.125.242.200' + } + } + } stage("Quality Gate") { steps { @@ -54,13 +62,6 @@ pipeline { } } - stage('Push'){ - steps{ - sshagent (credentials['jenkins']){ - sh 'scp -o StrictHostKeyChecking=no target/*.jar jenkins@3.125.242.200' - } - } - } } post { success { From 9b1858238e34d10734fca3935093b308c94dc27e Mon Sep 17 00:00:00 2001 From: radjaafa <47540328+radjaafa@users.noreply.github.com> Date: Tue, 28 Apr 2020 20:22:54 +0300 Subject: [PATCH 82/82] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 62c707c8..de183211 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { stage('Push'){ steps{ - sshagent (credentials['jenkins']){ + sshagent (credentials['jenkinsh']){ sh 'scp -o StrictHostKeyChecking=no target/*.jar jenkins@3.125.242.200' } }