From 5f5355e88f10339493b7bc376080d0a5c87d2fcf Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 19:08:50 +0300
Subject: [PATCH 1/6] Update Jenkinsfile
---
Jenkinsfile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 13346e400..bc10a466a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -3,7 +3,7 @@ pipeline {
stages {
stage('checkout') {
steps {
- git url:'https://github.com/akshu20791/DevOpsClassCodes/', branch: "master"
+ git url:'https://github.com/mariantom/DevOpsClassCodes', branch: "master"
}
}
stage('Build') {
@@ -14,24 +14,24 @@ pipeline {
stage('Build Image') {
steps {
- sh 'docker build -t akshatimg .'
- sh 'docker tag akshatimg:latest akshu20791/akshatimgaddbook:latest'
+ sh 'docker build -t mariaimg .'
+ sh 'docker tag mariaimg:latest mariantom/mariaddbook:latest'
}
}
stage('Docker login') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockercred', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh "echo $PASS | docker login -u $USER --password-stdin"
- sh 'docker push akshu20791/akshatimgaddbook:latest'
+ sh 'docker push mariantom/mariaimgaddbook:latest'
}
}
}
stage('Deploy') {
steps {
script {
- def dockerCmd = 'docker run -itd --name My-first-containe211 -p 80:8082 akshu20791/akshatimgaddbook:latest'
+ def dockerCmd = 'docker run -itd --name My-first-containe211 -p 80:8082 mariantom/mariaimgaddbook:latest'
sshagent(['sshkeypair']) {
- sh "ssh -o StrictHostKeyChecking=no ubuntu@172.31.20.232 ${dockerCmd}"
+ sh "ssh -o StrictHostKeyChecking=no ubuntu@172-31-22-46 ${dockerCmd}"
}
}
}
From 13eaf9e349b7b2a2df4f292fcc11f8c230503e8d Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 19:11:32 +0300
Subject: [PATCH 2/6] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index bc10a466a..864766a30 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -20,7 +20,7 @@ pipeline {
}
stage('Docker login') {
steps {
- withCredentials([usernamePassword(credentialsId: 'dockercred', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
+ withCredentials([usernamePassword(credentialsId: 'dockerhub-pwd', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh "echo $PASS | docker login -u $USER --password-stdin"
sh 'docker push mariantom/mariaimgaddbook:latest'
}
From 13f21726575cb28568745e3095a26a0c148a16e9 Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 19:45:09 +0300
Subject: [PATCH 3/6] Update pom.xml
---
pom.xml | 78 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 38 insertions(+), 40 deletions(-)
diff --git a/pom.xml b/pom.xml
index 50dfd3766..1e1503edb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,50 +22,48 @@
-
-
- vaadin-prereleases
- Vaadin Pre-releases
- https://maven.vaadin.com/vaadin-prereleases
-
-
-
- vaadin-addons
- http://maven.vaadin.com/vaadin-addons
-
+
+
+ vaadin-prereleases
+ Vaadin Pre-releases
+ https://maven.vaadin.com/vaadin-prereleases
+
+
+
+ vaadin-addons
+ http://maven.vaadin.com/vaadin-addons
+
+
+ vaadin-snapshots
+ http://oss.sonatype.org/content/repositories/vaadin-snapshots/
+
+ false
+
+
+ true
+
+
+
-
- vaadin-snapshots
- http://oss.sonatype.org/content/repositories/vaadin-snapshots/
-
- false
-
-
- true
-
-
-
-
-
-
- vaadin-snapshots
- http://oss.sonatype.org/content/repositories/vaadin-snapshots/
-
- false
-
-
- true
-
-
-
-
- maven2
- https://repo.maven.apache.org/maven2/
-
+
+ vaadin-snapshots
+ http://oss.sonatype.org/content/repositories/vaadin-snapshots/
+
+ false
+
+
+ true
+
+
+
+ maven2
+ https://repo.maven.apache.org/maven2/
+
+
com.vaadin
From 07e286f6b792f53dd95a9773288919f6f80b401e Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 20:11:00 +0300
Subject: [PATCH 4/6] Update Jenkinsfile
---
Jenkinsfile | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 864766a30..3818e381f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,27 +1,25 @@
pipeline {
agent any
stages {
- stage('checkout') {
+ stage('Checkout') {
steps {
- git url:'https://github.com/mariantom/DevOpsClassCodes', branch: "master"
+ git url: 'https://github.com/mariantom/DevOpsClassCodes', branch: 'master'
}
}
stage('Build') {
steps {
- sh "mvn clean package"
+ sh 'mvn clean package'
}
}
-
- stage('Build Image') {
+ stage('Build Docker Image') {
steps {
- sh 'docker build -t mariaimg .'
- sh 'docker tag mariaimg:latest mariantom/mariaddbook:latest'
+ sh 'docker build -t mariantom/mariaimgaddbook:latest .'
}
}
- stage('Docker login') {
+ stage('Docker Login and Push') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub-pwd', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
- sh "echo $PASS | docker login -u $USER --password-stdin"
+ sh 'echo $PASS | docker login -u $USER --password-stdin'
sh 'docker push mariantom/mariaimgaddbook:latest'
}
}
From 27cc32de0c60b9db3839d7000af399c52f7bd271 Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 20:21:27 +0300
Subject: [PATCH 5/6] Update Jenkinsfile
---
Jenkinsfile | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 3818e381f..33d1b99db 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,5 +34,16 @@ pipeline {
}
}
}
+ stage('Move WAR File') {
+ steps {
+ script {
+ def warFile = '/var/lib/jenkins/workspace/akshat-pipeline/target/addressbook.war'
+ def tomcatDir = '/opt/apache-tomcat-8.5.100/webapps/'
+ sh "if [ -f ${warFile} ]; then sudo mv ${warFile} ${tomcatDir}; else echo 'WAR file does not exist'; exit 1; fi"
+ }
+ }
+ }
}
}
+
+}
From 82dc853cfdcb675e14bbd7acbfa3036239dc6555 Mon Sep 17 00:00:00 2001
From: mariantom <69826172+mariantom@users.noreply.github.com>
Date: Sat, 1 Jun 2024 20:29:59 +0300
Subject: [PATCH 6/6] Update Jenkinsfile
---
Jenkinsfile | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 33d1b99db..5f74d7be8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,16 +34,8 @@ pipeline {
}
}
}
- stage('Move WAR File') {
- steps {
- script {
- def warFile = '/var/lib/jenkins/workspace/akshat-pipeline/target/addressbook.war'
- def tomcatDir = '/opt/apache-tomcat-8.5.100/webapps/'
- sh "if [ -f ${warFile} ]; then sudo mv ${warFile} ${tomcatDir}; else echo 'WAR file does not exist'; exit 1; fi"
- }
- }
- }
}
}
+
}