diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..bb792090 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,45 @@ +pipeline { + agent any + + stages{ + stage("one"){ + steps{ + echo 'step 1' + sleep 3 + } + } + stage("two"){ + steps{ + echo 'step 2' + sleep 9 + } + } + stage("three"){ + when{ + branch 'master' + changeset "**/worker/**" + } + steps{ + echo 'step 3' + sleep 2 + } + } + stage("four"){ + steps{ + echo "step more" + } + } + stage("five-"){ + steps{ + echo "step more" + sleep 3 + } + } + } + + post{ + always{ + echo 'This pipeline is completed.' + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index b8ad8a94..eba758e9 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,12 @@ 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. + +## 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/) + +Test beat + 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 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 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 diff --git a/vote/integration_test.sh b/vote/integration_test.sh index 956dcdea..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 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 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 diff --git a/worker/Jenkinsfile b/worker/Jenkinsfile new file mode 100644 index 00000000..3e95f6e5 --- /dev/null +++ b/worker/Jenkinsfile @@ -0,0 +1,83 @@ +pipeline { + 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' + 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("${env.BRANCH_NAME}") + workerImage.push("latest") + } + } + } + } + } + + post{ + always{ + echo 'Building multibranch pipeline for worker is completed..' + } + } + } 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