Skip to content

D file #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
bd15e10
Create TEST.md
cheloghm Nov 1, 2022
f5aed25
Update TEST.md
cheloghm Nov 1, 2022
c003ba5
Update TEST.md
cheloghm Nov 1, 2022
0ec0904
again
cheloghm Nov 1, 2022
41d2bb7
and again
cheloghm Nov 1, 2022
e878b60
again
cheloghm Nov 1, 2022
3cf8141
again
cheloghm Nov 1, 2022
ffbb5b4
again
cheloghm Nov 1, 2022
a14a5bd
try
cheloghm Nov 1, 2022
9a48057
clean-up
cheloghm Nov 1, 2022
eef188a
added build status badge
cheloghm Nov 1, 2022
a3ee3b5
worker test build status badge
cheloghm Nov 1, 2022
02d346e
appropriate headers
cheloghm Nov 1, 2022
057680b
worker package build status badge
cheloghm Nov 1, 2022
f4a69c3
worker test subject
cheloghm Nov 1, 2022
6ef73f0
color
cheloghm Nov 1, 2022
4b4e090
color 2
cheloghm Nov 1, 2022
acf179f
badge
cheloghm Nov 1, 2022
2133fd5
added application info
cheloghm Nov 1, 2022
e83a244
Merge pull request #1 from cheloghm/readme
cheloghm Nov 1, 2022
b339f32
added Jenkinsfile for worker with build job
cheloghm Nov 1, 2022
338e361
Merge pull request #2 from cheloghm/readme
kicksgray Nov 1, 2022
e9a3892
added test and package jobs to worker pipeline
cheloghm Nov 1, 2022
f599152
archive artifacts, skip tests while packaging
cheloghm Nov 1, 2022
bd44417
run packaging step only on master, run stages only when worker code c…
cheloghm Nov 1, 2022
738cdad
Merge pull request #3 from cheloghm/readme
cheloghm Nov 1, 2022
d534965
added slack notifications
cheloghm Nov 2, 2022
b281fdd
Merge pull request #4 from cheloghm/feature/workpipe
kicksgray Nov 2, 2022
3958167
Revert "Feature/workpipe"
kicksgray Nov 2, 2022
52ed626
Merge pull request #5 from cheloghm/revert-4-feature/workpipe
cheloghm Nov 2, 2022
be16b22
added jenkinsfile for result app
cheloghm Nov 2, 2022
c4dadd3
added a mock test
cheloghm Nov 2, 2022
aabe76e
Merge pull request #6 from cheloghm/feature/resultpipe
cheloghm Nov 2, 2022
52d3790
added pipeline code for vote app
cheloghm Nov 4, 2022
3a006f0
mock change
cheloghm Nov 4, 2022
9dab278
run build containers as root
cheloghm Nov 4, 2022
2f5b651
try to correct doocker
cheloghm Nov 4, 2022
c352cb6
added docker based agent to worker app
cheloghm Nov 4, 2022
7f3f369
corrected result app Jenkinsfile
cheloghm Nov 4, 2022
e35e33c
corrected docker syntax in worker app Jenkinsfile
cheloghm Nov 4, 2022
64f8bb6
removed column after keyword in docker agent implementation, in the w…
cheloghm Nov 4, 2022
2a892b9
Merge pull request #7 from cheloghm/feature/dockerbuilds
cheloghm Nov 4, 2022
a4904c1
added dockerfile for worker app
cheloghm Nov 5, 2022
83592a5
added docker package stage
cheloghm Nov 5, 2022
4de8319
test
cheloghm Nov 5, 2022
5a15528
use stage specific agents
cheloghm Nov 5, 2022
ba520d2
added trailing / to the docker url
cheloghm Nov 5, 2022
e5327cd
comment test
cheloghm Nov 5, 2022
d8d6e04
added master branch conditional tag i docker-package again
cheloghm Nov 5, 2022
27f8452
Merge branch 'master' into feature/dockerfiles
cheloghm Nov 5, 2022
26d1b97
Merge pull request #8 from cheloghm/feature/dockerfiles
cheloghm Nov 5, 2022
2ec6026
- added docker build and publish stage
cheloghm Nov 5, 2022
52b3a30
Merge to resolve conflicts
cheloghm Nov 5, 2022
9164e19
To reslove conflicts
cheloghm Nov 5, 2022
2a93386
edited the Jenkinsfile to tage image as latest and not branch name
cheloghm Nov 5, 2022
e18d0ab
Merge pull request #9 from cheloghm/feature/dockerfiles
cheloghm Nov 5, 2022
a463dc9
added docker-compose spec
cheloghm Nov 7, 2022
4aca695
added Jenkinsfile to create a single pipeline for all the micro services
cheloghm Nov 7, 2022
6700e23
corrections
cheloghm Nov 7, 2022
7037539
Added Jenkinsfile
cheloghm Nov 7, 2022
d97a3b4
Update TEST.md
cheloghm Nov 7, 2022
97067a5
Merge pull request #11 from cheloghm/cheloghm-patch-1
cheloghm Nov 7, 2022
86a6797
Merge pull request #10 from cheloghm/feature/monopipe
cheloghm Nov 7, 2022
2cc8301
modified Jenkinfile
cheloghm Nov 7, 2022
90e550d
commented Dockerfile for test
cheloghm Nov 7, 2022
361e910
Merge pull request #12 from cheloghm/feature/monopipe
cheloghm Nov 7, 2022
711a34c
modified the general Jenkinsfile and the docker-compose file to see i…
cheloghm Nov 7, 2022
568d9a4
modified again
cheloghm Nov 7, 2022
0a6758b
added steps taken to fix mono-pipeline.
cheloghm Nov 7, 2022
aad7162
testing how to add stage on blueocean ui
cheloghm Nov 8, 2022
710b649
run deploy to dev only on master
cheloghm Nov 8, 2022
1265cab
added sonarqube configurations
cheloghm Nov 10, 2022
00746db
aded integration test for vote app
cheloghm Nov 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 275 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
pipeline {
agent none
stages {
stage('worker build') {
agent {
docker {
image 'maven:3.6.1-jdk-8-alpine'
args '-v $HOME/.m2/root/.m2'
}

}
when {
changeset '**/worker/**'
}
steps {
echo 'Compiling worker app'
dir(path: 'worker') {
sh 'mvn compile'
}

}
}

stage('worker test') {
agent {
docker {
image 'maven:3.6.1-jdk-8-alpine'
args '-v $HOME/.m2/root/.m2'
}

}
when {
changeset '**/worker/**'
}
steps {
echo 'Running unit Tests on worker app'
dir(path: 'worker') {
sh 'mvn clean test'
}

}
}

stage('worker package') {
agent {
docker {
image 'maven:3.6.1-jdk-8-alpine'
args '-v $HOME/.m2/root/.m2'
}

}
when {
branch 'master'
changeset '**/worker/**'
}
steps {
echo 'Packaging worker app'
dir(path: 'worker') {
sh 'mvn package -DskipTests'
archiveArtifacts(artifacts: '**/target/*.jar', fingerprint: true)
}

}
}

stage('worker-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("cheloghm/worker:v${env.BUILD_ID}", "./worker")
workerImage.push()
workerImage.push("${env.BRANCH_NAME}")
}
}

}
}

stage('vote build') {
agent {
docker {
image 'python:2.7.16-slim'
args '--user root'
}

}
when {
changeset '**/vote/**'
}
steps {
echo 'Compiling vote app'
dir(path: 'vote') {
sh 'pip install -r requirements.txt'
}

}
}

stage('vote test') {
agent {
docker {
image 'python:2.7.16-slim'
args '--user root'
}

}
when {
changeset '**/vote/**'
}
steps {
echo 'Running unit Tests on vote app'
dir(path: 'vote') {
sh 'pip install -r requirements.txt'
sh 'nosetests -v'
}

}
}

stage('vote integration'){
agent any
when{
changeset "**/vote/**"
branch 'master'
}
steps{
echo 'Running Integration Tests on vote app'
dir('vote'){
sh 'sh integration_test.sh'
}
}
}

stage('vote-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 voteImage = docker.build("cheloghm/vote:v${env.BUILD_ID}", "./vote")
voteImage.push()
voteImage.push("${env.BRANCH_NAME}")
}
}

}
}

stage('result build') {
agent {
docker {
image 'node:8.16.0-alpine'
}

}
when {
changeset '**/result/**'
}
steps {
echo 'Compiling result app'
dir(path: 'result') {
sh 'npm install'
}

}
}

stage('result test') {
agent {
docker {
image 'node:8.16.0-alpine'
}

}
when {
changeset '**/result/**'
}
steps {
echo 'Running unit Tests on result app'
dir(path: 'result') {
sh 'npm install'
sh 'npm test'
}

}
}

stage('result-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 resultImage = docker.build("cheloghm/result:v${env.BUILD_ID}", "./result")
resultImage.push()
resultImage.push("${env.BRANCH_NAME}")
}
}

}
}

stage('Sonarqube') {
agent any
when{
branch 'master'
}
tools {
jdk "JDK11" // the name you have given the JDK installation in Global Tool Configuration
}

environment{
sonarpath = tool 'SonarScanner'
}

steps {
echo 'Running Sonarqube Analysis..'
withSonarQubeEnv('sonar-instavote') {
sh "${sonarpath}/bin/sonar-scanner -Dproject.settings=sonar-project.properties -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400"
}
}
}


stage("Quality Gate") {
steps {
timeout(time: 1, unit: 'HOURS') {
// Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails
// true = set pipeline to UNSTABLE, false = don't
waitForQualityGate abortPipeline: true
}
}
}

stage('Deploy to Dev') {
agent any
when {
branch 'master'
}
steps {
sh 'docker-compose up -d'
}
}

}
post {
always {
echo 'Pipeline for instavote app is complete...'
}

failure {
slackSend(channel: 'instavote-ci', message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
}

success {
echo 'Pipeline for worker is complete...'
slackSend(channel: 'instavote-ci', message: "Build Succeeded - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
}

}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Example Voting App
=========

This ia a sample instavote application.

Getting started
---------------

Expand Down
5 changes: 5 additions & 0 deletions TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Just testing the webhook
Clean up
Fix the mono-pipeline first
Got the mono-pipeline working by changing the images of the different micro-services to smaller compatible images,
so it can easily be pulled during the build process.
52 changes: 52 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: "3.8"

volumes:
db-data:

networks:
instavote:
driver: bridge

services:
vote:
image: cheloghm/vote:latest
build: ./vote
ports:
- 5002:80
depends_on:
- redis
networks:
- instavote

redis:
image: redis:alpine
networks:
- instavote

db:
image: postgres:9.4
volumes:
- "db-data:/var/lib/postgresql/data"
networks:
- instavote
environment:
- POSTGRES_HOST_AUTH_METHOD=trust

result:
image: cheloghm/result:latest
build: ./vote
ports:
- 5003:4000
depends_on:
- db
networks:
- instavote

worker:
image: cheloghm/worker:latest
build: ./vote
depends_on:
- redis
- db
networks:
- instavote
Loading