From ec23ec74681a58968270208357f95380999180ff Mon Sep 17 00:00:00 2001 From: skibum77 <52608163+skibum77@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:24:17 +0100 Subject: [PATCH 01/26] new --- result/views/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/result/views/index.html b/result/views/index.html index c198a908..fca17a84 100644 --- a/result/views/index.html +++ b/result/views/index.html @@ -2,7 +2,7 @@ - Cats vs Dogs -- Result + Cats vs. Dogs -- Result From 6fa508773d59aff4955c4558bccb7cc49a785096 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 20 Nov 2023 20:55:10 +0100 Subject: [PATCH 02/26] test modification --- vote/integration_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vote/integration_test.sh b/vote/integration_test.sh index 956dcdea..598c7fca 100755 --- a/vote/integration_test.sh +++ b/vote/integration_test.sh @@ -8,7 +8,7 @@ docker-compose build docker-compose up -d -echo "I: Launching Integration Test ..." +echo "I: Launching Integration Test ...." docker-compose run --rm integration /test/test.sh From 1344588af2114d64bf1dde90bd10ef76ec81f47e Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 20 Nov 2023 20:56:51 +0100 Subject: [PATCH 03/26] view mofi --- vote/integration_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vote/integration_test.sh b/vote/integration_test.sh index 598c7fca..dab64845 100755 --- a/vote/integration_test.sh +++ b/vote/integration_test.sh @@ -8,7 +8,7 @@ docker-compose build docker-compose up -d -echo "I: Launching Integration Test ...." +echo "I: Launching Integration Test ....." docker-compose run --rm integration /test/test.sh From b088fcca02bb52b571218204a6bc8bf592720d13 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 20 Nov 2023 21:04:17 +0100 Subject: [PATCH 04/26] testfile attached --- vote/tests/test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 vote/tests/test.txt diff --git a/vote/tests/test.txt b/vote/tests/test.txt new file mode 100644 index 00000000..bc3c531f --- /dev/null +++ b/vote/tests/test.txt @@ -0,0 +1 @@ +das ist ein test \ No newline at end of file From ce4a354e0964c01b54ab5435f405a1872e9f75b3 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 20 Nov 2023 21:11:08 +0100 Subject: [PATCH 05/26] estend readme file --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b8ad8a94..3bf5b603 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,5 @@ Note ---- The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client. + +http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-build From 12f07a9993d7216bc7d7bc07f41ba3c80905f35e Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 20 Nov 2023 21:23:46 +0100 Subject: [PATCH 06/26] new build message --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bf5b603..ff708c36 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,9 @@ Note The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client. -http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-build +## Worker Java App +* Build Status + +[![Build +Status](http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-test)](http://34.65.36.125:8080/job/instavote/job/worker-test/) + From 9bf35a9c9f0fc22367260f6ce175566fefc69805 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 15:50:01 +0100 Subject: [PATCH 07/26] test --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ff708c36..a861fe13 100644 --- a/README.md +++ b/README.md @@ -65,3 +65,5 @@ The voting application only accepts one vote per client. It does not register vo [![Build Status](http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-test)](http://34.65.36.125:8080/job/instavote/job/worker-test/) +Test + From 8a9e7b84169c1013d96eefe021d4ea5f70bfbdd8 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 16:16:02 +0100 Subject: [PATCH 08/26] test2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a861fe13..700cf1e4 100644 --- a/README.md +++ b/README.md @@ -65,5 +65,5 @@ The voting application only accepts one vote per client. It does not register vo [![Build Status](http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-test)](http://34.65.36.125:8080/job/instavote/job/worker-test/) -Test +Test 1 From 0dc8addac77babd4a067564ee610a24bc8fb7240 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 16:16:52 +0100 Subject: [PATCH 09/26] new --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 700cf1e4..b648e801 100644 --- a/README.md +++ b/README.md @@ -65,5 +65,5 @@ The voting application only accepts one vote per client. It does not register vo [![Build Status](http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-test)](http://34.65.36.125:8080/job/instavote/job/worker-test/) -Test 1 +Test 2 From d98c8952f1db622db1ef5797fb65af1b006d9a18 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 16:25:29 +0100 Subject: [PATCH 10/26] test2 Beat Branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b648e801..eba758e9 100644 --- a/README.md +++ b/README.md @@ -65,5 +65,5 @@ The voting application only accepts one vote per client. It does not register vo [![Build Status](http://34.65.144.166:8080/buildStatus/icon?job=instavote%2Fworker-test)](http://34.65.36.125:8080/job/instavote/job/worker-test/) -Test 2 +Test beat From 711887685e005031d6d1d4c05be309dd934143df Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 17:50:34 +0100 Subject: [PATCH 11/26] jenkinsfile added --- Jenkinsfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..7f224fd7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,30 @@ +pipeline { + agent any + + stages{ + stage("one"){ + steps{ + echo 'step 1' + sleep 3 + } + } + stage("two"){ + steps{ + echo 'step 2' + sleep 9 + } + } + stage("three"){ + steps{ + echo 'step 3' + sleep 5 + } + } + } + + post{ + always{ + echo 'This pipeline is completed.' + } + } +} \ No newline at end of file From aa3d93da8eae1fa6171d57a4cf88682d480baaa4 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 20:15:49 +0100 Subject: [PATCH 12/26] add more steps in jenkins file --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7f224fd7..c5fdc01e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,11 @@ pipeline { sleep 5 } } + stage("four"){ + steps{ + echo "step more" + } + } } post{ From f0a901926a7c79d0b4bcbb077d5c0e435965a06a Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 21 Nov 2023 20:50:03 +0100 Subject: [PATCH 13/26] new step branch beat --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index c5fdc01e..1dfc9866 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,6 +25,12 @@ pipeline { echo "step more" } } + stage("five"){ + steps{ + echo "step more" + sleep 3 + } + } } post{ From 0b77b4400707e83a2de3ee7f1d4d0a4478f0791f Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 27 Nov 2023 20:11:13 +0100 Subject: [PATCH 14/26] new --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1dfc9866..95872e99 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { echo "step more" } } - stage("five"){ + stage("five-"){ steps{ echo "step more" sleep 3 From b2e9f744869b726e7a79c66cd73db54ddcb55875 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 27 Nov 2023 20:33:33 +0100 Subject: [PATCH 15/26] changeset --- Jenkinsfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 95872e99..bb792090 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,10 +15,14 @@ pipeline { } } stage("three"){ - steps{ - echo 'step 3' - sleep 5 + when{ + branch 'master' + changeset "**/worker/**" } + steps{ + echo 'step 3' + sleep 2 + } } stage("four"){ steps{ From cf31faab866dab7eb3a3c54d76441747727525b4 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 28 Nov 2023 21:00:15 +0100 Subject: [PATCH 16/26] added Jenkinsfile for worker with build job --- worker/Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 worker/Jenkinsfile diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile new file mode 100644 index 00000000..83e3aa84 --- /dev/null +++ b/worker/Jenkinsfile @@ -0,0 +1,35 @@ +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 test on worker app" + } + } + stage("package"){ + steps{ + echo "Packaging worker app" + } + } + + } + post{ + always{ + echo "Building multibranch pipeline for worker app is completed" + } + } + } From 5aa36979b7190ea5841568c4c1fc53910bd458ed Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 28 Nov 2023 21:25:35 +0100 Subject: [PATCH 17/26] added Test and package job for worker pipeline --- worker/Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 83e3aa84..99f7cb53 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -18,11 +18,17 @@ pipeline{ stage("test"){ steps{ echo "Running Unit test on worker app" + dir ("worker"){ + sh "mvn clean test" + } } } stage("package"){ steps{ echo "Packaging worker app" + dir("worker"){ + sh "mvn package" + } } } From bbe4d0325cdf1959dec0c9475c8a6bada7f68780 Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 28 Nov 2023 21:31:17 +0100 Subject: [PATCH 18/26] archive artifacts, skip test and package --- worker/Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 99f7cb53..0533d547 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -27,7 +27,7 @@ pipeline{ steps{ echo "Packaging worker app" dir("worker"){ - sh "mvn package" + sh "mvn package -DskipTests" } } } @@ -35,7 +35,10 @@ pipeline{ } post{ always{ - echo "Building multibranch pipeline for worker app is completed" + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: +true + +echo "Building multibranch pipeline for worker app is completed" } } } From 5c408f7550c918f46ad508d6d96ec6d72811a0de Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 28 Nov 2023 21:44:30 +0100 Subject: [PATCH 19/26] un package step only on master, run stages only when worker changes --- worker/Jenkinsfile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 0533d547..91de2666 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -7,6 +7,9 @@ pipeline{ stages{ stage("Build"){ + when{ + changeset "**/worker/**" + } steps{ echo "Compiling worker app" dir ('worker'){ @@ -16,6 +19,9 @@ pipeline{ } } stage("test"){ + when{ + changeset "**/worker/**" + } steps{ echo "Running Unit test on worker app" dir ("worker"){ @@ -24,10 +30,15 @@ pipeline{ } } stage("package"){ + when{ + branch 'master' + changeset "**/worker/**" + } steps{ echo "Packaging worker app" dir("worker"){ - sh "mvn package -DskipTests" + sh 'mvn package -DskipTests' + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true } } } @@ -35,10 +46,7 @@ pipeline{ } post{ always{ - archiveArtifacts artifacts: '**/target/*.jar', fingerprint: -true - -echo "Building multibranch pipeline for worker app is completed" + echo "Building multibranch pipeline for worker app is completed" } } } From 215453d9627348590f476fff09febc0c148a22da Mon Sep 17 00:00:00 2001 From: Beat Date: Tue, 28 Nov 2023 22:02:16 +0100 Subject: [PATCH 20/26] add readme --- worker/Readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 worker/Readme.md diff --git a/worker/Readme.md b/worker/Readme.md new file mode 100644 index 00000000..30d74d25 --- /dev/null +++ b/worker/Readme.md @@ -0,0 +1 @@ +test \ No newline at end of file From 22f18d40a17e061f93a7d35ab22e28b8953ac706 Mon Sep 17 00:00:00 2001 From: Beat Date: Sun, 7 Jan 2024 19:15:12 +0100 Subject: [PATCH 21/26] adding dockerfile --- worker/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 worker/Dockerfile diff --git a/worker/Dockerfile b/worker/Dockerfile new file mode 100644 index 00000000..725c73e2 --- /dev/null +++ b/worker/Dockerfile @@ -0,0 +1,6 @@ +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 \ No newline at end of file From 7d327a558627ea489c8062c3ec38119a0b709539 Mon Sep 17 00:00:00 2001 From: Beat Date: Sun, 7 Jan 2024 19:34:51 +0100 Subject: [PATCH 22/26] new jenkins file --- worker/Jenkinsfile | 82 ++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 91de2666..112ee3ed 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,52 +1,56 @@ pipeline{ - agent any - - tools{ - maven 'maven 3.6.1' + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' } - +} stages{ - stage("Build"){ - when{ - changeset "**/worker/**" - } + stage('build'){ steps{ - echo "Compiling worker app" - dir ('worker'){ - sh 'mvn compile' + echo 'building worker app' + dir('worker'){ + sh 'mvn compile' + } } - - } - } - stage("test"){ - when{ - changeset "**/worker/**" - } + + } + stage('test'){ steps{ - echo "Running Unit test on worker app" - dir ("worker"){ - sh "mvn clean test" + echo 'running unit tests on worker app' + dir('worker'){ + sh 'mvn clean test' + } } + } + stage('package'){ + steps{ + echo 'packaging worker app into a jar file' + dir('worker'){ + sh 'mvn package -DskipTests' + archiveArtifacts artifacts: '**/target/*.jar', + fingerprint: true + } } - } - stage("package"){ - when{ - branch 'master' - changeset "**/worker/**" - } + } + stage('docker-package'){ + agent any steps{ - echo "Packaging worker app" - dir("worker"){ - sh 'mvn package -DskipTests' - archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true - } + echo 'Packaging worker app with docker' + script{ + docker.withRegistry('https://index.docker.io/v1/','dockerlogin') { + def workerImage = docker.build("skibum77/worker:v$ {env.BUILD_ID}", "./worker") + workerImage.push() + workerImage.push("latest") + } + } } } - } - post{ - always{ - echo "Building multibranch pipeline for worker app is completed" - } + +post{ + always{ + echo 'the job is complete' + } } - } +} \ No newline at end of file From 447788b45adbc0f7d9d6b3650c71fa2675b802d9 Mon Sep 17 00:00:00 2001 From: Beat Date: Sun, 7 Jan 2024 19:59:13 +0100 Subject: [PATCH 23/26] per stage agents, conditional execution --- worker/Jenkinsfile | 103 ++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 38 deletions(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index 112ee3ed..d87bb372 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -1,56 +1,83 @@ -pipeline{ - agent{ - docker{ - image 'maven:3.6.1-jdk-8-slim' - args '-v $HOME/.m2:/root/.m2' - } -} +pipeline { + agent none stages{ - stage('build'){ + stage("build"){ + when{ + changeset "**/worker/**" + } + agent{ + docker{ + image 'maven:3.6.1-jdk-8-slim' + args '-v $HOME/.m2:/root/.m2' + } + } steps{ - echo 'building worker app' + 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' + } } - - } - stage('test'){ steps{ - echo 'running unit tests on worker app' + echo 'Running Unit Tests on worker app..' dir('worker'){ sh 'mvn clean test' - } + } + } } - } - stage('package'){ + + 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 into a jar file' - dir('worker'){ - sh 'mvn package -DskipTests' - archiveArtifacts artifacts: '**/target/*.jar', - fingerprint: true - } - } - } + echo 'Packaging worker app' + dir('worker'){ + sh 'mvn package -DskipTests' + archiveArtifacts artifacts: '**/target/*.jar',fingerprint: true + } + } + } 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("skibum77/worker:v$ {env.BUILD_ID}", "./worker") - workerImage.push() - workerImage.push("latest") - } - } + script{docker.withRegistry('https://index.docker.io/v1/','dockerlogin') { + def workerImage = docker.build("xxxxx/worker:v${env.BUILD_ID}", "./worker") + workerImage.push() + workerImage.push("${env.BRANCH_NAME}") + workerImage.push("latest") + } + } + } + } } - } - } -post{ - always{ - echo 'the job is complete' + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } } - } -} \ No newline at end of file + } From 361d061e5905cf74e383720f4b055a2778ed70bd Mon Sep 17 00:00:00 2001 From: Beat Date: Sun, 7 Jan 2024 20:09:45 +0100 Subject: [PATCH 24/26] docker hub credentials update incl dockerhub id --- worker/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile index d87bb372..3e95f6e5 100644 --- a/worker/Jenkinsfile +++ b/worker/Jenkinsfile @@ -65,7 +65,7 @@ pipeline { steps{ echo 'Packaging worker app with docker' script{docker.withRegistry('https://index.docker.io/v1/','dockerlogin') { - def workerImage = docker.build("xxxxx/worker:v${env.BUILD_ID}", "./worker") + def workerImage = docker.build("skibum77/worker:v${env.BUILD_ID}", "./worker") workerImage.push() workerImage.push("${env.BRANCH_NAME}") workerImage.push("latest") From 9806f5c382955af63f822406af728cbd2d8379b7 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 8 Jan 2024 21:24:51 +0100 Subject: [PATCH 25/26] Dockerfile for result app --- result/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/result/Dockerfile b/result/Dockerfile index 4f3713fc..725259dc 100644 --- a/result/Dockerfile +++ b/result/Dockerfile @@ -1,3 +1,4 @@ +# FROM node:8.16.0-alpine WORKDIR /app From 19ba35a6cc5c61c32e849c5c7bceb46a2884ec50 Mon Sep 17 00:00:00 2001 From: Beat Date: Mon, 8 Jan 2024 21:32:28 +0100 Subject: [PATCH 26/26] Dockerfile vote app --- vote/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vote/Dockerfile b/vote/Dockerfile index c28587c8..6a2bfa89 100644 --- a/vote/Dockerfile +++ b/vote/Dockerfile @@ -1,5 +1,6 @@ # Using official python runtime base image -FROM eeganlf/voteapp-python:v0.1.0 +#FROM eeganlf/voteapp-python:v0.1.0 +FROM python:2.7-alpine # Set the application directory WORKDIR /app