From b9c2b872a4ed5fb09cf460f6bf809949142c89a1 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:03:21 +0530 Subject: [PATCH 01/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index cc3f20c8..e5be0a66 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -15,14 +15,14 @@ pipeline{ } stage('Checkout from Git'){ steps{ - git branch: 'main', url: 'https://github.com/AWS-AZURE-Bootcamp5/Devsecops-Project1.git' + git branch: 'main', url: 'https://github.com/Bhaluk/Devsecops-Project1.git' } } stage("Sonarqube Analysis "){ steps{ withSonarQubeEnv('sonar-server') { - sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Game \ - -Dsonar.projectKey=Game ''' + sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=project \ + -Dsonar.projectKey=project ''' } } } From 9524773323c63424fd1bb7be172ad11fa1fb480a Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:11:43 +0530 Subject: [PATCH 02/32] Update Jenkinsfile1 --- Jenkinsfile1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index e5be0a66..44e9c75c 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -21,8 +21,8 @@ pipeline{ stage("Sonarqube Analysis "){ steps{ withSonarQubeEnv('sonar-server') { - sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=project \ - -Dsonar.projectKey=project ''' + sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=jenkins \ + -Dsonar.projectKey=jenkins ''' } } } From 3f0cb66ab8e7db7731b8df8a5f4b51feb82eadba Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 10 Jun 2024 09:15:38 +0530 Subject: [PATCH 03/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 44e9c75c..dedc2537 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -52,10 +52,10 @@ stage('OWASP FS SCAN') { stage("Docker Build & Push"){ steps{ script{ - withDockerRegistry(credentialsId: 'docker', toolName: 'docker'){ + withDockerRegistry(credentialsId: 'jenkins-docker', toolName: 'docker'){ sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad praveensingam1994/devsecops_ad:latest " - sh "docker push praveensingam1994/devsecops_ad:latest " + sh "docker tag devsecops_ad bhaluk/devsecops_ad:latest " + sh "docker push bhaluk/devsecops_ad:latest " } } } From 67be658e0ab984e55c8a77ede08e0548f3ead2b8 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 10 Jun 2024 09:19:03 +0530 Subject: [PATCH 04/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index dedc2537..b8629ebf 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -54,7 +54,7 @@ stage("Docker Build & Push"){ script{ withDockerRegistry(credentialsId: 'jenkins-docker', toolName: 'docker'){ sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad bhaluk/devsecops_ad:latest " + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest " sh "docker push bhaluk/devsecops_ad:latest " } } @@ -62,12 +62,12 @@ stage("Docker Build & Push"){ } stage("TRIVY"){ steps{ - sh "trivy image praveensingam1994/devsecops_ad:latest > trivy.txt" + sh "trivy image bhaluk/devsecops_ad:latest > trivy.txt" } } stage('Deploy to container'){ steps{ - sh 'docker run -d --name 2048 -p 3000:3000 praveensingam1994/devsecops_ad:latest' + sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:latest' } } stage('Deploy to kubernets'){ From 481118ec2ef3c8d0d8e1f3467ac7b93ccadf6cb0 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:11:46 +0530 Subject: [PATCH 05/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index b8629ebf..5e6d6dab 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -29,7 +29,7 @@ pipeline{ stage("quality gate"){ steps { script { - waitForQualityGate abortPipeline: false, credentialsId: 'Sonar-token' + waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' } } } From 708e47ba0fe6120dc2a756f647684c23e386ece1 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:27:13 +0530 Subject: [PATCH 06/32] Update Jenkinsfile1 --- Jenkinsfile1 | 72 +++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 5e6d6dab..79688309 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -1,84 +1,86 @@ -pipeline{ +pipeline { agent any - tools{ + tools { jdk 'jdk17' nodejs 'node16' } environment { - SCANNER_HOME=tool 'sonar-scanner' + SCANNER_HOME = tool 'sonar-scanner' } stages { - stage('clean workspace'){ - steps{ + stage('Clean Workspace') { + steps { cleanWs() } } - stage('Checkout from Git'){ - steps{ + stage('Checkout from Git') { + steps { git branch: 'main', url: 'https://github.com/Bhaluk/Devsecops-Project1.git' } } - stage("Sonarqube Analysis "){ - steps{ + stage('SonarQube Analysis') { + steps { withSonarQubeEnv('sonar-server') { - sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=jenkins \ - -Dsonar.projectKey=jenkins ''' + sh '''$SCANNER_HOME/bin/sonar-scanner \ + -Dsonar.projectName=jenkins \ + -Dsonar.projectKey=jenkins''' } } } - stage("quality gate"){ - steps { + stage('Quality Gate') { + steps { script { - waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' + timeout(time: 30, unit: 'MINUTES') { // Adjust timeout as needed + waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' + } } - } + } } stage('Install Dependencies') { steps { sh "npm install" } } -stage('OWASP FS SCAN') { + stage('OWASP Dependency Check') { steps { dependencyCheck additionalArguments: '--scan ./ --disableYarnAudit --disableNodeAudit', odcInstallation: 'DP-Check' dependencyCheckPublisher pattern: '**/dependency-check-report.xml' } } - stage('TRIVY FS SCAN') { + stage('Trivy File System Scan') { steps { sh "trivy fs . > trivyfs.txt" } } -stage("Docker Build & Push"){ - steps{ - script{ - withDockerRegistry(credentialsId: 'jenkins-docker', toolName: 'docker'){ - sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest " - sh "docker push bhaluk/devsecops_ad:latest " + stage('Docker Build & Push') { + steps { + script { + withDockerRegistry(credentialsId: 'jenkins-docker', toolName: 'docker') { + sh "docker build -t devsecops_ad ." + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" + sh "docker push bhaluk/devsecops_ad:latest" } } } } - stage("TRIVY"){ - steps{ - sh "trivy image bhaluk/devsecops_ad:latest > trivy.txt" + stage('Trivy Image Scan') { + steps { + sh "trivy image bhaluk/devsecops_ad:latest > trivy.txt" } } -stage('Deploy to container'){ - steps{ + stage('Deploy to Container') { + steps { sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:latest' } } -stage('Deploy to kubernets'){ - steps{ - script{ + stage('Deploy to Kubernetes') { + steps { + script { withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'k8s', namespace: '', restrictKubeConfigAccess: false, serverUrl: '') { - sh 'kubectl apply -f deployment.yaml' - } + sh 'kubectl apply -f deployment.yaml' + } } } } - } } From deff353541d5b96bcc20dfb31a04a4bba5e16d42 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:41:42 +0530 Subject: [PATCH 07/32] Update Jenkinsfile1 --- Jenkinsfile1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 79688309..a88e07f5 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -7,6 +7,9 @@ pipeline { environment { SCANNER_HOME = tool 'sonar-scanner' } + options { + timestamps() // Enables TimeStamper + } stages { stage('Clean Workspace') { steps { @@ -82,5 +85,14 @@ pipeline { } } } + stage('View Results') { + steps { + echo "Trivy File System Scan Results:" + sh "cat trivyfs.txt" + + echo "Trivy Image Scan Results:" + sh "cat trivy.txt" + } + } } } From 057460f13a9cadb5a13772af919403bd894f4896 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:30:11 +0530 Subject: [PATCH 08/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index a88e07f5..0ae43d86 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -58,7 +58,7 @@ pipeline { stage('Docker Build & Push') { steps { script { - withDockerRegistry(credentialsId: 'jenkins-docker', toolName: 'docker') { + withDockerRegistry(credentialsId: 'jenkins-docker', url: 'https://hub.docker.com/') { sh "docker build -t devsecops_ad ." sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" sh "docker push bhaluk/devsecops_ad:latest" From a077a3d04852329f83a5a765d4f01d8357e5feba Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:35:31 +0530 Subject: [PATCH 09/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 0ae43d86..f1eb225a 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -33,7 +33,7 @@ pipeline { stage('Quality Gate') { steps { script { - timeout(time: 30, unit: 'MINUTES') { // Adjust timeout as needed + timeout(time: 5, unit: 'MINUTES') { // Adjust timeout as needed waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' } } From 09be82dbc341c665e0b818479a570cf2a03f2e83 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:45:20 +0530 Subject: [PATCH 10/32] Update Jenkinsfile1 --- Jenkinsfile1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index f1eb225a..1e5f4f93 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -54,6 +54,17 @@ pipeline { steps { sh "trivy fs . > trivyfs.txt" } + } + stage('Docker Build') { + steps { + script { + { + sh "docker build -t devsecops_ad ." + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" + sh "docker push bhaluk/devsecops_ad:latest" + } + } + } } stage('Docker Build & Push') { steps { From f29a8e31506e10eeaa6f28825dfcef892f89f653 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 20:47:31 +0530 Subject: [PATCH 11/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 1e5f4f93..6f48a57d 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -56,14 +56,10 @@ pipeline { } } stage('Docker Build') { - steps { - script { - { + steps { sh "docker build -t devsecops_ad ." sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" sh "docker push bhaluk/devsecops_ad:latest" - } - } } } stage('Docker Build & Push') { From daa32c862e30ca5dcd8bffc30ed17f07d4a35898 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:10:44 +0530 Subject: [PATCH 12/32] Update Jenkinsfile1 --- Jenkinsfile1 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 6f48a57d..c8f902a5 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -58,17 +58,14 @@ pipeline { stage('Docker Build') { steps { sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" - sh "docker push bhaluk/devsecops_ad:latest" + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest1" } } - stage('Docker Build & Push') { + stage('Docker Push') { steps { script { - withDockerRegistry(credentialsId: 'jenkins-docker', url: 'https://hub.docker.com/') { - sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest" - sh "docker push bhaluk/devsecops_ad:latest" + withDockerRegistry(credentialsId: 'jenkins-docker', url: 'https://docker.io/') { + sh "docker push bhaluk/devsecops_ad:latest1" } } } From 916fb66614a48c954079007d6f1a4f00da968ead Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:23:12 +0530 Subject: [PATCH 13/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index c8f902a5..638c099d 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -64,7 +64,7 @@ pipeline { stage('Docker Push') { steps { script { - withDockerRegistry(credentialsId: 'jenkins-docker', url: 'https://docker.io/') { + docker.withRegistry('https://index.docker.io/v1/', 'jenkins-docker'){ sh "docker push bhaluk/devsecops_ad:latest1" } } From aacddcab03903406a056313439760a9907f8aef0 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:33:04 +0530 Subject: [PATCH 14/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 638c099d..dca5e7fb 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -64,7 +64,7 @@ pipeline { stage('Docker Push') { steps { script { - docker.withRegistry('https://index.docker.io/v1/', 'jenkins-docker'){ + docker.withRegistry('https://index.docker.io/v1/', 'devops-docker'){ sh "docker push bhaluk/devsecops_ad:latest1" } } From 4c967c05735be57f32cfa83d41b474878c7ae062 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:08:37 +0530 Subject: [PATCH 15/32] Update Jenkinsfile1 --- Jenkinsfile1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index dca5e7fb..38473173 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -82,10 +82,7 @@ pipeline { } stage('Deploy to Kubernetes') { steps { - script { - withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'k8s', namespace: '', restrictKubeConfigAccess: false, serverUrl: '') { sh 'kubectl apply -f deployment.yaml' - } } } } From c36ef3387cc490eeb7058f1de1b0f68b933886df Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:11:23 +0530 Subject: [PATCH 16/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 38473173..c272e672 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -82,7 +82,7 @@ pipeline { } stage('Deploy to Kubernetes') { steps { - sh 'kubectl apply -f deployment.yaml' + sh 'kubectl apply -f deployment.yaml' } } } From 569886b57e8a92ce844d7cdf222c02033adfffce Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:13:00 +0530 Subject: [PATCH 17/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index c272e672..c169c6e8 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -58,14 +58,14 @@ pipeline { stage('Docker Build') { steps { sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:latest1" + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1" } } stage('Docker Push') { steps { script { docker.withRegistry('https://index.docker.io/v1/', 'devops-docker'){ - sh "docker push bhaluk/devsecops_ad:latest1" + sh "docker push bhaluk/devsecops_ad:V1.0.1" } } } @@ -77,7 +77,7 @@ pipeline { } stage('Deploy to Container') { steps { - sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:latest' + sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:V1.0.1' } } stage('Deploy to Kubernetes') { From 919b7eaa152ecc93472a9566ac6bd5146ab4b1c0 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:14:45 +0530 Subject: [PATCH 18/32] Update deployment.yaml --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index d27b6591..1047ba11 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -14,7 +14,7 @@ spec: spec: containers: - name: react-app-container - image: sevenajay/2048:latest # Use your actual Docker image name and tag + image: bhaluk/devsecops_ad:V1.0.1 # Use your actual Docker image name and tag ports: - containerPort: 3000 # The port your React app is listening on From ab61685dc8268aef5dc6f6cab7b7955312f576e7 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:16:44 +0530 Subject: [PATCH 19/32] Update Jenkinsfile1 --- Jenkinsfile1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index c169c6e8..4a0c4081 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -85,7 +85,6 @@ pipeline { sh 'kubectl apply -f deployment.yaml' } } - } stage('View Results') { steps { echo "Trivy File System Scan Results:" From 371586d22c927f1155ef8f03fd4c40caee2cb2bf Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:43:17 +0530 Subject: [PATCH 20/32] Update Jenkinsfile1 --- Jenkinsfile1 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 4a0c4081..90b5ef2b 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -8,7 +8,7 @@ pipeline { SCANNER_HOME = tool 'sonar-scanner' } options { - timestamps() // Enables TimeStamper + timestamps() } stages { stage('Clean Workspace') { @@ -33,7 +33,7 @@ pipeline { stage('Quality Gate') { steps { script { - timeout(time: 5, unit: 'MINUTES') { // Adjust timeout as needed + timeout(time: 5, unit: 'MINUTES') { waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' } } @@ -41,7 +41,7 @@ pipeline { } stage('Install Dependencies') { steps { - sh "npm install" + sh 'npm install' } } stage('OWASP Dependency Check') { @@ -52,27 +52,27 @@ pipeline { } stage('Trivy File System Scan') { steps { - sh "trivy fs . > trivyfs.txt" + sh 'trivy fs . > trivyfs.txt' } } - stage('Docker Build') { + stage('Docker Build') { steps { - sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1" + sh 'docker build -t devsecops_ad .' + sh 'docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1' } } stage('Docker Push') { steps { script { - docker.withRegistry('https://index.docker.io/v1/', 'devops-docker'){ - sh "docker push bhaluk/devsecops_ad:V1.0.1" + docker.withRegistry('https://index.docker.io/v1/', 'devops-docker') { + sh 'docker push bhaluk/devsecops_ad:V1.0.1' } } } } stage('Trivy Image Scan') { steps { - sh "trivy image bhaluk/devsecops_ad:latest > trivy.txt" + sh 'trivy image bhaluk/devsecops_ad:latest > trivy.txt' } } stage('Deploy to Container') { @@ -83,15 +83,15 @@ pipeline { stage('Deploy to Kubernetes') { steps { sh 'kubectl apply -f deployment.yaml' - } } + } stage('View Results') { steps { - echo "Trivy File System Scan Results:" - sh "cat trivyfs.txt" + echo 'Trivy File System Scan Results:' + sh 'cat trivyfs.txt' - echo "Trivy Image Scan Results:" - sh "cat trivy.txt" + echo 'Trivy Image Scan Results:' + sh 'cat trivy.txt' } } } From 60ee53ca4adc137f5c58320e0d3728cea0189d75 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:55:12 +0530 Subject: [PATCH 21/32] Update Jenkinsfile1 --- Jenkinsfile1 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 90b5ef2b..4a0c4081 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -8,7 +8,7 @@ pipeline { SCANNER_HOME = tool 'sonar-scanner' } options { - timestamps() + timestamps() // Enables TimeStamper } stages { stage('Clean Workspace') { @@ -33,7 +33,7 @@ pipeline { stage('Quality Gate') { steps { script { - timeout(time: 5, unit: 'MINUTES') { + timeout(time: 5, unit: 'MINUTES') { // Adjust timeout as needed waitForQualityGate abortPipeline: false, credentialsId: 'sonar-token' } } @@ -41,7 +41,7 @@ pipeline { } stage('Install Dependencies') { steps { - sh 'npm install' + sh "npm install" } } stage('OWASP Dependency Check') { @@ -52,27 +52,27 @@ pipeline { } stage('Trivy File System Scan') { steps { - sh 'trivy fs . > trivyfs.txt' + sh "trivy fs . > trivyfs.txt" } } - stage('Docker Build') { + stage('Docker Build') { steps { - sh 'docker build -t devsecops_ad .' - sh 'docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1' + sh "docker build -t devsecops_ad ." + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1" } } stage('Docker Push') { steps { script { - docker.withRegistry('https://index.docker.io/v1/', 'devops-docker') { - sh 'docker push bhaluk/devsecops_ad:V1.0.1' + docker.withRegistry('https://index.docker.io/v1/', 'devops-docker'){ + sh "docker push bhaluk/devsecops_ad:V1.0.1" } } } } stage('Trivy Image Scan') { steps { - sh 'trivy image bhaluk/devsecops_ad:latest > trivy.txt' + sh "trivy image bhaluk/devsecops_ad:latest > trivy.txt" } } stage('Deploy to Container') { @@ -83,15 +83,15 @@ pipeline { stage('Deploy to Kubernetes') { steps { sh 'kubectl apply -f deployment.yaml' + } } - } stage('View Results') { steps { - echo 'Trivy File System Scan Results:' - sh 'cat trivyfs.txt' + echo "Trivy File System Scan Results:" + sh "cat trivyfs.txt" - echo 'Trivy Image Scan Results:' - sh 'cat trivy.txt' + echo "Trivy Image Scan Results:" + sh "cat trivy.txt" } } } From bf88395130e2245f8133b92e08c3e9a2dfbd5186 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Thu, 13 Jun 2024 23:05:37 +0530 Subject: [PATCH 22/32] Update Jenkinsfile1 --- Jenkinsfile1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 4a0c4081..30047b3c 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -58,14 +58,14 @@ pipeline { stage('Docker Build') { steps { sh "docker build -t devsecops_ad ." - sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.1" + sh "docker tag devsecops_ad:latest bhaluk/devsecops_ad:V1.0.2" } } stage('Docker Push') { steps { script { docker.withRegistry('https://index.docker.io/v1/', 'devops-docker'){ - sh "docker push bhaluk/devsecops_ad:V1.0.1" + sh "docker push bhaluk/devsecops_ad:V1.0.2" } } } @@ -77,7 +77,7 @@ pipeline { } stage('Deploy to Container') { steps { - sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:V1.0.1' + sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:V1.0.2' } } stage('Deploy to Kubernetes') { From c4a2d9f140e5f131e29911ae47918c620f9e713e Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Thu, 13 Jun 2024 23:31:42 +0530 Subject: [PATCH 23/32] Update Jenkinsfile1 --- Jenkinsfile1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 30047b3c..2f6545a0 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -77,7 +77,7 @@ pipeline { } stage('Deploy to Container') { steps { - sh 'docker run -d --name 2048 -p 3000:3000 bhaluk/devsecops_ad:V1.0.2' + sh 'docker run -d --name 2049 -p 3000:3000 bhaluk/devsecops_ad:V1.0.2' } } stage('Deploy to Kubernetes') { From ad59ddbb59624fe455b004bd46b29bcd0266968a Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:29:50 +0530 Subject: [PATCH 24/32] Update Jenkinsfile1 --- Jenkinsfile1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile1 b/Jenkinsfile1 index 2f6545a0..7bbb5585 100644 --- a/Jenkinsfile1 +++ b/Jenkinsfile1 @@ -1,5 +1,7 @@ pipeline { - agent any + agent { + label 'worker' + } tools { jdk 'jdk17' nodejs 'node16' From 5b17135c06e56bc0a0e3d5a6399ff16ab1fdc7a4 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Sat, 15 Jun 2024 01:07:01 +0530 Subject: [PATCH 25/32] Update deployment.yaml --- deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 1047ba11..8e3c226e 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -30,5 +30,5 @@ spec: - protocol: TCP port: 80 # The port exposed by the service within the cluster targetPort: 3000 # The port your React app is listening on inside the pod - type: LoadBalancer - + nodePort: 30036 # The NodePort to access the service from outside the cluster + type: NodePort # Change the service type to NodePort From 430af11fce042c4f10703660311ddb1d60c5be49 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Sat, 15 Jun 2024 01:20:39 +0530 Subject: [PATCH 26/32] Update deployment.yaml --- deployment.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 8e3c226e..1a3c8781 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -1,3 +1,5 @@ +deployment.yaml + apiVersion: apps/v1 kind: Deployment metadata: @@ -30,5 +32,4 @@ spec: - protocol: TCP port: 80 # The port exposed by the service within the cluster targetPort: 3000 # The port your React app is listening on inside the pod - nodePort: 30036 # The NodePort to access the service from outside the cluster - type: NodePort # Change the service type to NodePort + type: LoadBalancer From 9ae9dfc41cce40502853b8b7d4549d138baa41b2 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 17 Jun 2024 10:59:09 +0530 Subject: [PATCH 27/32] Update deployment.yaml From 987b9e08766d4c770302a3bf39c04e290ade82c2 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:29:49 +0530 Subject: [PATCH 28/32] Update deployment.yaml --- deployment.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 1a3c8781..93258b09 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -1,5 +1,3 @@ -deployment.yaml - apiVersion: apps/v1 kind: Deployment metadata: From 52b2c55552eae1599022b984a7f8c41fbe5beef0 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:57:04 +0530 Subject: [PATCH 29/32] Update deployment.yaml --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index 93258b09..521567e9 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: react-app-deployment spec: - replicas: 3 # Adjust the number of replicas as needed + replicas: 2 # Adjust the number of replicas as needed selector: matchLabels: app: react-app From 0920b198054eb815fa1195a17c8121cd8e0eeead Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:42:18 +0530 Subject: [PATCH 30/32] Update deployment.yaml --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index 521567e9..1568f15d 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -30,4 +30,4 @@ spec: - protocol: TCP port: 80 # The port exposed by the service within the cluster targetPort: 3000 # The port your React app is listening on inside the pod - type: LoadBalancer + type: NodePort From 786d88227f40a794cf5c23eefda28f58a393a07d Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:56:23 +0530 Subject: [PATCH 31/32] Update deployment.yaml --- deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment.yaml b/deployment.yaml index 1568f15d..521567e9 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -30,4 +30,4 @@ spec: - protocol: TCP port: 80 # The port exposed by the service within the cluster targetPort: 3000 # The port your React app is listening on inside the pod - type: NodePort + type: LoadBalancer From 78fc0be631103a345799438dfa41d61fa93977c8 Mon Sep 17 00:00:00 2001 From: Bhaluk <155626416+Bhaluk@users.noreply.github.com> Date: Tue, 18 Jun 2024 21:33:08 +0530 Subject: [PATCH 32/32] Update deployment.yaml --- deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 521567e9..2b17162b 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -16,7 +16,7 @@ spec: - name: react-app-container image: bhaluk/devsecops_ad:V1.0.1 # Use your actual Docker image name and tag ports: - - containerPort: 3000 # The port your React app is listening on + - containerPort: 80 # The port your React app is listening on --- apiVersion: v1 @@ -29,5 +29,5 @@ spec: ports: - protocol: TCP port: 80 # The port exposed by the service within the cluster - targetPort: 3000 # The port your React app is listening on inside the pod + targetPort: 80 # The port your React app is listening on inside the pod type: LoadBalancer