From 8ef6028c517a781e008dd7239e6885e1237c1858 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sat, 4 Oct 2025 21:36:19 +0530 Subject: [PATCH 01/28] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3ed8ab2b..9c8d93da 100644 --- a/pom.xml +++ b/pom.xml @@ -102,11 +102,11 @@ maven-releases - http://13.235.245.200:8081/repository/maven-releases/ + http://54.90.105.78:8081/repository/maven-releases/ maven-snapshots - http://13.235.245.200:8081/repository/maven-snapshots/ + http://54.90.105.78:8081/repository/maven-snapshots/ From 8c299b111e1d6e749da4eef1937fafa528cd0919 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sat, 4 Oct 2025 22:54:16 +0530 Subject: [PATCH 02/28] Create manjujenkins --- manjujenkins | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 manjujenkins diff --git a/manjujenkins b/manjujenkins new file mode 100644 index 00000000..b0721a99 --- /dev/null +++ b/manjujenkins @@ -0,0 +1,73 @@ +pipeline { + agent any + + tools { + maven 'maven3' + jdk 'jdk17' + } + + environment { + SCANNER_HOME= tool 'sonar-scanner' + } + stages { + stage('Git checkout') { + steps { + git branch:'main', url:'https://github.com/goudmanju/FullStack-Blogging-App.git' + } + } + stage('complie') { + steps { + sh "mvn compile" + } + } + stage('Publish Artifacts') { + steps { + withMaven(globalMavenSettingsConfig: 'maven-settings', jdk: 'jdk17', maven: 'maven3', traceability: true) { + sh "mvn deploy" + } + } + } + stage('Test') { + steps { + sh "mvn test" + } + } + stage('Trivy') { + steps { + sh "trivy fs --format table -o fs.html ." + } + } + stage('Sonaranalysis') { + steps { + withSonarQubeEnv('sonar-server') { + sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=production-no1 -Dsonar.projectKey=production-no1 \ + -Dsonar.java.binaries=target ''' + } + } + } + stage('Docker build & tag') { + steps { + script { + withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { + sh 'docker build -t manjugoud/productionno-1 .' + } + } + } + } + stage('Trivy image scan') { + steps { + sh "trivy image --format table -o image.html manjugoud/productionno-1 " + } + } + stage('Docker push') { + steps { + script { + // This step should not normally be used in your script. Consult the inline help for details. + withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { + sh 'docker push manjugoud/productionno-1' + } + } + } + } + } + } From 4b086c931a9171315ef311995efb4a306f477c45 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:15:42 +0530 Subject: [PATCH 03/28] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9c8d93da..147faa7b 100644 --- a/pom.xml +++ b/pom.xml @@ -102,11 +102,11 @@ maven-releases - http://54.90.105.78:8081/repository/maven-releases/ + http://50.16.94.200:8081/repository/maven-releases/ maven-snapshots - http://54.90.105.78:8081/repository/maven-snapshots/ + http://50.16.94.200:8081/repository/maven-snapshots/ From 349c8a6d5644c6bd1b81c0af9adeeb9d65cdead5 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:49:45 +0530 Subject: [PATCH 04/28] Update main.tf --- EKS_Terraform/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EKS_Terraform/main.tf b/EKS_Terraform/main.tf index cf18a035..593f96c4 100644 --- a/EKS_Terraform/main.tf +++ b/EKS_Terraform/main.tf @@ -1,5 +1,5 @@ provider "aws" { - region = "ap-south-1" + region = "us-east-1" } resource "aws_vpc" "devopsshack_vpc" { From 58cd24b2c9f5f97f8d9326030f8f9132eeeccdcd Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:50:11 +0530 Subject: [PATCH 05/28] Update variables.tf --- EKS_Terraform/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EKS_Terraform/variables.tf b/EKS_Terraform/variables.tf index dc712258..1fa3c8dd 100644 --- a/EKS_Terraform/variables.tf +++ b/EKS_Terraform/variables.tf @@ -1,5 +1,5 @@ variable "ssh_key_name" { description = "The name of the SSH key pair to use for instances" type = string - default = "DevOps" + default = "terraform" } From ca71fb6ec85898b15b0b08985c6088b1af0a4c5e Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 16:39:40 +0530 Subject: [PATCH 06/28] Update deployment-service.yml --- deployment-service.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment-service.yml b/deployment-service.yml index 31aec78b..f8ec2130 100644 --- a/deployment-service.yml +++ b/deployment-service.yml @@ -14,12 +14,12 @@ spec: spec: containers: - name: bloggingapp - image: adijaiswal/bloggingapp:latest # Updated image to private DockerHub image + image: manjugoud/productionno-1 # Updated image to private DockerHub image imagePullPolicy: Always ports: - containerPort: 8080 - imagePullSecrets: - - name: regcred # Reference to the Docker registry secret + # imagePullSecrets: + # - name: regcred # Reference to the Docker registry secret --- apiVersion: v1 kind: Service From 6be2066dced208c7aa7ae15ce56e3b6b18628e43 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 17:01:58 +0530 Subject: [PATCH 07/28] Update deployment-service.yml --- deployment-service.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deployment-service.yml b/deployment-service.yml index f8ec2130..8abe3daf 100644 --- a/deployment-service.yml +++ b/deployment-service.yml @@ -1,19 +1,19 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: bloggingapp-deployment + name: productionno-1-deployment spec: selector: matchLabels: - app: bloggingapp + app: productionno-1 replicas: 2 template: metadata: labels: - app: bloggingapp + app: productionno-1 spec: containers: - - name: bloggingapp + - name: productionno-1 image: manjugoud/productionno-1 # Updated image to private DockerHub image imagePullPolicy: Always ports: @@ -24,10 +24,10 @@ spec: apiVersion: v1 kind: Service metadata: - name: bloggingapp-ssvc + name: productionno-1-ssvc spec: selector: - app: bloggingapp + app: productionno-1 ports: - protocol: "TCP" port: 80 From aa22f914f7040c2546c05de894942fdde0978f88 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 17:13:56 +0530 Subject: [PATCH 08/28] Update deployment-service.yml --- deployment-service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment-service.yml b/deployment-service.yml index 8abe3daf..7b2b1cd2 100644 --- a/deployment-service.yml +++ b/deployment-service.yml @@ -14,7 +14,7 @@ spec: spec: containers: - name: productionno-1 - image: manjugoud/productionno-1 # Updated image to private DockerHub image + image: manjugoud/productionno-1:latest # Updated image to private DockerHub image imagePullPolicy: Always ports: - containerPort: 8080 From 8c589411e78aecc4ba08283a7590404b227f84ca Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:34:13 +0530 Subject: [PATCH 09/28] Create role.yml --- role.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 role.yml diff --git a/role.yml b/role.yml new file mode 100644 index 00000000..97d9f99e --- /dev/null +++ b/role.yml @@ -0,0 +1,38 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: app-role + namespace: webapps +rules: + - apiGroups: + - "" + - apps + - autoscaling + - batch + - extensions + - policy + - rbac.authorization.k8s.io + resources: + - pods + - secrets + - componentstatuses + - configmaps + - daemonsets + - deployments + - events + - endpoints + - horizontalpodautoscalers + - ingress + - jobs + - limitranges + - namespaces + - nodes + - pods + - persistentvolumes + - persistentvolumeclaims + - resourcequotas + - replicasets + - replicationcontrollers + - serviceaccounts + - services + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] From 4cd96196e11239547819b87b0b2a36e564fa0c87 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:34:39 +0530 Subject: [PATCH 10/28] Create ServiceAccount.yml --- ServiceAccount.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ServiceAccount.yml diff --git a/ServiceAccount.yml b/ServiceAccount.yml new file mode 100644 index 00000000..621b3dbc --- /dev/null +++ b/ServiceAccount.yml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: jenkins + namespace: webapps From 517fca37c9748a72a34f4b3be22292371bcfbf78 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:35:06 +0530 Subject: [PATCH 11/28] Create Bind role-to-service --- Bind role-to-service | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Bind role-to-service diff --git a/Bind role-to-service b/Bind role-to-service new file mode 100644 index 00000000..ecb688f7 --- /dev/null +++ b/Bind role-to-service @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: app-rolebinding + namespace: webapps +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: app-role +subjects: +- namespace: webapps + kind: ServiceAccount + name: jenkins From ce1a360b53ff2aa39c4cec394a098add4872822f Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:37:21 +0530 Subject: [PATCH 12/28] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..7ed70d31 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +kubectl get secrets -n webapps +kubectl describe mysecretname -n webapps +u will get the token copy the token and paste in jenkins credentials From 11f51e8e78fcb9d612675438cc129d33a394defe Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:37:49 +0530 Subject: [PATCH 13/28] Update manjujenkins --- manjujenkins | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/manjujenkins b/manjujenkins index b0721a99..be4d655f 100644 --- a/manjujenkins +++ b/manjujenkins @@ -39,7 +39,7 @@ pipeline { } stage('Sonaranalysis') { steps { - withSonarQubeEnv('sonar-server') { + withSonarQubeEnv('sonar-scanner') { sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=production-no1 -Dsonar.projectKey=production-no1 \ -Dsonar.java.binaries=target ''' } @@ -49,7 +49,7 @@ pipeline { steps { script { withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { - sh 'docker build -t manjugoud/productionno-1 .' + sh 'docker build -t manjugoud/productionno-1:latest .' } } } @@ -64,10 +64,26 @@ pipeline { script { // This step should not normally be used in your script. Consult the inline help for details. withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { - sh 'docker push manjugoud/productionno-1' + sh 'docker push manjugoud/productionno-1:latest' } } } } + stage('K8-deploy') { + steps { + withKubeConfig(caCertificate: '', clusterName: 'devopsshack-cluster', contextName: '', credentialsId: 'k8-cred', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://47A67B79682CCDDF89EC6F73ED0143B2.gr7.us-east-1.eks.amazonaws.com') { + sh 'kubectl apply -f deployment-service.yml' + sleep 20 + } + } + } + stage('verify-deployment') { + steps { + withKubeConfig(caCertificate: '', clusterName: 'devopsshack-cluster', contextName: '', credentialsId: 'k8-cred', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://47A67B79682CCDDF89EC6F73ED0143B2.gr7.us-east-1.eks.amazonaws.com') { + sh 'kubectl get pods' + sh 'kubectl get svc' + } + } + } } } From 3d501da0534306009c636b8c470f134ef3834379 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:53:12 +0530 Subject: [PATCH 14/28] Update README.md --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ed70d31..5603f38e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,52 @@ -kubectl get secrets -n webapps -kubectl describe mysecretname -n webapps +**Jenkins and EKS Deployment with Terraform and Docker Setup** +**Overview** +This documentation outlines the steps to set up Jenkins and EKS clusters for deploying applications, using Docker, Terraform, and Kubernetes tools. The setup consists of launching Jenkins servers, configuring Docker and SonarQube, and deploying applications on an EKS cluster. +****Step-by-Step Process** +**1. Jenkins Server Setup**** +• Initially, launch 2 Jenkins servers (medium instances) for service queues. +• Additionally, launch one large Jenkins server instance. +• Install Java 17 JDK on Jenkins servers. +• Install Jenkins. +• Install Docker inside Jenkins servers. +**2. Docker Socket Permissions** +**Set permissions for Docker socket using:** +chmod 666 /var/run/docker.sock +**Install SonarQube on both Jenkins servers.** +**Run SonarQube containers using Docker:** +docker run -d -p 9000:9000 sonarqube:lts-community +docker run -d -p 8081:8081 sonatype/nexus3 +**To get the admin password for Nexus:** +docker exec -it /bin/bash +cat /nexus/admin.password +**Jenkins Plugins Installation** +**• Install Tivm (presumably a plugin) in Jenkins servers.** +**5. SonarQube Token Creation** +• Create tokens for SonarQube and Nexus artifact repositories. +• Configure Docker Hub credentials in Jenkins tools section and system configuration. +**6. Plugins and Configurations** +• Update configuration files to allow plugin downloads and configurations. +**7. EKS Cluster Deployment** +• Deploy applications using AWS EKS cluster. +• Setup EKS with Terraform scripts. +**8. Secondary Server Setup** +Launch an additional server. +Install Terraform. +Launch EKS cluster. +Install kubectl. +**Update Kubernetes config with:** +aws eks --region us-east-1 update-kubeconfig --name +**Note:(It is used for authentication purpose)** +**Verify nodes with:** +kubectl get nodes +**Create Kubernetes resources:** +• Namespace +• ServiceAccount +• Role +• RoleBinding +• ⁠Create tokens for these resources. +**Final steps** +**Get secrets for namespace webapps:** +**kubectl get secrets -n webapps** +**kubectl describe secret -n webapps** +**Use these secrets/tokens for authentication and deployment.** u will get the token copy the token and paste in jenkins credentials From c4ceac7f01bc8f1c879379e9680f76e74822008c Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:54:17 +0530 Subject: [PATCH 15/28] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 5603f38e..84dc7b45 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,59 @@ **Jenkins and EKS Deployment with Terraform and Docker Setup** + **Overview** This documentation outlines the steps to set up Jenkins and EKS clusters for deploying applications, using Docker, Terraform, and Kubernetes tools. The setup consists of launching Jenkins servers, configuring Docker and SonarQube, and deploying applications on an EKS cluster. + ****Step-by-Step Process** + **1. Jenkins Server Setup**** • Initially, launch 2 Jenkins servers (medium instances) for service queues. • Additionally, launch one large Jenkins server instance. • Install Java 17 JDK on Jenkins servers. • Install Jenkins. • Install Docker inside Jenkins servers. + **2. Docker Socket Permissions** + **Set permissions for Docker socket using:** chmod 666 /var/run/docker.sock **Install SonarQube on both Jenkins servers.** + **Run SonarQube containers using Docker:** docker run -d -p 9000:9000 sonarqube:lts-community docker run -d -p 8081:8081 sonatype/nexus3 + **To get the admin password for Nexus:** docker exec -it /bin/bash cat /nexus/admin.password + **Jenkins Plugins Installation** **• Install Tivm (presumably a plugin) in Jenkins servers.** + **5. SonarQube Token Creation** • Create tokens for SonarQube and Nexus artifact repositories. • Configure Docker Hub credentials in Jenkins tools section and system configuration. + **6. Plugins and Configurations** • Update configuration files to allow plugin downloads and configurations. + **7. EKS Cluster Deployment** • Deploy applications using AWS EKS cluster. • Setup EKS with Terraform scripts. + **8. Secondary Server Setup** Launch an additional server. Install Terraform. Launch EKS cluster. Install kubectl. + **Update Kubernetes config with:** aws eks --region us-east-1 update-kubeconfig --name + **Note:(It is used for authentication purpose)** + **Verify nodes with:** kubectl get nodes + **Create Kubernetes resources:** • Namespace • ServiceAccount From 7aecb40b00f91e5ead574b73dfe91bc1fa2638ff Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:54:52 +0530 Subject: [PATCH 16/28] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 84dc7b45..5cad57f7 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,15 @@ kubectl get nodes • Role • RoleBinding • ⁠Create tokens for these resources. + **Final steps** + **Get secrets for namespace webapps:** + **kubectl get secrets -n webapps** + **kubectl describe secret -n webapps** + **Use these secrets/tokens for authentication and deployment.** + u will get the token copy the token and paste in jenkins credentials From 35151ffa8dacf8e87534b1be6513e18b0775a598 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:57:06 +0530 Subject: [PATCH 17/28] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 5cad57f7..3c1d77cb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ **Jenkins and EKS Deployment with Terraform and Docker Setup** +image +image +image +image +image **Overview** This documentation outlines the steps to set up Jenkins and EKS clusters for deploying applications, using Docker, Terraform, and Kubernetes tools. The setup consists of launching Jenkins servers, configuring Docker and SonarQube, and deploying applications on an EKS cluster. From 47b6faaf3cbe7d9f68100f8a7d2270e0a8de53e0 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:58:22 +0530 Subject: [PATCH 18/28] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c1d77cb..23c0d679 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ **Jenkins and EKS Deployment with Terraform and Docker Setup** -image +image image -image -image -image +image +image +image **Overview** This documentation outlines the steps to set up Jenkins and EKS clusters for deploying applications, using Docker, Terraform, and Kubernetes tools. The setup consists of launching Jenkins servers, configuring Docker and SonarQube, and deploying applications on an EKS cluster. From 316ec38e28478881a20bbcc7b5d6ee0be8057b1c Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 18:59:54 +0530 Subject: [PATCH 19/28] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 23c0d679..3dbe723c 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,7 @@ kubectl get nodes **Use these secrets/tokens for authentication and deployment.** u will get the token copy the token and paste in jenkins credentials + +here is the deployment application for this pipeline + +image From f65441d4d2b83cbdcc1623a5837d85d489012f68 Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Sun, 5 Oct 2025 19:01:57 +0530 Subject: [PATCH 20/28] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3dbe723c..550de444 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,9 @@ cat /nexus/admin.password • Deploy applications using AWS EKS cluster. • Setup EKS with Terraform scripts. +image + + **8. Secondary Server Setup** Launch an additional server. Install Terraform. From 71fe90b48108e7f24871134493a4e222a04a706e Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Tue, 28 Oct 2025 15:50:06 +0530 Subject: [PATCH 21/28] Update pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 147faa7b..a68b525c 100644 --- a/pom.xml +++ b/pom.xml @@ -100,13 +100,13 @@ - + maven-snapshots - http://50.16.94.200:8081/repository/maven-snapshots/ + http://54.91.144.207:8081/repository/manju-snapshots/ From 9289fb6bbef06244652430d3d455e62e4110376f Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:09:59 +0530 Subject: [PATCH 22/28] Update pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a68b525c..fb405b3c 100644 --- a/pom.xml +++ b/pom.xml @@ -100,10 +100,10 @@ - + http://54.91.144.207:8081/repository/maven-releases/ + maven-snapshots http://54.91.144.207:8081/repository/manju-snapshots/ From ab55ae5e90e8fc28a5d7b567f5c69929b4866a1b Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:15:03 +0530 Subject: [PATCH 23/28] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fb405b3c..cf408f64 100644 --- a/pom.xml +++ b/pom.xml @@ -105,8 +105,8 @@ http://54.91.144.207:8081/repository/maven-releases/ - maven-snapshots - http://54.91.144.207:8081/repository/manju-snapshots/ + manju-snapshots + http://54.91.144.207:8081/repository/manju-snapshots// From 5c27dda7132d829c5b50fcd7cd2c309b7248211d Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:50:56 +0530 Subject: [PATCH 24/28] Update repository URLs in pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index cf408f64..710b8f37 100644 --- a/pom.xml +++ b/pom.xml @@ -102,11 +102,11 @@ maven-releases - http://54.91.144.207:8081/repository/maven-releases/ + http://98.93.21.183:8081/repository/maven-releases/ - manju-snapshots - http://54.91.144.207:8081/repository/manju-snapshots// + maven-snapshots + http://98.93.21.183:8081/repository/maven-snapshots/ From fef83ddd11f0525e31ac97b1f54ba077f289ca9f Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:17:59 +0530 Subject: [PATCH 25/28] Update repository URLs in pom.xml --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 710b8f37..44f431b1 100644 --- a/pom.xml +++ b/pom.xml @@ -102,11 +102,11 @@ maven-releases - http://98.93.21.183:8081/repository/maven-releases/ + http://34.224.23.97:8081/repository/maven-releases/url> - maven-snapshots - http://98.93.21.183:8081/repository/maven-snapshots/ + manju-snapshots + http://34.224.23.97:8081/repository/manju-snapshots/ From 70f9df40643937743cbc5852704eebd04250fdcf Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:58:15 +0530 Subject: [PATCH 26/28] Update pom.xml --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 44f431b1..38617526 100644 --- a/pom.xml +++ b/pom.xml @@ -102,8 +102,9 @@ maven-releases - http://34.224.23.97:8081/repository/maven-releases/url> + http://34.224.23.97:8081/repository/maven-releases/ + manju-snapshots http://34.224.23.97:8081/repository/manju-snapshots/ From b02d78c576f1acd253521f389612ddeaf6e49eaa Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:25:28 +0530 Subject: [PATCH 27/28] Update pom.xml From 8a1f5986ff3f36f2e470641544f8f22c80708c4b Mon Sep 17 00:00:00 2001 From: goudmanju <83080460+goudmanju@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:41:39 +0530 Subject: [PATCH 28/28] Update manjujenkins --- manjujenkins | 106 +++++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 66 deletions(-) diff --git a/manjujenkins b/manjujenkins index be4d655f..0b67786b 100644 --- a/manjujenkins +++ b/manjujenkins @@ -1,89 +1,63 @@ -pipeline { +pipeline { agent any - - tools { - maven 'maven3' - jdk 'jdk17' - } - + environment { - SCANNER_HOME= tool 'sonar-scanner' + DEPLOY_REPO = "https://github.com/goudmanju/Hiring-app-argocd.git" + IMAGE_NAME = "manjugoud/productionno-1" + } + + parameters { + string(name: 'IMAGE_TAG', defaultValue: '', description: 'Docker image tag to deploy') } + stages { - stage('Git checkout') { - steps { - git branch:'main', url:'https://github.com/goudmanju/FullStack-Blogging-App.git' - } - } - stage('complie') { - steps { - sh "mvn compile" - } - } - stage('Publish Artifacts') { + stage('Validate Parameters') { steps { - withMaven(globalMavenSettingsConfig: 'maven-settings', jdk: 'jdk17', maven: 'maven3', traceability: true) { - sh "mvn deploy" + script { + if (!params.IMAGE_TAG?.trim()) { + error("IMAGE_TAG parameter is required! Please pass a valid Docker image tag.") + } } } } - stage('Test') { - steps { - sh "mvn test" - } - } - stage('Trivy') { + + stage('Checkout K8s Manifests') { steps { - sh "trivy fs --format table -o fs.html ." + git branch: 'main', url: "${DEPLOY_REPO}" } } - stage('Sonaranalysis') { - steps { - withSonarQubeEnv('sonar-scanner') { - sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=production-no1 -Dsonar.projectKey=production-no1 \ - -Dsonar.java.binaries=target ''' - } - } - } - stage('Docker build & tag') { + + stage('Update Deployment YAML') { steps { script { - withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { - sh 'docker build -t manjugoud/productionno-1:latest .' - } + echo "Updating image tag in deployment.yaml to ${params.IMAGE_TAG}" + sh """ + sed -i 's|image: ${IMAGE_NAME}:.*|image: ${IMAGE_NAME}:${params.IMAGE_TAG}|g' dev/deployment.yaml + echo "----- Updated Deployment YAML -----" + cat dev/deployment.yaml + """ } } } - stage('Trivy image scan') { - steps { - sh "trivy image --format table -o image.html manjugoud/productionno-1 " - } - } - stage('Docker push') { + + stage('Commit and Push Changes') { steps { - script { - // This step should not normally be used in your script. Consult the inline help for details. - withDockerRegistry(credentialsId: 'docker', toolName: 'docker') { - sh 'docker push manjugoud/productionno-1:latest' - } + withCredentials([usernamePassword(credentialsId: 'github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { + sh """ + git config user.name "jenkins" + git config user.email "jenkins@ci.local" + git add . + git commit -m "Updated deployment.yaml with new image tag ${params.IMAGE_TAG}" + git push https://${GIT_USERNAME}:${GIT_PASSWORD}@git@github.com:goudmanju/Hiring-app-argocd.git main + """ } } - } - stage('K8-deploy') { - steps { - withKubeConfig(caCertificate: '', clusterName: 'devopsshack-cluster', contextName: '', credentialsId: 'k8-cred', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://47A67B79682CCDDF89EC6F73ED0143B2.gr7.us-east-1.eks.amazonaws.com') { - sh 'kubectl apply -f deployment-service.yml' - sleep 20 - } - } } - stage('verify-deployment') { - steps { - withKubeConfig(caCertificate: '', clusterName: 'devopsshack-cluster', contextName: '', credentialsId: 'k8-cred', namespace: 'webapps', restrictKubeConfigAccess: false, serverUrl: 'https://47A67B79682CCDDF89EC6F73ED0143B2.gr7.us-east-1.eks.amazonaws.com') { - sh 'kubectl get pods' - sh 'kubectl get svc' - } + + stage('Trigger ArgoCD Sync (Optional)') { + steps { + echo "✅ ArgoCD will automatically detect the Git change and sync the deployment." } } - } } +}