From 43397c0ec0b48f0a8fe0257ff59c6086812a0039 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Fri, 14 Jun 2024 17:26:53 -0400
Subject: [PATCH 01/75] Update pom.xml
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index fd17150e..a42a53e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,12 +152,12 @@
maven-releases
maven-releases
- http://3.108.254.192:8081/repository/maven-releases/
+ http://54.177.146.135:8081/repository/maven-releases/
maven-snapshots
maven-snapshots
- http://3.108.254.192:8081/repository/maven-snapshots/
+ http://54.177.146.135:8081/repository/maven-snapshots/
From f9f5e95798fb0715aa8bd70eaab6247dcaef77ec Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Wed, 17 Jul 2024 20:08:56 -0400
Subject: [PATCH 02/75] Update pom.xml
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index a42a53e5..13fb8dd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,12 +152,12 @@
maven-releases
maven-releases
- http://54.177.146.135:8081/repository/maven-releases/
+ http://3.101.25.107:8081/repository/maven-releases/
maven-snapshots
maven-snapshots
- http://54.177.146.135:8081/repository/maven-snapshots/
+ http://3.101.25.107:8081/repository/maven-snapshots/
From ff7af41a70d42ec570f4ac1361225b4802c420ec Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 12:24:35 -0500
Subject: [PATCH 03/75] Create Jenkinsfile
---
Jenkinsfile | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 00000000..339a8a8c
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,94 @@
+pipeline {
+ agent { label ' jenkins_slave' }
+
+ environment {
+ ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
+ IMAGE_NAME = 'app-image'
+ TAG = "${env.BRANCH_NAME}-${env.BUILD_ID}"
+ SSH_KEY = credentials('ec2-ssh-key')
+ }
+
+ stages {
+ stage('Checkout') {
+ steps {
+ git branch: "${env.BRANCH_NAME}", url: 'https://github.com/your-org/your-repo.git'
+ }
+ }
+
+ stage('Build Docker Image') {
+ steps {
+ script {
+ docker.build("${env.ECR_REPO}:${env.TAG}")
+ }
+ }
+ }
+
+ stage('Push to ECR') {
+ steps {
+ withCredentials([usernamePassword(credentialsId: 'aws-ecr', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
+ sh "aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${env.ECR_REPO}"
+ sh "docker push ${env.ECR_REPO}:${env.TAG}"
+ }
+ }
+ post {
+ success {
+ // Send email notification after successful image push to ECR
+ emailext(
+ subject: "Jenkins Job - Docker Image Pushed to ECR Successfully",
+ body: "Hello,\n\nThe Docker image '${env.IMAGE_NAME}:${env.TAG}' has been successfully pushed to ECR.\n\nBest regards,\nJenkins",
+ recipientProviders: [[$class: 'DevelopersRecipientProvider']],
+ to: "m.ehtasham.azhar@gmail.com"
+ )
+ }
+ }
+ }
+
+ stage('Static Code Analysis - SonarQube') {
+ steps {
+ script {
+ withSonarQubeEnv('SonarQubeServer') {
+ sh 'mvn sonar:sonar'
+ }
+ }
+ }
+ }
+
+ stage('Container Security Scan - Trivy') {
+ steps {
+ script {
+ sh "trivy image ${ECR_REPO}:${TAG}"
+ }
+ }
+ }
+
+ stage('Deploy to Environment') {
+ steps {
+ script {
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = ''
+ }
+
+ sh """
+ ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
+ docker pull ${ECR_REPO}:${TAG}
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ EOF
+ """
+ }
+ }
+ }
+ }
+
+ post {
+ always {
+ cleanWs() // Clean up workspace after the build
+ }
+ }
+}
From 3e42e6ecb2c598a9e72ee61946d7c818566fca32 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 12:38:18 -0500
Subject: [PATCH 04/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 339a8a8c..12652e42 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label ' jenkins_slave' }
environment {
From 4f5f745bdadea243ec59026d8e7873a153e0a3e1 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 13:36:39 -0500
Subject: [PATCH 05/75] Update Jenkinsfile
From 69d9e0407aee31c0a292d6f55e92636b9e6ec627 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:04:53 -0500
Subject: [PATCH 06/75] Update Jenkinsfile
---
Jenkinsfile | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 12652e42..db50e1d4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,6 +1,11 @@
pipeline {
agent { label ' jenkins_slave' }
+ tools {
+ maven 'maven3'
+
+ }
+
environment {
ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
IMAGE_NAME = 'app-image'
@@ -14,6 +19,16 @@ pipeline {
git branch: "${env.BRANCH_NAME}", url: 'https://github.com/your-org/your-repo.git'
}
}
+ stage('Compile') {
+ steps {
+ sh 'mvn compile'
+ }
+ }
+ stage('Build Application') {
+ steps {
+ sh 'mvn package'
+ }
+ }
stage('Build Docker Image') {
steps {
@@ -46,7 +61,7 @@ pipeline {
stage('Static Code Analysis - SonarQube') {
steps {
script {
- withSonarQubeEnv('SonarQubeServer') {
+ withSonarQubeEnv('Sonar') {
sh 'mvn sonar:sonar'
}
}
From a477c919dff281b00a1c61b3797bacc7e6d64d38 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:10:07 -0500
Subject: [PATCH 07/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index db50e1d4..3f1f224e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label ' jenkins_slave' }
tools {
From 3b5f4ec6cc91ff2d6a2c7fa5a347a197c571d881 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:20:43 -0500
Subject: [PATCH 08/75] Update Jenkinsfile
---
Jenkinsfile | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 3f1f224e..f1dc464c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -19,14 +19,10 @@ pipeline {
git branch: "${env.BRANCH_NAME}", url: 'https://github.com/your-org/your-repo.git'
}
}
- stage('Compile') {
- steps {
- sh 'mvn compile'
- }
- }
+
stage('Build Application') {
steps {
- sh 'mvn package'
+ sh 'mvn clean package -Dmaven.test.skip=true'
}
}
From 687405046be64ecf5343c718ba1334a5290c1700 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:28:37 -0500
Subject: [PATCH 09/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index f1dc464c..1f8d993b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -48,7 +48,7 @@ pipeline {
subject: "Jenkins Job - Docker Image Pushed to ECR Successfully",
body: "Hello,\n\nThe Docker image '${env.IMAGE_NAME}:${env.TAG}' has been successfully pushed to ECR.\n\nBest regards,\nJenkins",
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
- to: "m.ehtasham.azhar@gmail.com"
+ to: "jap4810@gmail.com"
)
}
}
From 37ea8e15516a0fdc7d85ee4a77ef4406670ebf77 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:48:41 -0500
Subject: [PATCH 10/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 1f8d993b..d2476e88 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -29,7 +29,7 @@ pipeline {
stage('Build Docker Image') {
steps {
script {
- docker.build("${env.ECR_REPO}:${env.TAG}")
+ docker.build("${env.ECR_REPO}:${env.TAG},"-f docker/Dockerfile .")
}
}
}
From c357e506e6aa0c4310818714b9ff93641cfc61b4 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:53:15 -0500
Subject: [PATCH 11/75] Update Jenkinsfile
---
Jenkinsfile | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index d2476e88..e43a6bd1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -27,12 +27,14 @@ pipeline {
}
stage('Build Docker Image') {
- steps {
- script {
- docker.build("${env.ECR_REPO}:${env.TAG},"-f docker/Dockerfile .")
- }
- }
+ steps {
+ script {
+ // Specify the Dockerfile location using the -f option
+ docker.build("${env.ECR_REPO}:${env.TAG}", "-f docker/Dockerfile .")
}
+ }
+}
+
stage('Push to ECR') {
steps {
From 6ef43a104769d9cad4d9da6cf8b37248a0aa6792 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 15:48:59 -0500
Subject: [PATCH 12/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e43a6bd1..6d0b6a13 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -59,7 +59,7 @@ pipeline {
stage('Static Code Analysis - SonarQube') {
steps {
script {
- withSonarQubeEnv('Sonar') {
+ withSonarQubeEnv('sonar') {
sh 'mvn sonar:sonar'
}
}
From 0901a1333a99adb9a30237c653ef0a74ff5507f7 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 15:59:21 -0500
Subject: [PATCH 13/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 6d0b6a13..0760c576 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -59,7 +59,7 @@ pipeline {
stage('Static Code Analysis - SonarQube') {
steps {
script {
- withSonarQubeEnv('sonar') {
+ withSonarQubeEnv('SonarQubeServer') {
sh 'mvn sonar:sonar'
}
}
From 9f345e160e974009931104021d457f483ea091eb Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:33:13 -0500
Subject: [PATCH 14/75] Update Jenkinsfile
---
Jenkinsfile | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 0760c576..baaea2fd 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -66,15 +66,9 @@ pipeline {
}
}
- stage('Container Security Scan - Trivy') {
- steps {
- script {
- sh "trivy image ${ECR_REPO}:${TAG}"
- }
- }
- }
+
- stage('Deploy to Environment') {
+ stage('Deploy to Environment') {
steps {
script {
def targetHost = ''
From ef0bc047504cb18055974129838699f046fdbd07 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:39:21 -0500
Subject: [PATCH 15/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index baaea2fd..da8b0397 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -81,7 +81,7 @@ pipeline {
}
sh """
- ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
+ ssh -i ${SSH_KEY} root@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 8321c72e69a6f26e7a6d182a4bca223e5946aed1 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:47:14 -0500
Subject: [PATCH 16/75] Update Jenkinsfile
---
Jenkinsfile | 55 ++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index da8b0397..721ee4d6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -66,36 +66,39 @@ pipeline {
}
}
-
-
- stage('Deploy to Environment') {
- steps {
- script {
- def targetHost = ''
- if (env.BRANCH_NAME == 'dev') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'staging') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'main') {
- targetHost = ''
- }
+ stage('Deploy to Environment') {
+ steps {
+ script {
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = ''
+ }
- sh """
- ssh -i ${SSH_KEY} root@${targetHost} << EOF
- docker pull ${ECR_REPO}:${TAG}
- docker stop ${IMAGE_NAME} || true
- docker rm ${IMAGE_NAME} || true
- docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- EOF
- """
- }
+ // Use withCredentials to securely handle SSH Key
+ withCredentials([file(credentialsId: 'ec2-ssh-key', variable: 'SSH_KEY')]) {
+ sh """
+ chmod 600 ${SSH_KEY}
+ ssh -i ${SSH_KEY} root@${targetHost} << EOF
+ docker pull ${ECR_REPO}:${TAG}
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ EOF
+ """
}
}
}
+}
- post {
- always {
- cleanWs() // Clean up workspace after the build
- }
+post {
+ always {
+ cleanWs() // Clean up workspace after the build
}
}
+
+
+
From 3357d03ab6318f44391f4cc474dae5e3a4480820 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:51:15 -0500
Subject: [PATCH 17/75] Update Jenkinsfile
---
Jenkinsfile | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 721ee4d6..0164a64e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -99,6 +99,4 @@ post {
cleanWs() // Clean up workspace after the build
}
}
-
-
-
+ }
From d798a9679aeee6a500353f2316ab859b3b95131d Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:53:36 -0500
Subject: [PATCH 18/75] Update Jenkinsfile
---
Jenkinsfile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 0164a64e..ca425d4a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -98,5 +98,4 @@ post {
always {
cleanWs() // Clean up workspace after the build
}
-}
- }
+}}
From 984c5b3e065f5edf01ca604a7f47e493b3f0d64c Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 18:57:00 -0500
Subject: [PATCH 19/75] Update Jenkinsfile
---
Jenkinsfile | 51 ++++++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index ca425d4a..e5988eda 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -65,37 +65,34 @@ pipeline {
}
}
}
-
stage('Deploy to Environment') {
- steps {
- script {
- def targetHost = ''
- if (env.BRANCH_NAME == 'dev') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'staging') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'main') {
- targetHost = ''
- }
+ steps {
+ script {
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = ''
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = ''
+ }
- // Use withCredentials to securely handle SSH Key
- withCredentials([file(credentialsId: 'ec2-ssh-key', variable: 'SSH_KEY')]) {
- sh """
- chmod 600 ${SSH_KEY}
- ssh -i ${SSH_KEY} root@${targetHost} << EOF
- docker pull ${ECR_REPO}:${TAG}
- docker stop ${IMAGE_NAME} || true
- docker rm ${IMAGE_NAME} || true
- docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- EOF
- """
+ sh """
+ ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
+ docker pull ${ECR_REPO}:${TAG}
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ EOF
+ """
+ }
}
}
}
-}
-post {
- always {
- cleanWs() // Clean up workspace after the build
+ post {
+ always {
+ cleanWs() // Clean up workspace after the build
+ }
}
-}}
+}
From f25996343d4a6fcf9a26150744803d19d569e334 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 19:05:11 -0500
Subject: [PATCH 20/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e5988eda..aa8aba75 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,7 @@ pipeline {
}
sh """
- ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
+ ssh -i ${env.SSH_KEY} ec2-user@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 1e5b5cee0162ae91499ef0df0f4bd10d2193abe9 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 19:08:43 -0500
Subject: [PATCH 21/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index aa8aba75..b18b132d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,7 @@ pipeline {
}
sh """
- ssh -i ${env.SSH_KEY} ec2-user@${targetHost} << EOF
+ ssh -i $[SSH_KEY] ec2-user@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 7bfb898490d99484bace87cd7067dace47c25fb2 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 20:59:52 -0500
Subject: [PATCH 22/75] Update Jenkinsfile
---
Jenkinsfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index b18b132d..5b907514 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,8 @@ pipeline {
}
sh """
- ssh -i $[SSH_KEY] ec2-user@${targetHost} << EOF
+ chmod 600 ${SSH_KEY}
+ ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 6e86df6d418e0319a37febff9362cee4a9aa32d2 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:18:21 -0500
Subject: [PATCH 23/75] Update Jenkinsfile
---
Jenkinsfile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 5b907514..21362863 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -10,7 +10,7 @@ pipeline {
ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
IMAGE_NAME = 'app-image'
TAG = "${env.BRANCH_NAME}-${env.BUILD_ID}"
- SSH_KEY = credentials('ec2-ssh-key')
+
}
stages {
@@ -76,10 +76,11 @@ pipeline {
} else if (env.BRANCH_NAME == 'main') {
targetHost = ''
}
-
+ // Use withCredentials to securely handle the SSH key
+ withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')])
sh """
- chmod 600 ${SSH_KEY}
- ssh -i ${SSH_KEY} ec2-user@${targetHost} << EOF
+ chmod 600 ${SSH_KEY_FILE}
+ ssh -i ${SSH_KEY_FILE} ec2-user@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 90d35770cccafb4cc26041496cf11502425fccab Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:25:00 -0500
Subject: [PATCH 24/75] Update Jenkinsfile
---
Jenkinsfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 21362863..555888aa 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -77,7 +77,7 @@ pipeline {
targetHost = ''
}
// Use withCredentials to securely handle the SSH key
- withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')])
+ withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh """
chmod 600 ${SSH_KEY_FILE}
ssh -i ${SSH_KEY_FILE} ec2-user@${targetHost} << EOF
@@ -87,6 +87,7 @@ pipeline {
docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
EOF
"""
+ }
}
}
}
From b8f58bcf985bc70a65d1fd3958360c69078637fa Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:30:24 -0500
Subject: [PATCH 25/75] Update Jenkinsfile
---
Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 555888aa..fae57048 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,9 +78,9 @@ pipeline {
}
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
- sh """
+ sh """#!/bin/bash
chmod 600 ${SSH_KEY_FILE}
- ssh -i ${SSH_KEY_FILE} ec2-user@${targetHost} << EOF
+ ssh -i ${SSH_KEY_FILE} root@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From a165989ec05aae4504138d9bd99c35018cd7e1b4 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:40:29 -0500
Subject: [PATCH 26/75] Update Jenkinsfile
---
Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index fae57048..bd3abf84 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,9 +78,9 @@ pipeline {
}
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
+ sh 'chmod 600 ${SSH_KEY_FILE}'
+ sh 'ssh -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
sh """#!/bin/bash
- chmod 600 ${SSH_KEY_FILE}
- ssh -i ${SSH_KEY_FILE} root@${targetHost} << EOF
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
From 6620016cff9ffd0a9446b349525b9ccd926033f6 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:46:37 -0500
Subject: [PATCH 27/75] Update Jenkinsfile
---
Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bd3abf84..855aec7f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -74,12 +74,12 @@ pipeline {
} else if (env.BRANCH_NAME == 'staging') {
targetHost = ''
} else if (env.BRANCH_NAME == 'main') {
- targetHost = ''
+ targetHost = '<54.234.80.60>'
}
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
+ sh 'ssh -t -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 9d9f2f5f15ed1822abc1a19f15b77fc13c652467 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:55:15 -0500
Subject: [PATCH 28/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 855aec7f..b77e0e6d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -85,7 +85,7 @@ pipeline {
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- EOF
+EOF
"""
}
}
From cad28330e2a64f294d8bb41a353d7a5a2296cdd0 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 21:57:46 -0500
Subject: [PATCH 29/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index b77e0e6d..e4c66fbc 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,7 +79,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -t -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From d5f669548cb2687d58c10ada448cbb60501eb615 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:01:23 -0500
Subject: [PATCH 30/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e4c66fbc..794131b8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -74,7 +74,7 @@ pipeline {
} else if (env.BRANCH_NAME == 'staging') {
targetHost = ''
} else if (env.BRANCH_NAME == 'main') {
- targetHost = '<54.234.80.60>'
+ targetHost = '54.234.80.60'
}
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
From 2426c3b9ed15d706d01ae45c24817ab02f63f2d8 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:06:50 -0500
Subject: [PATCH 31/75] Update Jenkinsfile
---
Jenkinsfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 794131b8..d5d0379b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -76,6 +76,7 @@ pipeline {
} else if (env.BRANCH_NAME == 'main') {
targetHost = '54.234.80.60'
}
+ echo "Target Host: ${targetHost}"
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
From a3100f938aac28ddb57a01706664a51cdedab2f3 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:09:19 -0500
Subject: [PATCH 32/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index d5d0379b..63b2a42e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 60542ce3eebb4fde7c04a53a3bdb915972fb9225 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:14:10 -0500
Subject: [PATCH 33/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 63b2a42e..e99a3fac 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -74,7 +74,7 @@ pipeline {
} else if (env.BRANCH_NAME == 'staging') {
targetHost = ''
} else if (env.BRANCH_NAME == 'main') {
- targetHost = '54.234.80.60'
+ targetHost = '172-31-32-49'
}
echo "Target Host: ${targetHost}"
// Use withCredentials to securely handle the SSH key
From 0af33f5228afbce373738b6d9db9664215e6b4b1 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:28:19 -0500
Subject: [PATCH 34/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e99a3fac..62c854e7 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From cfcd458e03e9989156e60b9d722277dfe9372e3d Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:42:50 -0500
Subject: [PATCH 35/75] Update Jenkinsfile
---
Jenkinsfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 62c854e7..4dcb47ff 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -74,13 +74,13 @@ pipeline {
} else if (env.BRANCH_NAME == 'staging') {
targetHost = ''
} else if (env.BRANCH_NAME == 'main') {
- targetHost = '172-31-32-49'
+ targetHost = ''
}
- echo "Target Host: ${targetHost}"
+
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From d243475c46ff2554eecc374c5b9dfe1f8729eadd Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:44:30 -0500
Subject: [PATCH 36/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4dcb47ff..bc674b45 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 2f12d61ad8151db836201df3f2c8cea210d5ba08 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 22 Dec 2024 22:49:13 -0500
Subject: [PATCH 37/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bc674b45..352eade4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -68,7 +68,7 @@ pipeline {
stage('Deploy to Environment') {
steps {
script {
- def targetHost = ''
+ def targetHost = '54.234.80.60'
if (env.BRANCH_NAME == 'dev') {
targetHost = ''
} else if (env.BRANCH_NAME == 'staging') {
From 6619d3321bf34e3712016582413e142b8b6fd480 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 10:47:19 -0500
Subject: [PATCH 38/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 352eade4..cd14f6fd 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} root@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 154e0fa475ccd6aa333f9c294bbdf98d06805b4b Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:09:35 -0500
Subject: [PATCH 39/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index cd14f6fd..1debdb0d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -68,7 +68,7 @@ pipeline {
stage('Deploy to Environment') {
steps {
script {
- def targetHost = '54.234.80.60'
+ def targetHost = '192.168.1.10'
if (env.BRANCH_NAME == 'dev') {
targetHost = ''
} else if (env.BRANCH_NAME == 'staging') {
From 93998eab15365656e003dfda3854ef5f3b5ce511 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:17:17 -0500
Subject: [PATCH 40/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 1debdb0d..bc0fdaf5 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -68,7 +68,7 @@ pipeline {
stage('Deploy to Environment') {
steps {
script {
- def targetHost = '192.168.1.10'
+ def targetHost = 'ip-192-168-1-10.ec2.internal.'
if (env.BRANCH_NAME == 'dev') {
targetHost = ''
} else if (env.BRANCH_NAME == 'staging') {
From 108fb67305b600b5dd68179b6d1dc0941080d050 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:23:39 -0500
Subject: [PATCH 41/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bc0fdaf5..55923174 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -68,7 +68,7 @@ pipeline {
stage('Deploy to Environment') {
steps {
script {
- def targetHost = 'ip-192-168-1-10.ec2.internal.'
+ def targetHost = 'ec2-54-234-80-60.compute-1.amazonaws.com'
if (env.BRANCH_NAME == 'dev') {
targetHost = ''
} else if (env.BRANCH_NAME == 'staging') {
From f88b55a85d778854be0189696d425993d09ee667 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:30:37 -0500
Subject: [PATCH 42/75] Update Jenkinsfile
---
Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 55923174..fd93f85d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -68,7 +68,7 @@ pipeline {
stage('Deploy to Environment') {
steps {
script {
- def targetHost = 'ec2-54-234-80-60.compute-1.amazonaws.com'
+ def targetHost = ''
if (env.BRANCH_NAME == 'dev') {
targetHost = ''
} else if (env.BRANCH_NAME == 'staging') {
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@${targetHost} << EOF'
+ sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@54.234.80.60 << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 16093ad760a2d5a29ee88f1a3f3617998b1e7c45 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:42:54 -0500
Subject: [PATCH 43/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index fd93f85d..6c420c29 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,7 @@ pipeline {
}
// Use withCredentials to securely handle the SSH key
- withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key', keyFileVariable: 'SSH_KEY_FILE')]){
+ withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@54.234.80.60 << EOF'
sh """#!/bin/bash
From c6e62f7797ead961c822fd2585d39ba2eb3d8e10 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 11:52:29 -0500
Subject: [PATCH 44/75] Update Jenkinsfile
From 1e18ab7b60b702bfdce514fd2d1d69c2ee150f78 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 12:07:56 -0500
Subject: [PATCH 45/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 6c420c29..fe6d06ee 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 ${SSH_KEY_FILE}'
- sh 'ssh -tt -i ${SSH_KEY_FILE} ubuntu@54.234.80.60 << EOF'
+ sh 'ssh -tt -i ${ec2-ssh-key1} ubuntu@54.234.80.60 << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From ee49f48cf3abcb04c61cd2c50265c94546aa164e Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 12:12:12 -0500
Subject: [PATCH 46/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index fe6d06ee..f56935f2 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,7 +79,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
- sh 'chmod 600 ${SSH_KEY_FILE}'
+ sh 'chmod 600 ${ec2-ssh-key1}'
sh 'ssh -tt -i ${ec2-ssh-key1} ubuntu@54.234.80.60 << EOF'
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
From 965b429abe85bf412122e1b7f66d455e73e75a55 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:04:03 -0500
Subject: [PATCH 47/75] Update Jenkinsfile
---
Jenkinsfile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index f56935f2..59a8ad8a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,8 +79,9 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
- sh 'chmod 600 ${ec2-ssh-key1}'
- sh 'ssh -tt -i ${ec2-ssh-key1} ubuntu@54.234.80.60 << EOF'
+ sh 'chmod 600 $SSH_KEY_FILE
+ sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
+ sh ' echo "connection sussecfull" '
sh """#!/bin/bash
docker pull ${ECR_REPO}:${TAG}
docker stop ${IMAGE_NAME} || true
From 23a8ed0a07e987732a0c3c339eb83d1aa8e02b2f Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:07:16 -0500
Subject: [PATCH 48/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 59a8ad8a..27310af9 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -79,7 +79,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
- sh 'chmod 600 $SSH_KEY_FILE
+ sh 'chmod 600 $SSH_KEY_FILE'
sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
From e829958abad096febd34ef26b4eb1b77867e8e2e Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:37:28 -0500
Subject: [PATCH 49/75] Update Jenkinsfile
---
Jenkinsfile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 27310af9..ae795d50 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -83,10 +83,14 @@ pipeline {
sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
+ echo "Pulling Docker image..."
docker pull ${ECR_REPO}:${TAG}
+ echo "Stopping existing container..."
docker stop ${IMAGE_NAME} || true
docker rm ${IMAGE_NAME} || true
+ echo "Running new container..."
docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ echo "Deployment completed"
EOF
"""
}
From e354b1265e96d1387605235b3983cdc0d0dac13a Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:48:21 -0500
Subject: [PATCH 50/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index ae795d50..c614b414 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
+ sh 'ssh -o BatchMode=yes -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF > /dev/null 2>&1'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From 82a14729d81abbb903631e0f467652b24f963453 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:54:29 -0500
Subject: [PATCH 51/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index c614b414..ae795d50 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -o BatchMode=yes -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF > /dev/null 2>&1'
+ sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From 24f3693d68db7f041ad3150bb4fab2c2a828bd9a Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 17:56:43 -0500
Subject: [PATCH 52/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index ae795d50..69ef6d2f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@54.234.80.60 << EOF'
+ sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@3.81.82.20 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From 65a45f83a77810b31bfca4c5b4faa14a114519ca Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 18:12:07 -0500
Subject: [PATCH 53/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 69ef6d2f..2c409a94 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label ' jenkins_slave' }
tools {
From 4e7bc8d138ff2f6d91506047a2b3dddd87aaddc1 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 18:45:00 -0500
Subject: [PATCH 54/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 2c409a94..44273c08 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label ' jenkins_slave' }
tools {
From 794b51c3ec13a5c0bcf431df1138de5bb05efa06 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 18:53:30 -0500
Subject: [PATCH 55/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 44273c08..03e4380e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -78,7 +78,7 @@ pipeline {
}
// Use withCredentials to securely handle the SSH key
- withCredentials([sshUserPrivateKey(credentialsId: 'ec2-ssh-key1', keyFileVariable: 'SSH_KEY_FILE')]){
+ withCredentials([sshUserPrivateKey(credentialsId: 'pro_ssh_key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@3.81.82.20 << EOF'
sh ' echo "connection sussecfull" '
From 63797f0f59645690e09f37bb78a93b46e2c0ed63 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 23 Dec 2024 18:59:30 -0500
Subject: [PATCH 56/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 03e4380e..ded8b07b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'pro_ssh_key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -tt -i $SSH_KEY_FILE ubuntu@3.81.82.20 << EOF'
+ sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE ubuntu@3.81.82.20 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From 7b0858fc48e20e6b131caa0a9e8bae73d7b5b7ba Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 11:39:54 -0500
Subject: [PATCH 57/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index ded8b07b..7ffe2833 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,5 +1,5 @@
pipeline {
- agent { label ' jenkins_slave' }
+ agent { label 'Slave1' }
tools {
maven 'maven3'
From 42c079b61721613be44bce8eb431d0556236e768 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 11:44:03 -0500
Subject: [PATCH 58/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 7ffe2833..252d29ba 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label 'Slave1' }
tools {
From 441bde6789f66c86d4b15180a929dfe4d2a53509 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 11:48:05 -0500
Subject: [PATCH 59/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 252d29ba..86831d1c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,7 +1,7 @@
pipeline {
agent { label 'Slave1' }
- tools {
+ tools {
maven 'maven3'
}
From 89cec86d3dfbf3316a280e8bdf878fcdda7c77ae Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 12:20:21 -0500
Subject: [PATCH 60/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 86831d1c..4a6709d6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -80,7 +80,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'pro_ssh_key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE ubuntu@3.81.82.20 << EOF'
+ sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE root@54.208.90.215 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From 0531cb3bd6db79ec9f3f7cdfa4d802c7c22dce2a Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 12:30:21 -0500
Subject: [PATCH 61/75] Update Jenkinsfile
From 2857cd1135d91cf5af8a9dfc9b75d1e42ced36f9 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sat, 28 Dec 2024 13:05:56 -0500
Subject: [PATCH 62/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4a6709d6..8ae5416f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label 'Slave1' }
tools {
From 267b01fd118a7637fca20106f84b3910e37cf065 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:11:15 -0500
Subject: [PATCH 63/75] Update Jenkinsfile
---
Jenkinsfile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 8ae5416f..471256d3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -55,6 +55,14 @@ pipeline {
}
}
}
+ stage('Container Security Scan - Trivy') {
+ steps {
+ script {
+ sh "trivy image ${ECR_REPO}:${TAG}"
+ }
+ }
+ }
+
stage('Static Code Analysis - SonarQube') {
steps {
From 143c5fe9e839f723ffdb58acf783765fb8df660b Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:30:24 -0500
Subject: [PATCH 64/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 471256d3..0835c822 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -58,7 +58,7 @@ pipeline {
stage('Container Security Scan - Trivy') {
steps {
script {
- sh "trivy image ${ECR_REPO}:${TAG}"
+ sh "trivy image 866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo:main-9"
}
}
}
From 8cc2ed750801f719b4006297b5bbc4e694ecd9e4 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:33:41 -0500
Subject: [PATCH 65/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 0835c822..afed39c6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label 'Slave1' }
tools {
From 19c638c9fc61d297a7b06bcc632a9a87da3f53a9 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:42:55 -0500
Subject: [PATCH 66/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index afed39c6..2cce00c0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -6,7 +6,7 @@ pipeline {
}
- environment {
+ environment {
ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
IMAGE_NAME = 'app-image'
TAG = "${env.BRANCH_NAME}-${env.BUILD_ID}"
From d4f9382d5b303734b8179a03e068d6f6451d338b Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:47:05 -0500
Subject: [PATCH 67/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 2cce00c0..9ac1b2c0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -6,7 +6,7 @@ pipeline {
}
- environment {
+ environment {
ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
IMAGE_NAME = 'app-image'
TAG = "${env.BRANCH_NAME}-${env.BUILD_ID}"
From e73ffdb7632cd54ad2ec8380ad3c58d352e43360 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 12:55:48 -0500
Subject: [PATCH 68/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 9ac1b2c0..48b81f29 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label 'Slave1' }
tools {
From 61de27c93fa93a40a197126776d135f2bc91b4dd Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Sun, 29 Dec 2024 13:07:17 -0500
Subject: [PATCH 69/75] Update Jenkinsfile
---
Jenkinsfile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 48b81f29..231b41fe 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -58,6 +58,8 @@ pipeline {
stage('Container Security Scan - Trivy') {
steps {
script {
+ sh 'aws ecr get-login-password --region us-east-1 | sudo docker login --username AWS --password-stdin 866934333672.dkr.ecr.us-east-1.amazonaws.com'
+ sh 'sudo usermod -aG docker root'
sh "trivy image 866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo:main-9"
}
}
From b0438bfdd55ccb2d6829ef59be244f9db474dd2f Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 12:41:44 -0500
Subject: [PATCH 70/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 231b41fe..bb652a83 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -90,7 +90,7 @@ pipeline {
// Use withCredentials to securely handle the SSH key
withCredentials([sshUserPrivateKey(credentialsId: 'pro_ssh_key', keyFileVariable: 'SSH_KEY_FILE')]){
sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE root@54.208.90.215 << EOF'
+ sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE root@98.83.70.146 << EOF'
sh ' echo "connection sussecfull" '
sh """#!/bin/bash
echo "Pulling Docker image..."
From fa330856910099f69d4e7a27c189bf578e7405f1 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 12:49:27 -0500
Subject: [PATCH 71/75] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bb652a83..cdc108f6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,4 @@
-pipeline {
+pipeline {
agent { label 'Slave1' }
tools {
From bdf7a18dcbe3a6ce22d46bebb18d462aab8737a5 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 13:05:54 -0500
Subject: [PATCH 72/75] Update Jenkinsfile
---
Jenkinsfile | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index cdc108f6..8b77042d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -75,6 +75,35 @@ pipeline {
}
}
}
+ stage('Deploy to Environment') {
+ steps {
+ script {
+ // Check the branch name and set the appropriate target
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = 'dev-server' // Define the name or address for the dev server if needed
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = 'staging-server' // Define the name or address for staging
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = 'production-server' // Define the production server address
+ }
+
+ // Run deployment commands directly on the same agent (slave) server
+ echo "Deploying to $targetHost"
+ sh '''
+ echo "Pulling Docker image..."
+ docker pull ${ECR_REPO}:${TAG}
+ echo "Stopping existing container..."
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ echo "Running new container..."
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ echo "Deployment completed"
+ '''
+ }
+ }
+}
+
stage('Deploy to Environment') {
steps {
script {
From f358764b1af5d86bf36aab1b3a39caaa6db5f71e Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 13:13:44 -0500
Subject: [PATCH 73/75] Update Jenkinsfile
---
Jenkinsfile | 32 ++------------------------------
1 file changed, 2 insertions(+), 30 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 8b77042d..5a0a84be 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -75,36 +75,8 @@ pipeline {
}
}
}
- stage('Deploy to Environment') {
- steps {
- script {
- // Check the branch name and set the appropriate target
- def targetHost = ''
- if (env.BRANCH_NAME == 'dev') {
- targetHost = 'dev-server' // Define the name or address for the dev server if needed
- } else if (env.BRANCH_NAME == 'staging') {
- targetHost = 'staging-server' // Define the name or address for staging
- } else if (env.BRANCH_NAME == 'main') {
- targetHost = 'production-server' // Define the production server address
- }
-
- // Run deployment commands directly on the same agent (slave) server
- echo "Deploying to $targetHost"
- sh '''
- echo "Pulling Docker image..."
- docker pull ${ECR_REPO}:${TAG}
- echo "Stopping existing container..."
- docker stop ${IMAGE_NAME} || true
- docker rm ${IMAGE_NAME} || true
- echo "Running new container..."
- docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- echo "Deployment completed"
- '''
- }
- }
-}
-
- stage('Deploy to Environment') {
+
+ stage('Deploy to Environment') {
steps {
script {
def targetHost = ''
From a9a1c5101663d6cecb7dfa957c04ec54a659be70 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 13:22:31 -0500
Subject: [PATCH 74/75] Update Jenkinsfile
---
Jenkinsfile | 59 +++++++++++++++++++++++------------------------------
1 file changed, 26 insertions(+), 33 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 5a0a84be..aaf73814 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -75,42 +75,35 @@ pipeline {
}
}
}
-
- stage('Deploy to Environment') {
- steps {
- script {
- def targetHost = ''
- if (env.BRANCH_NAME == 'dev') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'staging') {
- targetHost = ''
- } else if (env.BRANCH_NAME == 'main') {
- targetHost = ''
- }
-
- // Use withCredentials to securely handle the SSH key
- withCredentials([sshUserPrivateKey(credentialsId: 'pro_ssh_key', keyFileVariable: 'SSH_KEY_FILE')]){
- sh 'chmod 600 $SSH_KEY_FILE'
- sh 'ssh -o StrictHostKeyChecking=no -tt -i $SSH_KEY_FILE root@98.83.70.146 << EOF'
- sh ' echo "connection sussecfull" '
- sh """#!/bin/bash
- echo "Pulling Docker image..."
- docker pull ${ECR_REPO}:${TAG}
- echo "Stopping existing container..."
- docker stop ${IMAGE_NAME} || true
- docker rm ${IMAGE_NAME} || true
- echo "Running new container..."
- docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- echo "Deployment completed"
-EOF
- """
- }
- }
+ stage('Deploy to Environment') {
+ steps {
+ script {
+ // Check the branch name and set the appropriate target
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = 'dev-server' // Define the name or address for the dev server if needed
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = 'staging-server' // Define the name or address for staging
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = 'production-server' // Define the production server address
}
+
+ // Run deployment commands directly on the same agent (slave) server
+ echo "Deploying to $targetHost"
+ sh '''
+ echo "Pulling Docker image..."
+ docker pull ${ECR_REPO}:${TAG}
+ echo "Stopping existing container..."
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ echo "Running new container..."
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ echo "Deployment completed"
+ '''
}
}
-
- post {
+}
+ post {
always {
cleanWs() // Clean up workspace after the build
}
From 32746c5475cced88babd6aa937a75c2687b0c7f9 Mon Sep 17 00:00:00 2001
From: Jay2925 <147561085+Jay2925@users.noreply.github.com>
Date: Mon, 30 Dec 2024 13:24:44 -0500
Subject: [PATCH 75/75] Update Jenkinsfile
---
Jenkinsfile | 72 ++++++++++++++++++++++++++---------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index aaf73814..91645764 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -3,14 +3,12 @@ pipeline {
tools {
maven 'maven3'
-
}
environment {
ECR_REPO = '866934333672.dkr.ecr.us-east-1.amazonaws.com/jay-repo'
IMAGE_NAME = 'app-image'
TAG = "${env.BRANCH_NAME}-${env.BUILD_ID}"
-
}
stages {
@@ -22,19 +20,18 @@ pipeline {
stage('Build Application') {
steps {
- sh 'mvn clean package -Dmaven.test.skip=true'
+ sh 'mvn clean package -Dmaven.test.skip=true'
}
}
stage('Build Docker Image') {
- steps {
- script {
- // Specify the Dockerfile location using the -f option
- docker.build("${env.ECR_REPO}:${env.TAG}", "-f docker/Dockerfile .")
+ steps {
+ script {
+ // Specify the Dockerfile location using the -f option
+ docker.build("${env.ECR_REPO}:${env.TAG}", "-f docker/Dockerfile .")
+ }
+ }
}
- }
-}
-
stage('Push to ECR') {
steps {
@@ -55,6 +52,7 @@ pipeline {
}
}
}
+
stage('Container Security Scan - Trivy') {
steps {
script {
@@ -65,7 +63,6 @@ pipeline {
}
}
-
stage('Static Code Analysis - SonarQube') {
steps {
script {
@@ -75,35 +72,38 @@ pipeline {
}
}
}
+
stage('Deploy to Environment') {
- steps {
- script {
- // Check the branch name and set the appropriate target
- def targetHost = ''
- if (env.BRANCH_NAME == 'dev') {
- targetHost = 'dev-server' // Define the name or address for the dev server if needed
- } else if (env.BRANCH_NAME == 'staging') {
- targetHost = 'staging-server' // Define the name or address for staging
- } else if (env.BRANCH_NAME == 'main') {
- targetHost = 'production-server' // Define the production server address
+ steps {
+ script {
+ // Check the branch name and set the appropriate target
+ def targetHost = ''
+ if (env.BRANCH_NAME == 'dev') {
+ targetHost = 'dev-server' // Define the name or address for the dev server if needed
+ } else if (env.BRANCH_NAME == 'staging') {
+ targetHost = 'staging-server' // Define the name or address for staging
+ } else if (env.BRANCH_NAME == 'main') {
+ targetHost = 'production-server' // Define the production server address
+ }
+
+ // Run deployment commands directly on the same agent (slave) server
+ echo "Deploying to $targetHost"
+ sh """
+ echo "Pulling Docker image..."
+ docker pull ${ECR_REPO}:${TAG}
+ echo "Stopping existing container..."
+ docker stop ${IMAGE_NAME} || true
+ docker rm ${IMAGE_NAME} || true
+ echo "Running new container..."
+ docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
+ echo "Deployment completed"
+ """
+ }
}
-
- // Run deployment commands directly on the same agent (slave) server
- echo "Deploying to $targetHost"
- sh '''
- echo "Pulling Docker image..."
- docker pull ${ECR_REPO}:${TAG}
- echo "Stopping existing container..."
- docker stop ${IMAGE_NAME} || true
- docker rm ${IMAGE_NAME} || true
- echo "Running new container..."
- docker run -d --name ${IMAGE_NAME} -p 80:80 ${ECR_REPO}:${TAG}
- echo "Deployment completed"
- '''
}
}
-}
- post {
+
+ post {
always {
cleanWs() // Clean up workspace after the build
}