Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6d74e9f
first update
haleem00 Jul 16, 2024
8a764a4
first update2
haleem00 Jul 16, 2024
67eab6e
first update3
haleem00 Jul 16, 2024
21def80
add maven build
haleem00 Jul 16, 2024
5789066
git
haleem00 Jul 16, 2024
43f6c9a
sonar
haleem00 Jul 16, 2024
5e1c92b
sonar1
haleem00 Jul 16, 2024
f530f7b
sonar2
haleem00 Jul 16, 2024
796158e
sonar3
haleem00 Jul 17, 2024
1f82678
sonar4
haleem00 Jul 17, 2024
69ecad9
add script to sonar
haleem00 Jul 17, 2024
6da365b
add script to sonar1
haleem00 Jul 17, 2024
b2aeb6e
add script to sonar2
haleem00 Jul 17, 2024
5ff68da
add script to sonar3
haleem00 Jul 17, 2024
a24f945
sonar fix
haleem00 Jul 17, 2024
208b4f8
sonar fix1
haleem00 Jul 17, 2024
26686eb
sonar fix2
haleem00 Jul 17, 2024
994f011
sonar QualityGate
haleem00 Jul 17, 2024
c24f25e
sonar QualityGate1
haleem00 Jul 17, 2024
e5db046
docker
haleem00 Jul 17, 2024
76ab443
docker1
haleem00 Jul 17, 2024
d6f5192
docker2
haleem00 Jul 17, 2024
a0b3ac9
docker2
haleem00 Jul 17, 2024
97fa130
docker3
haleem00 Jul 17, 2024
ae1abdf
docker4
haleem00 Jul 17, 2024
d5ceded
docker5
haleem00 Jul 17, 2024
793e78b
docker6
haleem00 Jul 17, 2024
91b0bd4
docker7
haleem00 Jul 17, 2024
c0353bc
docker8
haleem00 Jul 17, 2024
3559c56
docker9
haleem00 Jul 17, 2024
570976f
docker10
haleem00 Jul 17, 2024
59f78fb
docker13
haleem00 Jul 17, 2024
4c43e66
docker14
haleem00 Jul 17, 2024
b6df947
last
haleem00 Jul 17, 2024
fd9965c
sonartoken
haleem00 Jul 18, 2024
999f86e
tools updated
haleem00 Jul 18, 2024
c105a81
tools updated1
haleem00 Jul 18, 2024
547ceb6
branch cd-project 1
haleem00 Jul 19, 2024
02757fa
creating helm
Jul 19, 2024
2ac81cc
branch cd-project 1
haleem00 Jul 19, 2024
d9b2da9
Merge remote-tracking branch 'origin/cd-project' into cd-project
haleem00 Jul 19, 2024
4d6bb8d
branch cd-project 1
haleem00 Jul 19, 2024
339550e
update deploy
haleem00 Jul 19, 2024
977419a
update jenkinsfile to be triggered form the other pipeline
haleem00 Jul 20, 2024
d7f5913
add the environment image
haleem00 Jul 20, 2024
8e9862f
add image
haleem00 Jul 21, 2024
a69b1b8
add image1
haleem00 Jul 21, 2024
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.9.0-eclipse-temurin-17 as build
FROM maven:3.9.0-eclipse-temurin-17 AS build
WORKDIR /app
COPY . .
RUN mvn clean install
Expand All @@ -7,4 +7,4 @@ FROM eclipse-temurin:17.0.6_10-jdk
WORKDIR /app
COPY --from=build /app/target/demoapp.jar /app/
EXPOSE 8080
CMD ["java", "-jar","demoapp.jar"]
CMD ["java", "-jar", "demoapp.jar"]
126 changes: 18 additions & 108 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,126 +1,36 @@
pipeline{
agent{
label "jenkins-agent"
}
pipeline {
agent any
tools {
jdk 'Java17'
maven 'Maven3'
jdk "OracleJDK17"
maven "MAVEN3"
}
environment {
APP_NAME = "complete-prodcution-e2e-pipeline"
RELEASE = "1.0.0"
DOCKER_USER = "dmancloud"
DOCKER_PASS = 'dockerhub'
IMAGE_NAME = "${DOCKER_USER}" + "/" + "${APP_NAME}"
IMAGE_TAG = "${RELEASE}-${BUILD_NUMBER}"
JENKINS_API_TOKEN = credentials("JENKINS_API_TOKEN")

}
stages{
stage("Cleanup Workspace"){
steps {
cleanWs()
}
environment {
DOCKERIMAGE = "haleemo/complete-prodcution-e2e-pipeline"

}

stage("Checkout from SCM"){
steps {
git branch: 'main', credentialsId: 'github', url: 'https://github.com/dmancloud/complete-prodcution-e2e-pipeline'
}

}

stage("Build Application"){
steps {
sh "mvn clean package"
}

}

stage("Test Application"){
steps {
sh "mvn test"
}

}

stage("Sonarqube Analysis") {
steps {
script {
withSonarQubeEnv(credentialsId: 'jenkins-sonarqube-token') {
sh "mvn sonar:sonar"
}
}
}

}

stage("Quality Gate") {
stages {
stage("Cleanup Workspace") {
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'jenkins-sonarqube-token'
}
}

}

stage("Build & Push Docker Image") {
steps {
script {
docker.withRegistry('',DOCKER_PASS) {
docker_image = docker.build "${IMAGE_NAME}"
}

docker.withRegistry('',DOCKER_PASS) {
docker_image.push("${IMAGE_TAG}")
docker_image.push('latest')
}
}
}

}

stage("Trivy Scan") {
steps {
script {
sh ('docker run -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy image dmancloud/complete-prodcution-e2e-pipeline:1.0.0-22 --no-progress --scanners vuln --exit-code 0 --severity HIGH,CRITICAL --format table')
}
cleanWs()
}

}

stage ('Cleanup Artifacts') {
stage("Checkout from SCM") {
steps {
script {
sh "docker rmi ${IMAGE_NAME}:${IMAGE_TAG}"
sh "docker rmi ${IMAGE_NAME}:latest"
}
git branch: 'main', credentialsId: '', url: 'https://github.com/haleem00/complete-prodcution-e2e-pipeline.git'
}
}


stage("Trigger CD Pipeline") {
steps {
script {
sh "curl -v -k --user admin:${JENKINS_API_TOKEN} -X POST -H 'cache-control: no-cache' -H 'content-type: application/x-www-form-urlencoded' --data 'IMAGE_TAG=${IMAGE_TAG}' 'https://jenkins.dev.dman.cloud/job/gitops-complete-pipeline/buildWithParameters?token=gitops-token'"
stage('Kubernetes deploy') {
agent {label 'KOPS'}
steps {
sh "helm upgrade --install --force productchart helm/productchart \
--set image=${DOCKERIMAGE}:latest \
--namespace prod"
}
}
}

}

}

post {
failure {
emailext body: '''${SCRIPT, template="groovy-html.template"}''',
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - Failed",
mimeType: 'text/html',to: "dmistry@yourhostdirect.com"
}
success {
emailext body: '''${SCRIPT, template="groovy-html.template"}''',
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - Successful",
mimeType: 'text/html',to: "dmistry@yourhostdirect.com"
}
}
}
46 changes: 0 additions & 46 deletions Jenkinsfile-k8s

This file was deleted.

126 changes: 0 additions & 126 deletions Jenkinsfile.tpl

This file was deleted.

27 changes: 27 additions & 0 deletions deployapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: production
app.kubernetes.io/instance: gitops-app
name: production
namespace: prod
spec:
replicas: 2
selector:
matchLabels:
app: production
template:
metadata:
labels:
app: production
name: production
spec:
containers:
- image: 'haleemo/complete-prodcution-e2e-pipeline:latest'
imagePullPolicy: Always
name: production
ports:
- containerPort: 8080
name: appport
protocol: TCP
Loading