Skip to content
Open

Dev #258

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0db1af3
fix: Delete worker/Jenkinsfile as is created in labs
eeganlf Jul 3, 2025
96695ab
Create lab5.1_worker_jenkinsfile_slack_integration
eeganlf Jul 3, 2025
7da2956
feature: update plugin release to modern usage in worker/pom.xml
eeganlf Jul 3, 2025
dc14120
Create lab7_per_stage_jenkinsfile
eeganlf Jul 4, 2025
5272e36
Create lab8_docker_compose_yaml
eeganlf Jul 4, 2025
1123ee3
Rename lab8_docker_compose_yaml to lab8_first_docker_compose_yaml
eeganlf Jul 4, 2025
ff1eacc
Create lab8_DockerComposespecwithBackingServices
eeganlf Jul 4, 2025
a78e9a4
lab-8-docker-compose-yaml remove 5000 and 5001 port mappings to match…
eeganlf Jul 4, 2025
6912ac8
feature: update to python 3.11
eeganlf Jul 4, 2025
2a08959
fix: correct indent db in docker compose file Update docker-compose-s…
eeganlf Jul 4, 2025
eb2e4dd
Merge branch 'dev'
eeganlf Jul 4, 2025
90e53df
fix: Delete vote/Dockerfile as this is created via labs.
eeganlf Jul 4, 2025
62ed7f4
fix: Delete worker/Dockerfile because created in labs
eeganlf Jul 4, 2025
2f59521
fix: Delete result/Dockerfile because created in labs
eeganlf Jul 5, 2025
09d7531
feature: Create result-dockerfile gist
eeganlf Jul 5, 2025
38e9d26
feature: Create vote-dockerfile gist
eeganlf Jul 5, 2025
2d2bed8
feature: Create worker-dockerfile gist
eeganlf Jul 5, 2025
745a6a6
feature: Create Continuous-Deploy-Stage-Jenkinsfile gist
eeganlf Jul 5, 2025
f2f90ac
Create LFS261ArgoDeployJenkinsfile
eeganlf Jul 7, 2025
00f1057
Create vote-ui-deployment.yaml
eeganlf Jul 7, 2025
a04394f
Create vote-ui-svc.yaml
eeganlf Jul 7, 2025
1853e0a
feature: create lab9-sonarqube-stage-snippet
eeganlf Jul 8, 2025
0246ace
Add Jenkinsfile
Aug 14, 2025
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
28 changes: 28 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline {
agent any

stages{
stage("one"){
steps{
echo 'step 1'
}
}
stage("two"){
steps{
echo 'step 2'
}
}
stage("three"){
steps{
echo 'step 3'
}
}
}
post{

always{

echo 'This pipeline is completed.'
}
}
}
12 changes: 12 additions & 0 deletions gists/Continuous-Deploy-Stage-Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
stage('Trigger deployment') {
agent any
environment{
def GIT_COMMIT = "${env.GIT_COMMIT}"
}
steps{
echo "${GIT_COMMIT}"
echo "triggering deployment"
// passing variables to job deployment run by vote-deploy repository Jenkinsfile
build job: 'deployment', parameters: [string(name: 'DOCKERTAG', value: GIT_COMMIT)]
}
}
26 changes: 26 additions & 0 deletions gists/LFS261ArgoDeployJenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
node {
def app

stage('Clone repository') {


checkout scm
}

stage('Update GIT') {
script {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
withCredentials([usernamePassword(credentialsId: 'JenkinsGithubCreds', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh "git config user.email [email protected]"
sh "git config user.name yourGitHubUsername"
sh "cat vote-ui-deployment.yaml"
sh "sed -i 's+dockerHubUserName/vote.*+dockerHubUsername/vote:${DOCKERTAG}+g' vote-ui-deployment.yaml"
sh "cat vote-ui-deployment.yaml"
sh "git add ."
sh "git commit -m 'Done by Jenkins Job deployment: ${env.BUILD_NUMBER}'"
sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${GIT_USERNAME}/vote-deploy.git HEAD:master"
}
}
}
}
}
3 changes: 1 addition & 2 deletions gists/lab-8-docker-compose-yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ services:
image: docker:dind
ports:
- 2376:2376
- 5000:5000
- 5001:5001

environment:
- DOCKER_TLS_CERTDIR=/certs
networks:
Expand Down
52 changes: 52 additions & 0 deletions gists/lab5.1_worker_jenkinsfile_slack_integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pipeline {
agent any
tools{
maven 'maven 3.9.8'
}
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'
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true }
}
}
}
post{
always{
echo 'Building multibranch pipeline for worker is completed..'
}
failure{
slackSend (channel: "instavote-cd", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)") }
success{
slackSend (channel: "instavote-cd", message: "Build Succeeded - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
}
}
}
89 changes: 89 additions & 0 deletions gists/lab7_per_stage_jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
pipeline {

agent none

stages{
stage("build"){
when{
changeset "**/worker/**"
}

agent{
docker{
image 'maven:3.9.8-sapmachine-21'
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.9.8-sapmachine-21'
args '-v $HOME/.m2:/root/.m2'
}
}
steps{
echo 'Running Unit Tets on worker app..'
dir('worker'){
sh 'mvn clean test'
}

}
}
stage("package"){
when{
branch 'master'
changeset "**/worker/**"
}
agent{
docker{
image 'maven:3.9.8-sapmachine-21'
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("xxxxx/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..'
}
}
}
19 changes: 19 additions & 0 deletions gists/lab8_DockerComposespecwithBackingServices
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
vote:
image: xxxxx/vote:latest
ports:
- 5000:80

redis:
image: redis:alpine

db:
image: postgres:9.4

result:
image: xxxxx/result:latest
ports:
- 5001:4000

worker:
image: xxxxx/worker:latest
13 changes: 13 additions & 0 deletions gists/lab8_first_docker_compose_yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
vote:
image: xxxxx/vote:latest
ports:
- 5000:80

result:
image: xxxxx/result:latest
ports:
- 5001:80

worker:
image: xxxxx/worker:latest
31 changes: 31 additions & 0 deletions gists/lab9-sonarqube-stage-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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
}
}
}
2 changes: 1 addition & 1 deletion result/Dockerfile → gists/result-dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-slim
FROM node:22.4.0-slim

# add curl for healthcheck
RUN apt-get update && \
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions gists/vote-ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: vote-ui
spec:
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app: vote-ui
template:
metadata:
labels:
app: vote-ui
spec:
containers:
- image: docker.io/xxxx/vote
name: vote-ui
ports:
- containerPort: 80
13 changes: 13 additions & 0 deletions gists/vote-ui-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: vote-ui
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: vote-ui
6 changes: 6 additions & 0 deletions gists/worker-dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM maven:3.9.8-sapmachine-21
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"]
7 changes: 0 additions & 7 deletions worker/Dockerfile

This file was deleted.