From a59a46d6dc5f3ef41280d948dd32ba0b91415858 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Mon, 13 Jun 2022 08:53:37 -0400 Subject: [PATCH 01/15] test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b8ad8a94af..b2753b6a80 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Example Voting App ========= + Getting started --------------- From 71a0ee41c9c0fc8ddf8da1192b4c2d55cfcf141e Mon Sep 17 00:00:00 2001 From: rs-droid Date: Mon, 13 Jun 2022 09:07:31 -0400 Subject: [PATCH 02/15] added app info --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b2753b6a80..080c8bb2f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Example Voting App ========= +This is a sample instavote application Getting started --------------- From 02efd854f693153098b3e2c79b0d2787265f10a5 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Mon, 13 Jun 2022 11:13:39 -0400 Subject: [PATCH 03/15] added Jenkinsfile for worker with build job --- worker/Jenkinsfile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 worker/Jenkinsfile diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile new file mode 100644 index 0000000000..65f56d65d0 --- /dev/null +++ b/worker/Jenkinsfile @@ -0,0 +1,31 @@ +pipeline { +agent any +tools{ +maven 'maven 3.6.1' +} +stages{ +stage("build"){ +steps{ +echo 'Compiling worker app' +dir('worker'){ +sh 'mvn compile' +} +} +} +stage("test"){ +steps{ +echo 'Running Unit Tets on worker app' +} +} +stage("package"){ +steps{ +echo 'Packaging worker app' +} +} +} +post{ +always{ +echo 'Building multibranch pipeline for worker is completed..' +} +} +} From b4652c2cba7788d96636457f18c5aff19ba6ef26 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Mon, 13 Jun 2022 13:02:04 -0400 Subject: [PATCH 04/15] added Jenkinsfile for worker with build job --- worker/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 65f56d65d0..db4643b5c9 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any tools{ -maven 'maven 3.6.1' +maven 'maven 3.8.5' } stages{ stage("build"){ From 68476788695c75cdaa403b7185468a4d36519a8a Mon Sep 17 00:00:00 2001 From: rs-droid Date: Mon, 13 Jun 2022 13:03:15 -0400 Subject: [PATCH 05/15] added Jenkinsfile for worker with build job --- worker/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index db4643b5c9..b3aa80a9b7 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any tools{ -maven 'maven 3.8.5' +maven 'Maven 3.8.5' } stages{ stage("build"){ From 8f38361cf4fadaea25012c768aa84dcb1273e9f0 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Tue, 14 Jun 2022 06:33:11 -0400 Subject: [PATCH 06/15] adding test and package run from worker --- worker/Jenkinsfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index b3aa80a9b7..3ac3943ecb 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -14,12 +14,18 @@ sh 'mvn compile' } stage("test"){ steps{ -echo 'Running Unit Tets on worker app' +echo 'Running Unit Tests on worker app' +dir('worker'){ +sh 'mvn clean test' +} } } stage("package"){ steps{ echo 'Packaging worker app' +dir('worker'){ +sh 'mvn package' +} } } } From 2196190d8de09b1ca4cbc84bfc8993db9cb197d9 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Tue, 14 Jun 2022 06:41:00 -0400 Subject: [PATCH 07/15] archive artifacts added --- worker/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 3ac3943ecb..a3fd434ac3 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -24,13 +24,14 @@ stage("package"){ steps{ echo 'Packaging worker app' dir('worker'){ -sh 'mvn package' +sh 'mvn package -DskipTests' } } } } post{ always{ +archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true echo 'Building multibranch pipeline for worker is completed..' } } From 7d185e389df96ca0a8cbf49da799ae3096d464b5 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Tue, 14 Jun 2022 06:56:09 -0400 Subject: [PATCH 08/15] when changes occur in worker and packaged in master --- worker/Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index a3fd434ac3..67d64e2910 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -5,6 +5,9 @@ maven 'Maven 3.8.5' } stages{ stage("build"){ +when{ +changeset "**/worker/**" +} steps{ echo 'Compiling worker app' dir('worker'){ @@ -13,6 +16,9 @@ sh 'mvn compile' } } stage("test"){ +when{ +changeset "**/worker/**" +} steps{ echo 'Running Unit Tests on worker app' dir('worker'){ @@ -21,6 +27,10 @@ sh 'mvn clean test' } } stage("package"){ +when{ +branch 'master' +changeset "**/worker/**" +} steps{ echo 'Packaging worker app' dir('worker'){ From 6043778a24c7bcc5ce01271fbc75f5d559d4f4dd Mon Sep 17 00:00:00 2001 From: rs-droid Date: Tue, 19 Jul 2022 09:08:14 -0400 Subject: [PATCH 09/15] adding dockerfile for worker --- worker/Dockerfile | 11 +++++++++++ worker/Jenkinsfile | 9 ++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 worker/Dockerfile diff --git a/worker/Dockerfile b/worker/Dockerfile new file mode 100644 index 0000000000..a827acb1d1 --- /dev/null +++ b/worker/Dockerfile @@ -0,0 +1,11 @@ +FROM maven:3.6.1-jdk-8-slim + +WORKDIR /app + +COPY . . + +RUN mvn package && \ + mv target/worker-jar-with-dependencies.jar /run/worker.jar && \ + rm -rf /app/* + +CMD java -jar /run/worker.jar diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 67d64e2910..114c20cf23 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,8 +1,11 @@ pipeline { -agent any -tools{ -maven 'Maven 3.8.5' +agent { +docker{ +image 'maven:3.6.1-jdk-8-slim' +args '-v $HOME/.m2:/root/.m2' } +} + stages{ stage("build"){ when{ From c4fee25cfd559a75de8a9c38216dc87f287ebb54 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Wed, 27 Jul 2022 06:47:27 -0400 Subject: [PATCH 10/15] use stage specific agents --- worker/Jenkinsfile | 144 ++++++++++++++++++++++++++++++--------------- 1 file changed, 96 insertions(+), 48 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 114c20cf23..bf2db0cae0 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,51 +1,99 @@ pipeline { -agent { -docker{ -image 'maven:3.6.1-jdk-8-slim' -args '-v $HOME/.m2:/root/.m2' -} -} -stages{ -stage("build"){ -when{ -changeset "**/worker/**" -} -steps{ -echo 'Compiling worker app' -dir('worker'){ -sh 'mvn compile' -} -} -} -stage("test"){ -when{ -changeset "**/worker/**" -} -steps{ -echo 'Running Unit Tests on worker app' -dir('worker'){ -sh 'mvn clean test' -} -} -} -stage("package"){ -when{ -branch 'master' -changeset "**/worker/**" -} -steps{ -echo 'Packaging worker app' -dir('worker'){ -sh 'mvn package -DskipTests' -} -} -} -} -post{ -always{ -archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true -echo 'Building multibranch pipeline for worker is completed..' -} -} + agent none + + stages{ + stage("build"){ + when{ + changeset "**/worker/**" + } + + + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' + } + } + + + steps{ + echo 'Compiling worker app' + dir('worker'){ + sh 'mvn compile' + } + } + } + + + stage("test"){ + when{ + changeset "**/worker/**" + } + + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' + } + } + + steps{ + echo 'Running Unit Tests on worker app' + dir('worker'){ + sh 'mvn clean test' + } + } + } + + + stage("package"){ + when{ + branch 'master' + changeset "**/worker/**" + } + + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' + } + } + + steps{ + echo 'Packaging worker app' + dir('worker'){ + sh 'mvn package -DskipTests' + } + } + } + + + stage('docker-package'){ + agent any + when{ + changeset "**/worker/**" + branch 'master' + } + steps{ + echo 'Packaging worker app with docker' + script{ + docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') +{ + def workerImage = docker.build("rsdroid/worker:v$ +{env.BUILD_ID}", "./worker") + workerImage.push() + workerImage.push("${env.BRANCH_NAME}") + workerImage.push("latest") + } + } + } + } + } + + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } + } } From 027e5a609ec4e0ae28b425b9dac73460a4f5c69b Mon Sep 17 00:00:00 2001 From: rs-droid Date: Wed, 27 Jul 2022 07:11:38 -0400 Subject: [PATCH 11/15] use stage specific agents --- worker/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index bf2db0cae0..e5306385ba 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -80,8 +80,7 @@ pipeline { script{ docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { - def workerImage = docker.build("rsdroid/worker:v$ -{env.BUILD_ID}", "./worker") + def workerImage = docker.build("rsdroid/worker:v${env.BUILD_ID}", "./worker") workerImage.push() workerImage.push("${env.BRANCH_NAME}") workerImage.push("latest") From ad1e13f48316652b168d335c1826926dd340567d Mon Sep 17 00:00:00 2001 From: rs-droid Date: Wed, 27 Jul 2022 07:21:03 -0400 Subject: [PATCH 12/15] use stage specific agents --- worker/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index e5306385ba..ae768bf1a1 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -11,8 +11,8 @@ pipeline { agent{ docker{ - image 'maven:3.6.1-jdk-8-slim' - args '-v $HOME/.m2:/root/.m2' + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' } } From 00cdce0a5513a0dbe7746db6ad67ffabf0ee4f75 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Wed, 27 Jul 2022 07:25:57 -0400 Subject: [PATCH 13/15] use stage specific agents --- worker/Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index ae768bf1a1..28981565da 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -4,17 +4,18 @@ pipeline { stages{ stage("build"){ + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' + } + } + when{ changeset "**/worker/**" } - agent{ - docker{ - image 'maven:3.6.1-jdk-8-slim' - args '-v $HOME/.m2:/root/.m2' - } - } steps{ From f30026b698ecf97a72aad93a52e2e156228aaece Mon Sep 17 00:00:00 2001 From: rs-droid Date: Sat, 30 Jul 2022 15:18:56 -0400 Subject: [PATCH 14/15] Jenkinsfiles for result and vote --- vote/Jenkinsfile | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 vote/Jenkinsfile diff --git a/vote/Jenkinsfile b/vote/Jenkinsfile new file mode 100644 index 0000000000..eb86ef3334 --- /dev/null +++ b/vote/Jenkinsfile @@ -0,0 +1,79 @@ +pipeline { + + agent none + + stages{ + agent{ + docker{ + image 'python:2.7.16-slim' + args '--user root' + } + } + + + stage("build"){ + + when{ + changeset "**/vote/**" + } + + + + steps{ + echo 'Compiling vote app' + dir('vote'){ + sh 'pip install -r requirements.txt' + } + } + } + + + stage("test"){ + when{ + changeset "**/vote/**" + } + + agent{ + docker{ + image 'python:2.7.16-slim' + args '--user root' + } + } + + steps{ + echo 'Running Unit Tests on worker app' + dir('vote'){ + sh 'pip install -r requirements.txt' + sh 'nosetests -v' + } + } + } + + + + stage('docker-package'){ + agent any + when{ + changeset "**/vote/**" + branch 'master' + } + steps{ + echo 'Packaging vote app with docker' + script{ + docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin'){ + def workerImage = docker.build("rsdroid/vote:v${env.BUILD_ID}", "./vote") + workerImage.push() + workerImage.push("${env.BRANCH_NAME}") + workerImage.push("latest") + } + } + } + } + } + + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } + } +} From 604bcab25fdcc58566e6ea3fe80472441c958dd9 Mon Sep 17 00:00:00 2001 From: rs-droid Date: Sat, 30 Jul 2022 15:21:46 -0400 Subject: [PATCH 15/15] Jenkinsfiles repushed result wasn't added --- result/Jenkinsfile | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 result/Jenkinsfile diff --git a/result/Jenkinsfile b/result/Jenkinsfile new file mode 100644 index 0000000000..1e6ebdae7d --- /dev/null +++ b/result/Jenkinsfile @@ -0,0 +1,76 @@ +pipeline { + + agent none + + + stages{ + + + stage("build"){ + + + agent{ + docker{ + image 'node:8.16.0-alpine' + } + } + + when{ + changeset "**/result/**" + } + + + steps{ + echo 'Compiling result app' + dir('result'){ + sh 'npm install' + } + } + } + + + stage("test"){ + + agent{ + docker{ + image 'node:8.16.0-alpine' + } + } + + when{ + changeset "**/result/**" + } + + + steps{ + echo 'Running Unit Tests on result app' + dir('result'){ + sh 'npm install' + sh 'npm test' + } + } + } + + + stage('docker-package'){ + agent any + when{ + changeset "**/result/**" + branch 'master' + } + + steps{ + echo 'Packaging result app with docker' + script{ + docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') { + def workerImage = docker.build("rsdroid/result:v${env.BUILD_ID}", "./result") + workerImage.push() + workerImage.push("${env.BRANCH_NAME}") + workerImage.push("latest") + } + } + } + } + } + +}