From c25c9630347ab80598fd2321d91dbea5907015b8 Mon Sep 17 00:00:00 2001 From: Imran Teli Date: Sat, 1 Jul 2023 13:08:45 +0530 Subject: [PATCH 01/19] jenkins userdata --- Jenkinsfile | 4 +- userdata/jenkins-setup.sh | 15 ++++ userdata/nexus-setup.sh | 35 +++++++++ userdata/sonar-analysis-properties | 10 +++ userdata/sonar-setup.sh | 119 +++++++++++++++++++++++++++++ 5 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 userdata/jenkins-setup.sh create mode 100644 userdata/nexus-setup.sh create mode 100644 userdata/sonar-analysis-properties create mode 100644 userdata/sonar-setup.sh diff --git a/Jenkinsfile b/Jenkinsfile index be7508be5..969d00c6e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { NEXUS_PROTOCOL = "http" NEXUS_URL = "172.31.40.209:8081" NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPO_ID = "vprofile-release" + NEXUS_REPOGRP_ID = "vprofile-grp-repo" NEXUS_CREDENTIAL_ID = "nexuslogin" ARTVERSION = "${env.BUILD_ID}" } @@ -91,7 +91,7 @@ pipeline { nexusVersion: NEXUS_VERSION, protocol: NEXUS_PROTOCOL, nexusUrl: NEXUS_URL, - groupId: pom.groupId, + groupId: NEXUS_REPOGRP_ID, version: ARTVERSION, repository: NEXUS_REPOSITORY, credentialsId: NEXUS_CREDENTIAL_ID, diff --git a/userdata/jenkins-setup.sh b/userdata/jenkins-setup.sh new file mode 100644 index 000000000..7c849fc68 --- /dev/null +++ b/userdata/jenkins-setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash +sudo apt update +sudo apt install openjdk-11-jdk -y +sudo apt install maven wget unzip -y + +curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \ + /usr/share/keyrings/jenkins-keyring.asc > /dev/null + +echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ + https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ + /etc/apt/sources.list.d/jenkins.list > /dev/null + +sudo apt-get update +sudo apt-get install jenkins -y +### diff --git a/userdata/nexus-setup.sh b/userdata/nexus-setup.sh new file mode 100644 index 000000000..f3fadecc6 --- /dev/null +++ b/userdata/nexus-setup.sh @@ -0,0 +1,35 @@ +#!/bin/bash +yum install java-1.8.0-openjdk.x86_64 wget -y +mkdir -p /opt/nexus/ +mkdir -p /tmp/nexus/ +cd /tmp/nexus/ +NEXUSURL="https://download.sonatype.com/nexus/3/latest-unix.tar.gz" +wget $NEXUSURL -O nexus.tar.gz +EXTOUT=`tar xzvf nexus.tar.gz` +NEXUSDIR=`echo $EXTOUT | cut -d '/' -f1` +rm -rf /tmp/nexus/nexus.tar.gz +rsync -avzh /tmp/nexus/ /opt/nexus/ +useradd nexus +chown -R nexus.nexus /opt/nexus +cat <> /etc/systemd/system/nexus.service +[Unit] +Description=nexus service +After=network.target + +[Service] +Type=forking +LimitNOFILE=65536 +ExecStart=/opt/nexus/$NEXUSDIR/bin/nexus start +ExecStop=/opt/nexus/$NEXUSDIR/bin/nexus stop +User=nexus +Restart=on-abort + +[Install] +WantedBy=multi-user.target + +EOT + +echo 'run_as_user="nexus"' > /opt/nexus/$NEXUSDIR/bin/nexus.rc +systemctl daemon-reload +systemctl start nexus +systemctl enable nexus diff --git a/userdata/sonar-analysis-properties b/userdata/sonar-analysis-properties new file mode 100644 index 000000000..8751fe7fd --- /dev/null +++ b/userdata/sonar-analysis-properties @@ -0,0 +1,10 @@ +sonar.projectKey=vprofile +sonar.projectName=vprofile-repo +sonar.projectVersion=1.0 +sonar.sources=src/ +sonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ +sonar.junit.reportsPath=target/surefire-reports/ +sonar.jacoco.reportsPath=target/jacoco.exec +sonar.java.checkstyle.reportPaths=target/checkstyle-result.xml + + diff --git a/userdata/sonar-setup.sh b/userdata/sonar-setup.sh new file mode 100644 index 000000000..99a3a78b7 --- /dev/null +++ b/userdata/sonar-setup.sh @@ -0,0 +1,119 @@ +#!/bin/bash +cp /etc/sysctl.conf /root/sysctl.conf_backup +cat < /etc/sysctl.conf +vm.max_map_count=262144 +fs.file-max=65536 +ulimit -n 65536 +ulimit -u 4096 +EOT +cp /etc/security/limits.conf /root/sec_limit.conf_backup +cat < /etc/security/limits.conf +sonarqube - nofile 65536 +sonarqube - nproc 409 +EOT + +sudo apt-get update -y +sudo apt-get install openjdk-11-jdk -y +sudo update-alternatives --config java + +java -version + +sudo apt update +wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add - + +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' +sudo apt install postgresql postgresql-contrib -y +#sudo -u postgres psql -c "SELECT version();" +sudo systemctl enable postgresql.service +sudo systemctl start postgresql.service +sudo echo "postgres:admin123" | chpasswd +runuser -l postgres -c "createuser sonar" +sudo -i -u postgres psql -c "ALTER USER sonar WITH ENCRYPTED PASSWORD 'admin123';" +sudo -i -u postgres psql -c "CREATE DATABASE sonarqube OWNER sonar;" +sudo -i -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;" +systemctl restart postgresql +#systemctl status -l postgresql +netstat -tulpena | grep postgres +sudo mkdir -p /sonarqube/ +cd /sonarqube/ +sudo curl -O https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.3.0.34182.zip +sudo apt-get install zip -y +sudo unzip -o sonarqube-8.3.0.34182.zip -d /opt/ +sudo mv /opt/sonarqube-8.3.0.34182/ /opt/sonarqube +sudo groupadd sonar +sudo useradd -c "SonarQube - User" -d /opt/sonarqube/ -g sonar sonar +sudo chown sonar:sonar /opt/sonarqube/ -R +cp /opt/sonarqube/conf/sonar.properties /root/sonar.properties_backup +cat < /opt/sonarqube/conf/sonar.properties +sonar.jdbc.username=sonar +sonar.jdbc.password=admin123 +sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube +sonar.web.host=0.0.0.0 +sonar.web.port=9000 +sonar.web.javaAdditionalOpts=-server +sonar.search.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError +sonar.log.level=INFO +sonar.path.logs=logs +EOT + +cat < /etc/systemd/system/sonarqube.service +[Unit] +Description=SonarQube service +After=syslog.target network.target + +[Service] +Type=forking + +ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start +ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop + +User=sonar +Group=sonar +Restart=always + +LimitNOFILE=65536 +LimitNPROC=4096 + + +[Install] +WantedBy=multi-user.target +EOT + +systemctl daemon-reload +systemctl enable sonarqube.service +#systemctl start sonarqube.service +#systemctl status -l sonarqube.service +apt-get install nginx -y +rm -rf /etc/nginx/sites-enabled/default +rm -rf /etc/nginx/sites-available/default +cat < /etc/nginx/sites-available/sonarqube +server{ + listen 80; + server_name sonarqube.groophy.in; + + access_log /var/log/nginx/sonar.access.log; + error_log /var/log/nginx/sonar.error.log; + + proxy_buffers 16 64k; + proxy_buffer_size 128k; + + location / { + proxy_pass http://127.0.0.1:9000; + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; + proxy_redirect off; + + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto http; + } +} +EOT +ln -s /etc/nginx/sites-available/sonarqube /etc/nginx/sites-enabled/sonarqube +systemctl enable nginx.service +#systemctl restart nginx.service +sudo ufw allow 80,9000,9001/tcp + +echo "System reboot in 30 sec" +sleep 30 +reboot From 1dc4db65f882750c0ba4a7b50d7563e9a75a1b0a Mon Sep 17 00:00:00 2001 From: hkhcoder <137309866+hkhcoder@users.noreply.github.com> Date: Sat, 1 Jul 2023 14:01:42 +0530 Subject: [PATCH 02/19] Update nexus-setup.sh --- userdata/nexus-setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/userdata/nexus-setup.sh b/userdata/nexus-setup.sh index f3fadecc6..4d0c48fc4 100644 --- a/userdata/nexus-setup.sh +++ b/userdata/nexus-setup.sh @@ -5,10 +5,13 @@ mkdir -p /tmp/nexus/ cd /tmp/nexus/ NEXUSURL="https://download.sonatype.com/nexus/3/latest-unix.tar.gz" wget $NEXUSURL -O nexus.tar.gz +sleep 10 EXTOUT=`tar xzvf nexus.tar.gz` NEXUSDIR=`echo $EXTOUT | cut -d '/' -f1` +sleep 5 rm -rf /tmp/nexus/nexus.tar.gz -rsync -avzh /tmp/nexus/ /opt/nexus/ +cp -r /tmp/nexus/* /opt/nexus/ +sleep 5 useradd nexus chown -R nexus.nexus /opt/nexus cat <> /etc/systemd/system/nexus.service From c757e03a6292fc2ff8a457e59ab482c31dc8ce7b Mon Sep 17 00:00:00 2001 From: hkhcoder <137309866+hkhcoder@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:04:18 +0400 Subject: [PATCH 03/19] Update pom.xml --- pom.xml | 139 ++++++++++++++++++++------------------------------------ 1 file changed, 49 insertions(+), 90 deletions(-) diff --git a/pom.xml b/pom.xml index 03bba333b..b67647827 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 1.8.2.RELEASE 4.3.11.Final 5.2.1.Final - 8.0.32 + 5.1.36 1.4 1.2 4.10 @@ -28,13 +28,13 @@ spring-web ${spring.version} - + org.springframework spring-webmvc ${spring.version} - + org.springframework.security spring-security-web @@ -90,82 +90,36 @@ test - org.mockito - mockito-core - 1.9.5 - test - - - org.springframework - spring-test - 3.2.3.RELEASE - test - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - + org.mockito + mockito-core + 1.9.5 + test + + + org.springframework + spring-test + 3.2.3.RELEASE + test + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + ch.qos.logback logback-classic ${logback.version} - org.hamcrest - hamcrest-all - 1.3 - test - - - commons-fileupload - commons-fileupload - 1.3.1 - - - - net.spy - spymemcached - 2.12.3 - - - commons-io - commons-io - 2.4 - - - - org.springframework.amqp - spring-rabbit - 1.7.1.RELEASE - - - - com.rabbitmq - amqp-client - 4.0.2 - - - - org.elasticsearch - elasticsearch - 5.6.4 - - - - org.elasticsearch.client - transport - 5.6.4 - - - - com.google.code.gson - gson - 2.8.2 + org.hamcrest + hamcrest-all + 1.3 + test - + org.eclipse.jetty @@ -179,7 +133,7 @@ - + org.apache.maven.plugins maven-war-plugin 3.2.2 @@ -188,24 +142,29 @@ org.jacoco jacoco-maven-plugin 0.8.4 - - - jacoco-initialize - process-resources - - prepare-agent - - - - jacoco-site - post-integration-test - - report - - - - - + + + jacoco-initialize + process-resources + + prepare-agent + + + + jacoco-site + post-integration-test + + report + + + + + + + ${NEXUS-GRP-REPO} + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + + From d98cb9e3134bfbb592b098b5d39294d25b6f9ce7 Mon Sep 17 00:00:00 2001 From: hkhcoder <137309866+hkhcoder@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:04:50 +0400 Subject: [PATCH 04/19] Create settings.xml --- settings.xml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 settings.xml diff --git a/settings.xml b/settings.xml new file mode 100644 index 000000000..eb788f017 --- /dev/null +++ b/settings.xml @@ -0,0 +1,38 @@ + + + + + + ${SNAP-REPO} + ${NEXUS-USER} + ${NEXUS-PASS} + + + ${RELEASE-REPO} + ${NEXUS-USER} + ${NEXUS-PASS} + + + ${CENTRAL-REPO} + ${NEXUS-USER} + ${NEXUS-PASS} + + + ${NEXUS-GRP-REPO} + ${NEXUS-USER} + ${NEXUS-PASS} + + + + + + ${CENTRAL-REPO} + ${CENTRAL-REPO} + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + * + + + + From 0f8fd84d4485c574035f576740403ec3405d1a87 Mon Sep 17 00:00:00 2001 From: hkhcoder <137309866+hkhcoder@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:31:14 +0400 Subject: [PATCH 05/19] Update pom.xml --- pom.xml | 135 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 44 deletions(-) diff --git a/pom.xml b/pom.xml index b67647827..b9640ea63 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 1.8.2.RELEASE 4.3.11.Final 5.2.1.Final - 5.1.36 + 8.0.22 1.4 1.2 4.10 @@ -28,13 +28,13 @@ spring-web ${spring.version} - + org.springframework spring-webmvc ${spring.version} - + org.springframework.security spring-security-web @@ -90,36 +90,82 @@ test - org.mockito - mockito-core - 1.9.5 - test - - - org.springframework - spring-test - 3.2.3.RELEASE - test - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - + org.mockito + mockito-core + 1.9.5 + test + + + org.springframework + spring-test + 3.2.3.RELEASE + test + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + ch.qos.logback logback-classic ${logback.version} - org.hamcrest - hamcrest-all - 1.3 - test + org.hamcrest + hamcrest-all + 1.3 + test + + + commons-fileupload + commons-fileupload + 1.3.1 + + + + net.spy + spymemcached + 2.12.3 + + + commons-io + commons-io + 2.4 + + + + org.springframework.amqp + spring-rabbit + 1.7.1.RELEASE + + + + com.rabbitmq + amqp-client + 4.0.2 + + + + org.elasticsearch + elasticsearch + 5.6.4 + + + + org.elasticsearch.client + transport + 5.6.4 + + + + com.google.code.gson + gson + 2.8.2 - + org.eclipse.jetty @@ -133,7 +179,7 @@ - + org.apache.maven.plugins maven-war-plugin 3.2.2 @@ -142,29 +188,30 @@ org.jacoco jacoco-maven-plugin 0.8.4 - - - jacoco-initialize - process-resources - - prepare-agent - - - - jacoco-site - post-integration-test - - report - - - - + + + jacoco-initialize + process-resources + + prepare-agent + + + + jacoco-site + post-integration-test + + report + + + + + ${NEXUS-GRP-REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ From cd1439122336b16de4c89c81a704474975deac76 Mon Sep 17 00:00:00 2001 From: hkhcoder <137309866+hkhcoder@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:31:33 +0400 Subject: [PATCH 06/19] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b9640ea63..9579838c0 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ ${NEXUS-GRP-REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ From fd5ce3dae5d06cb9dc89fdd5cae46346977afccb Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Wed, 31 Jan 2024 17:34:26 -0500 Subject: [PATCH 07/19] preparing cicd branch --- Docker-files/app/Dockerfile | 11 +++ Docker-files/app/multistage/Dockerfile | 13 +++ Docker-files/d.txt | 0 Docker-files/db/Dockerfile | 9 ++ Docker-files/db/db_backup.sql | 121 ++++++++++++++++++++++++ Docker-files/web/Dockerfile | 6 ++ Docker-files/web/nginvproapp.conf | 9 ++ Jenkinsfile => prodpipeline/Jenkinsfile | 0 stagepipeline/Jenkinsfile | 121 ++++++++++++++++++++++++ 9 files changed, 290 insertions(+) create mode 100644 Docker-files/app/Dockerfile create mode 100644 Docker-files/app/multistage/Dockerfile create mode 100644 Docker-files/d.txt create mode 100644 Docker-files/db/Dockerfile create mode 100644 Docker-files/db/db_backup.sql create mode 100644 Docker-files/web/Dockerfile create mode 100644 Docker-files/web/nginvproapp.conf rename Jenkinsfile => prodpipeline/Jenkinsfile (100%) create mode 100644 stagepipeline/Jenkinsfile diff --git a/Docker-files/app/Dockerfile b/Docker-files/app/Dockerfile new file mode 100644 index 000000000..22b8aa8b1 --- /dev/null +++ b/Docker-files/app/Dockerfile @@ -0,0 +1,11 @@ +FROM tomcat:8-jre11 +LABEL "Project"="Vprofile" +LABEL "Author"="Imran" + +RUN rm -rf /usr/local/tomcat/webapps/* +COPY target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war + +EXPOSE 8080 +CMD ["catalina.sh", "run"] +WORKDIR /usr/local/tomcat/ +VOLUME /usr/local/tomcat/webapps \ No newline at end of file diff --git a/Docker-files/app/multistage/Dockerfile b/Docker-files/app/multistage/Dockerfile new file mode 100644 index 000000000..4163bed27 --- /dev/null +++ b/Docker-files/app/multistage/Dockerfile @@ -0,0 +1,13 @@ +FROM openjdk:11 AS BUILD_IMAGE +RUN apt update && apt install maven -y +RUN git clone https://github.com/devopshydclub/vprofile-project.git +RUN cd vprofile-project && git checkout docker && mvn install + +FROM tomcat:9-jre11 + +RUN rm -rf /usr/local/tomcat/webapps/* + +COPY --from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war + +EXPOSE 8080 +CMD ["catalina.sh", "run"] diff --git a/Docker-files/d.txt b/Docker-files/d.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Docker-files/db/Dockerfile b/Docker-files/db/Dockerfile new file mode 100644 index 000000000..120a5b8cd --- /dev/null +++ b/Docker-files/db/Dockerfile @@ -0,0 +1,9 @@ +FROM mysql:8.0.33 +LABEL "Project"="Vprofile" +LABEL "Author"="Imran" + +ENV MYSQL_ROOT_PASSWORD="vprodbpass" +ENV MYSQL_DATABASE="accounts" + + +ADD db_backup.sql docker-entrypoint-initdb.d/db_backup.sql diff --git a/Docker-files/db/db_backup.sql b/Docker-files/db/db_backup.sql new file mode 100644 index 000000000..bdb779d23 --- /dev/null +++ b/Docker-files/db/db_backup.sql @@ -0,0 +1,121 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64) +-- +-- Host: localhost Database: accounts +-- ------------------------------------------------------ +-- Server version 5.7.18-0ubuntu0.16.10.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `role` +-- + +DROP TABLE IF EXISTS `role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `role` +-- + +LOCK TABLES `role` WRITE; +/*!40000 ALTER TABLE `role` DISABLE KEYS */; +INSERT INTO `role` VALUES (1,'ROLE_USER'); +/*!40000 ALTER TABLE `role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) DEFAULT NULL, + `userEmail` varchar(255) DEFAULT NULL, + `profileImg` varchar(255) DEFAULT NULL, + `profileImgPath` varchar(255) DEFAULT NULL, + `dateOfBirth` varchar(255) DEFAULT NULL, + `fatherName` varchar(255) DEFAULT NULL, + `motherName` varchar(255) DEFAULT NULL, + `gender` varchar(255) DEFAULT NULL, + `maritalStatus` varchar(255) DEFAULT NULL, + `permanentAddress` varchar(255) DEFAULT NULL, + `tempAddress` varchar(255) DEFAULT NULL, + `primaryOccupation` varchar(255) DEFAULT NULL, + `secondaryOccupation` varchar(255) DEFAULT NULL, + `skills` varchar(255) DEFAULT NULL, + `phoneNumber` varchar(255) DEFAULT NULL, + `secondaryPhoneNumber` varchar(255) DEFAULT NULL, + `nationality` varchar(255) DEFAULT NULL, + `language` varchar(255) DEFAULT NULL, + `workingExperience` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (7,'admin_vp','admin@visualpathit.com',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'$2a$11$0a7VdTr4rfCQqtsvpng6GuJnzUmQ7gZiHXgzGPgm5hkRa3avXgBLK'),(8,'WahidKhan','wahid.khan74@gmail.com',NULL,NULL,'28/03/1994','M Khan','R Khan','male','unMarried','Ameerpet,Hyderabad','Ameerpet,Hyderabad','Software Engineer','Software Engineer','Java HTML CSS ','8888888888','8888888888','Indian','english','2 ','$2a$11$UgG9TkHcgl02LxlqxRHYhOf7Xv4CxFmFEgS0FpUdk42OeslI.6JAW'),(9,'Gayatri','gayatri@gmail.com',NULL,NULL,'20/06/1993','K','L','male','unMarried','Ameerpet,Hyderabad','Ameerpet,Hyderabad','Software Engineer','Software Engineer','Java HTML CSS ','9999999999','9999999999','India','english','5','$2a$11$gwvsvUrFU.YirMM1Yb7NweFudLUM91AzH5BDFnhkNzfzpjG.FplYO'),(10,'WahidKhan2','wahid.khan741@gmail.com',NULL,NULL,'28/03/1994','M Khan','R Khan','male','unMarried','Ameerpet,Hyderabad','Ameerpet,Hyderabad','Software Engineer','Software Engineer','Java HTML CSS ','7777777777','777777777','India','english','7','$2a$11$6oZEgfGGQAH23EaXLVZ2WOSKxcEJFnBSw2N2aghab0s2kcxSQwjhC'),(11,'KiranKumar','kiran@gmail.com',NULL,NULL,'8/12/1993','K K','RK','male','unMarried','California','James Street','Software Engineer','Software Engineer','Java HTML CSS ','1010101010','1010101010','India','english','10','$2a$11$EXwpna1MlFFlKW5ut1iVi.AoeIulkPPmcOHFO8pOoQt1IYU9COU0m'),(12,'Saikumar','sai@gmail.com',NULL,NULL,'20/06/1993','Sai RK','Sai AK','male','unMarried','California','US','Software Engineer','Software Engineer','Java HTML CSS AWS','8888888111','8888888111','India','english','8','$2a$11$pzWNzzR.HUkHzz2zhAgqOeCl0WaTgY33NxxJ7n0l.rnEqjB9JO7vy'),(13,'RamSai','ram@gmail.com',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'$2a$11$6BSmYPrT8I8b9yHmx.uTRu/QxnQM2vhZYQa8mR33aReWA4WFihyGK'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_role` +-- + +DROP TABLE IF EXISTS `user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_role` ( + `user_id` int(11) NOT NULL, + `role_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`role_id`), + KEY `fk_user_role_roleid_idx` (`role_id`), + CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_role` +-- + +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-12-07 16:32:31 diff --git a/Docker-files/web/Dockerfile b/Docker-files/web/Dockerfile new file mode 100644 index 000000000..99d468509 --- /dev/null +++ b/Docker-files/web/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx +LABEL "Project"="Vprofile" +LABEL "Author"="Imran" + +RUN rm -rf /etc/nginx/conf.d/default.conf +COPY nginvproapp.conf /etc/nginx/conf.d/vproapp.conf \ No newline at end of file diff --git a/Docker-files/web/nginvproapp.conf b/Docker-files/web/nginvproapp.conf new file mode 100644 index 000000000..ab3a503e4 --- /dev/null +++ b/Docker-files/web/nginvproapp.conf @@ -0,0 +1,9 @@ +upstream vproapp { + server vproapp:8080; +} +server { + listen 80; +location / { + proxy_pass http://vproapp; +} +} \ No newline at end of file diff --git a/Jenkinsfile b/prodpipeline/Jenkinsfile similarity index 100% rename from Jenkinsfile rename to prodpipeline/Jenkinsfile diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile new file mode 100644 index 000000000..969d00c6e --- /dev/null +++ b/stagepipeline/Jenkinsfile @@ -0,0 +1,121 @@ +pipeline { + + agent any +/* + tools { + maven "maven3" + } +*/ + environment { + NEXUS_VERSION = "nexus3" + NEXUS_PROTOCOL = "http" + NEXUS_URL = "172.31.40.209:8081" + NEXUS_REPOSITORY = "vprofile-release" + NEXUS_REPOGRP_ID = "vprofile-grp-repo" + NEXUS_CREDENTIAL_ID = "nexuslogin" + ARTVERSION = "${env.BUILD_ID}" + } + + stages{ + + stage('BUILD'){ + steps { + sh 'mvn clean install -DskipTests' + } + post { + success { + echo 'Now Archiving...' + archiveArtifacts artifacts: '**/target/*.war' + } + } + } + + stage('UNIT TEST'){ + steps { + sh 'mvn test' + } + } + + stage('INTEGRATION TEST'){ + steps { + sh 'mvn verify -DskipUnitTests' + } + } + + stage ('CODE ANALYSIS WITH CHECKSTYLE'){ + steps { + sh 'mvn checkstyle:checkstyle' + } + post { + success { + echo 'Generated Analysis Result' + } + } + } + + stage('CODE ANALYSIS with SONARQUBE') { + + environment { + scannerHome = tool 'sonarscanner4' + } + + steps { + withSonarQubeEnv('sonar-pro') { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile-repo \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } + + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } + } + + stage("Publish to Nexus Repository Manager") { + steps { + script { + pom = readMavenPom file: "pom.xml"; + filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); + echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" + artifactPath = filesByGlob[0].path; + artifactExists = fileExists artifactPath; + if(artifactExists) { + echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: NEXUS_REPOGRP_ID, + version: ARTVERSION, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, + classifier: '', + file: artifactPath, + type: pom.packaging], + [artifactId: pom.artifactId, + classifier: '', + file: "pom.xml", + type: "pom"] + ] + ); + } + else { + error "*** File: ${artifactPath}, could not be found"; + } + } + } + } + + + } + + +} From 86fff5fd0f128cee59d40584a8aad53ee344b69e Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 18:44:10 -0500 Subject: [PATCH 08/19] Docker Build & Deploy --- .gitignore | 1 + stagepipeline/Jenkinsfile | 174 ++++++++++++++++++++------------------ 2 files changed, 91 insertions(+), 84 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c41cc9e35 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target \ No newline at end of file diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 969d00c6e..464133dd7 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -1,121 +1,127 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] pipeline { - - agent any -/* - tools { - maven "maven3" + agent any + tools { + maven "MAVEN3" + jdk "OracleJDK8" } -*/ + environment { - NEXUS_VERSION = "nexus3" - NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.40.209:8081" - NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPOGRP_ID = "vprofile-grp-repo" - NEXUS_CREDENTIAL_ID = "nexuslogin" - ARTVERSION = "${env.BUILD_ID}" + SNAP_REPO = 'vprofile-snapshot' + NEXUS_USER = 'admin' + NEXUS_PASS = 'admin1@3' + RELEASE_REPO = 'vprofile-release' + CENTRAL_REPO = 'vpro-maven-central' + NEXUSIP = '172.31.81.192' + NEXUSPORT = '8081' + NEXUS_GRP_REPO = 'vpro-maven-group' + NEXUS_LOGIN = 'nexuslogin' + SONARSERVER = 'sonarserver' + SONARSCANNER = 'sonarscanner' + registryCredential = 'ecr:us-east-1:awscreds' + appRegistry = '622338112572.dkr.ecr.us-east-1.amazonaws.com/vprofileappimg' + vprofileRegistry = '622338112572.dkr.ecr.us-east-1.amazonaws.com' } - - stages{ - - stage('BUILD'){ + + stages { + stage('Build ') { steps { - sh 'mvn clean install -DskipTests' + sh 'mvn -s settings.xml -DskipTests install' } post { success { - echo 'Now Archiving...' - archiveArtifacts artifacts: '**/target/*.war' + echo 'Now Archiving the artifacts' + archiveArtifacts artifacts: '**/*.war' } } } - stage('UNIT TEST'){ + stage('Test it') { steps { - sh 'mvn test' + sh 'mvn -s settings.xml test' } } - stage('INTEGRATION TEST'){ + stage('Checkstyle Analysis'){ steps { - sh 'mvn verify -DskipUnitTests' + sh 'mvn -s settings.xml checkstyle:checkstyle' } } - - stage ('CODE ANALYSIS WITH CHECKSTYLE'){ - steps { - sh 'mvn checkstyle:checkstyle' + + stage('Sonar Analysis'){ + environment { + scannerHome = tool "${SONARSCANNER}" } - post { - success { - echo 'Generated Analysis Result' + steps { + withSonarQubeEnv("${SONARSERVER}") { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile-repo \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' } } } - stage('CODE ANALYSIS with SONARQUBE') { - - environment { - scannerHome = tool 'sonarscanner4' - } - - steps { - withSonarQubeEnv('sonar-pro') { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile-repo \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.sources=src/ \ - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ - -Dsonar.junit.reportsPath=target/surefire-reports/ \ - -Dsonar.jacoco.reportsPath=target/jacoco.exec \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + stage("Quality Gate") { + steps { + timeout(time: 1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } } + } - timeout(time: 10, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true + stage('Upload Artifacts') { + steps { + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUSIP}:${NEXUSPORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + //artifact from workspace + [artifactId: 'vproapp', classifier: '', file: 'target/vprofile-v2.war', type: 'war'] + ] + ) } - } } - stage("Publish to Nexus Repository Manager") { + stage ('Docker Build') { steps { script { - pom = readMavenPom file: "pom.xml"; - filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); - echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - if(artifactExists) { - echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: NEXUS_REPOGRP_ID, - version: ARTVERSION, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ); - } - else { - error "*** File: ${artifactPath}, could not be found"; - } + def app = docker.build("${appRegistry}:${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", "./Docker-files/app/multistage/") + app.push() } } } - + stage ('Docker Push') { + steps { + script { + docker.withRegistry(vprofileRegistry, registryCredential) { + dockerImage.push("${env.BUILD_ID}-${env.BUILD_TIMESTAMP}") + dockerImage.push("latest") + } + } + } } - -} + post { + always { + echo 'Slack Notifications.' + slackSend channel: '#jenkinscicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "Build Number: ${env.BUILD_NUMBER} \n Build Status: ${currentBuild.currentResult} \n Build URL: ${env.BUILD_URL} \n Build Logs: ${env.BUILD_URL}console" + } + + } +} \ No newline at end of file From faacf9e7c0ece45aefa0a76b0d702290214f1d5f Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 18:48:04 -0500 Subject: [PATCH 09/19] syntax error --- stagepipeline/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 464133dd7..e98d21bc2 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -110,6 +110,7 @@ pipeline { docker.withRegistry(vprofileRegistry, registryCredential) { dockerImage.push("${env.BUILD_ID}-${env.BUILD_TIMESTAMP}") dockerImage.push("latest") + } } } } From 22e2c334c5d30d99513e3d5b8565a6edd66682d0 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 18:52:40 -0500 Subject: [PATCH 10/19] settings fix --- settings.xml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/settings.xml b/settings.xml index eb788f017..8e11c6e8c 100644 --- a/settings.xml +++ b/settings.xml @@ -5,32 +5,32 @@ - ${SNAP-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${SNAP_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${RELEASE-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${RELEASE_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${CENTRAL-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${CENTRAL_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${NEXUS-GRP-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${NEXUS_GRP_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${CENTRAL-REPO} - ${CENTRAL-REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + ${CENTRAL_REPO} + ${CENTRAL_REPO} + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ * From 82b949db7588f8108707825898a061d457287c29 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 19:01:04 -0500 Subject: [PATCH 11/19] name fix --- stagepipeline/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index e98d21bc2..0abc1e977 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -98,7 +98,7 @@ pipeline { stage ('Docker Build') { steps { script { - def app = docker.build("${appRegistry}:${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", "./Docker-files/app/multistage/") + def app = docker.build("${appRegistry}.${env.BUILD_ID}.${env.BUILD_TIMESTAMP}", "./Docker-files/app/multistage/") app.push() } } @@ -108,7 +108,7 @@ pipeline { steps { script { docker.withRegistry(vprofileRegistry, registryCredential) { - dockerImage.push("${env.BUILD_ID}-${env.BUILD_TIMESTAMP}") + dockerImage.push("${env.BUILD_ID}.${env.BUILD_TIMESTAMP}") dockerImage.push("latest") } } From c1c571d75efe0f672c157a545080b544cfaa8c58 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 19:07:53 -0500 Subject: [PATCH 12/19] remove timestamp due to naming issue from build name. --- stagepipeline/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 0abc1e977..6327b28cd 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -98,7 +98,7 @@ pipeline { stage ('Docker Build') { steps { script { - def app = docker.build("${appRegistry}.${env.BUILD_ID}.${env.BUILD_TIMESTAMP}", "./Docker-files/app/multistage/") + def app = docker.build("${appRegistry}.${env.BUILD_ID}", "./Docker-files/app/multistage/") app.push() } } @@ -108,7 +108,7 @@ pipeline { steps { script { docker.withRegistry(vprofileRegistry, registryCredential) { - dockerImage.push("${env.BUILD_ID}.${env.BUILD_TIMESTAMP}") + dockerImage.push("${env.BUILD_ID}") dockerImage.push("latest") } } From 832f86eafc466675b28a4805c5713b215c909a49 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 19:48:38 -0500 Subject: [PATCH 13/19] bug fix --- stagepipeline/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 6327b28cd..7d9787560 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -98,8 +98,7 @@ pipeline { stage ('Docker Build') { steps { script { - def app = docker.build("${appRegistry}.${env.BUILD_ID}", "./Docker-files/app/multistage/") - app.push() + dockerImage = docker.build("${appRegistry}.${env.BUILD_ID}", "./Docker-files/app/multistage/") } } } From bdfeb52f0c36e696b6b1ba204ed6d7edeb94b3b0 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 19:52:17 -0500 Subject: [PATCH 14/19] url fix --- stagepipeline/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 7d9787560..71733de2c 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -23,7 +23,7 @@ pipeline { SONARSCANNER = 'sonarscanner' registryCredential = 'ecr:us-east-1:awscreds' appRegistry = '622338112572.dkr.ecr.us-east-1.amazonaws.com/vprofileappimg' - vprofileRegistry = '622338112572.dkr.ecr.us-east-1.amazonaws.com' + vprofileRegistry = 'https://622338112572.dkr.ecr.us-east-1.amazonaws.com' } stages { From 24a6dcfabf96bc8c0f93858cb23d635af4bbbf21 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Thu, 1 Feb 2024 20:00:36 -0500 Subject: [PATCH 15/19] fix --- stagepipeline/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 71733de2c..4f82e2cdd 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -98,7 +98,7 @@ pipeline { stage ('Docker Build') { steps { script { - dockerImage = docker.build("${appRegistry}.${env.BUILD_ID}", "./Docker-files/app/multistage/") + dockerImage = docker.build("${appRegistry}:${env.BUILD_ID}", "./Docker-files/app/multistage/") } } } From edd58957fcb9858d2d347f5944c2080e0557f32d Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Fri, 2 Feb 2024 17:52:19 -0500 Subject: [PATCH 16/19] add stage deploy to ecs staging --- stagepipeline/Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 4f82e2cdd..669b7b54d 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -24,6 +24,8 @@ pipeline { registryCredential = 'ecr:us-east-1:awscreds' appRegistry = '622338112572.dkr.ecr.us-east-1.amazonaws.com/vprofileappimg' vprofileRegistry = 'https://622338112572.dkr.ecr.us-east-1.amazonaws.com' + cluster = "vprofilestaging" + service = "vprofilestagingsvc" } stages { @@ -113,6 +115,15 @@ pipeline { } } } + + stage ('Deploy to ECS staging environment') { + steps { + script { + withAWS(crendetials: 'awscreds', region: 'us-east-1'){ + sh 'aws ecs update-service --cluster $cluster --service $service --force-new-deployment' + } + } + } } post { From bcf8b1543719cf7d3c38fc00ed356faa8b4808ce Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Fri, 2 Feb 2024 17:53:39 -0500 Subject: [PATCH 17/19] syntax error --- stagepipeline/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index 669b7b54d..d27bf4162 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -124,8 +124,8 @@ pipeline { } } } + } } - post { always { echo 'Slack Notifications.' From cf0ef59a6589f778f5ad6e2286332705cd2f64a0 Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Fri, 2 Feb 2024 17:59:46 -0500 Subject: [PATCH 18/19] spelling mistake --- stagepipeline/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stagepipeline/Jenkinsfile b/stagepipeline/Jenkinsfile index d27bf4162..79bad64d5 100644 --- a/stagepipeline/Jenkinsfile +++ b/stagepipeline/Jenkinsfile @@ -119,7 +119,7 @@ pipeline { stage ('Deploy to ECS staging environment') { steps { script { - withAWS(crendetials: 'awscreds', region: 'us-east-1'){ + withAWS(credentials: 'awscreds', region: 'us-east-1'){ sh 'aws ecs update-service --cluster $cluster --service $service --force-new-deployment' } } From 2e29e33583fbef3c77a28777e1869ffc93a6b2ca Mon Sep 17 00:00:00 2001 From: arsalansaleem94 Date: Fri, 2 Feb 2024 19:07:45 -0500 Subject: [PATCH 19/19] test cicd 1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 88fd3cbba..e7ad8d0a2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Prerequisites -# +# ## - JDK 11 - Maven 3 - MySQL 8