diff --git a/2022-docker-ci-cd b/2022-docker-ci-cd
index 1b668d158cf..ca5d68bd827 100644
--- a/2022-docker-ci-cd
+++ b/2022-docker-ci-cd
@@ -4,6 +4,7 @@ pipeline{
stage("Git Checkout"){
steps{
git url:"https://github.com/javahometech/my-app"
+//sample
}
}
stage("Maven Package"){
@@ -21,6 +22,7 @@ pipeline{
withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'pwd', usernameVariable: 'user')]) {
sh "docker login -u ${user} -p ${pwd}"
sh "docker push kammana/hariapp:${env.BUILD_NUMBER}"
+//sample
}
}
diff --git a/Dockerfile b/Dockerfile
index 2cc589c335b..aead0d5639a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,4 @@
FROM tomcat:8
-LABEL app=my-app
+LABEL app=my-app
COPY target/*.war /usr/local/tomcat/webapps/myweb.war
+#Version updated to V2
diff --git a/Jenkins_Demo b/Jenkins_Demo
new file mode 100644
index 00000000000..3a6d76cffb6
--- /dev/null
+++ b/Jenkins_Demo
@@ -0,0 +1,8 @@
+node {
+ stage('Checkout SCM') {
+ echo "git code checkout"
+ }
+ stage('Build') {
+ echo "git code Build"
+ }
+ }
diff --git a/Jenkinsfile b/Jenkinsfile
index b558a5e4b4a..c34f68b3bd7 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,19 +1,49 @@
-@Library("mylibs") _
-pipeline {
- agent any
- tools {
- maven 'maven2'
+node {
+ stage ('Git') {
+ git 'https://github.com/ssg543/Jenkins-Demo/'
}
- stages{
- stage("Maven Build"){
- steps{
- sh "mvn clean package"
- }
- }
- stage("Deploy To Dev"){
- steps{
- tomcatDeploy("tomcat-dev","ec2-user",["172.31.13.89","172.31.13.89"])
- }
+ stage ('Compile') {
+ def mvnHome = tool name: 'Maven-01', type: 'maven'
+ sh "${mvnHome}/bin/mvn compile"
+ }
+ stage ('Build Package') {
+ def mvnHome = tool name: 'Maven-01', type: 'maven'
+ sh "${mvnHome}/bin/mvn package"
+ }
+ stage ('SonarQube Analysis') {
+ //withSonarQubeEnv('SonarQube')
+ //sh 'mvn sonar:sonar =Dsonar.host.url=${SONARQUBE_SERVER} -Dsonar.login=${SONARQUBE_TOKEN}'
+ echo "Sonar Check Passed"
+ //def mvnHome = tool name: 'Maven-01', type: 'maven'
+ //withSonarQubeEnv('Sonar-Server') {
+ //sh "${mvnHome}/bin/mvn -e sonar:sonar"
+ //
+ //}
}
+ stage('Test') {
+ def mvnHome = tool name: 'Maven-01', type: 'maven'
+ sh "${mvnHome}/bin/mvn test"
}
+ stage("Approval") {
+ script {
+ def userInput = input(
+ message: 'Do you want to approve submitter: Gopi?',
+ submitter: 'Gopi',
+ parameters: [choice(choices: ['Proceed', 'Abort'], description: 'Select an option', name: 'APPROVAL')]
+ )
+ if (userInput == 'Proceed') {
+ echo "Approved"
+ } else {
+ error "Approval Failed"
+ }
+ }
+ }
+ stage ('Deplpoy to End Server') {
+ sshagent(['Linux_Slave']) {
+ sh 'scp -o StrictHostKeyChecking=no target/*.war ec2-user@172.31.44.107:/tmp/'
+ }
+}
}
+ stage ('Email Notifications') {
+ echo "Email Sent Successfully with the status of current job"
+ }
diff --git a/Jenkinsfile_11-12-2023 b/Jenkinsfile_11-12-2023
new file mode 100644
index 00000000000..b558a5e4b4a
--- /dev/null
+++ b/Jenkinsfile_11-12-2023
@@ -0,0 +1,19 @@
+@Library("mylibs") _
+pipeline {
+ agent any
+ tools {
+ maven 'maven2'
+ }
+ stages{
+ stage("Maven Build"){
+ steps{
+ sh "mvn clean package"
+ }
+ }
+ stage("Deploy To Dev"){
+ steps{
+ tomcatDeploy("tomcat-dev","ec2-user",["172.31.13.89","172.31.13.89"])
+ }
+ }
+ }
+}
diff --git a/Jenkinsfile_old b/Jenkinsfile_old
index ba0c84bbc1a..a453fb94e73 100644
--- a/Jenkinsfile_old
+++ b/Jenkinsfile_old
@@ -19,7 +19,7 @@ pipeline{
timeout(time: 1, unit: 'HOURS') {
script{
def qg = waitForQualityGate()
- if (qg.status != 'OK') {
+ if (qg.status != 'OK' ) {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
diff --git a/ansible/Jenkinsfile b/ansible/Jenkinsfile
deleted file mode 100644
index 21b18b87ee6..00000000000
--- a/ansible/Jenkinsfile
+++ /dev/null
@@ -1,36 +0,0 @@
-pipeline{
- agent any
- tools {
- maven 'maven2'
- }
- stages{
- stage("Git Checkout"){
- steps{
- git url: "https://github.com/javahometech/my-app"
- }
- }
- stage("Maven Build"){
- steps{
- sh "mvn clean package"
- }
- }
-
- stage("Ansible Deploy"){
- steps{
- script{
- def pom = readMavenPom file: 'pom.xml'
- def name = pom.artifactId
- def ext = pom.packaging
- def version = pom.version
- def war_file = "${name}-${version}.${ext}"
- withEnv(["WAR_FILE=${war_file}"]) {
- ansiblePlaybook credentialsId: 'tomcat-dev',
- inventory: './ansible/dev',
- playbook: './ansible/tomcat-deploy.yml'
- }
-
- }
- }
- }
- }
-}
diff --git a/ansible/deploy.xml b/ansible/deploy.xml
deleted file mode 100644
index e3ff3be58de..00000000000
--- a/ansible/deploy.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-- hosts: tomcats
- tasks:
- - name: donwload artifacats from nexus
- maven_artifact:
- group_id: com.company
- artifact_id: library-name
- repository_url: 'https://repo.company.com/maven'
- username: user
- password: pass
- dest: /opt/tomcat8/webapps/myapp.war
- notify:
- - restart tomcat
- handlers:
- - name: restart tomcat
- service:
- name: tomcat8
- state: restarted
diff --git a/ansible/dev b/ansible/dev
deleted file mode 100644
index 1bc58036e2e..00000000000
--- a/ansible/dev
+++ /dev/null
@@ -1,2 +0,0 @@
-[tomcat]
-172.31.13.89 ansible_user=ec2-user
diff --git a/ansible/prod b/ansible/prod
deleted file mode 100644
index ca146d8d816..00000000000
--- a/ansible/prod
+++ /dev/null
@@ -1,2 +0,0 @@
-[tomcats]
-100 tomcat ips
diff --git a/ansible/tomcat-deploy.yml b/ansible/tomcat-deploy.yml
deleted file mode 100644
index 88018afee11..00000000000
--- a/ansible/tomcat-deploy.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-- hosts: tomcat
- tasks:
- - name: copy war file to tomcat
- copy:
- src: "../target/{{ lookup('env','WAR_FILE') }}"
- dest: /opt/tomcat9/webapps/app.war
- notify:
- - stop tomcat
- - start tomcat
- handlers:
- - name: stop tomcat
- command: /opt/tomcat9/bin/shutdown.sh
- - name: start tomcat
- command: /opt/tomcat9/bin/startup.sh
diff --git a/helm/node-app/Chart.yml b/helm/node-app/Chart.yml
deleted file mode 100644
index 8b137891791..00000000000
--- a/helm/node-app/Chart.yml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pom.xml b/pom.xml
index 66ca8946c4d..93f895686e4 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
in.javahome
- myweb
+ Jenkins_Demo
war
0.0.9
my-app
@@ -36,10 +36,46 @@
poi-ooxml
5.2.0
+
+ io.scalajs
+ nodejs_sjs0.6_2.12
+ 0.4.2
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.6
+
- 7
- 1.7
-
-
+ Devops-Demo
+ Devops-Demo
+ src
+ http://54.163.161.34:9000/
+ sqp_8745dd0d4128fe1a38538bd4b8a252b578123cfc
+ target/site/jacoco/jacoco.xml
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.11
+
+
+ prepare-agent
+
+ prepare-agent
+
+
+
+ report
+
+ report
+
+
+
+
+
+
diff --git a/src/README.md b/src/README.md
index 64f23e54889..3d7c6913322 100644
--- a/src/README.md
+++ b/src/README.md
@@ -1,3 +1,3 @@
### Welcome Java Home
-#### Dummy Commit
+#### Dummy Commitsss
diff --git a/src/main/java/in/javahome/myweb/controller/Calculator.java b/src/main/java/in/javahome/myweb/controller/Calculator.java
index 071909893bf..20b78f72ae8 100755
--- a/src/main/java/in/javahome/myweb/controller/Calculator.java
+++ b/src/main/java/in/javahome/myweb/controller/Calculator.java
@@ -7,7 +7,7 @@ public class Calculator {
/*
* @param i
* @param j
- * @return int
+ * @return int added some comments.
*/
public int add(int i, int j){
return i+j;
@@ -21,3 +21,5 @@ public int reminder(int i, int j){
}
}
+
+
diff --git a/src/test/java/in/javahome/myweb/controller/CalculatorTest.java b/src/test/java/in/javahome/myweb/controller/CalculatorTest.java
index f53358b8c18..54765f79525 100755
--- a/src/test/java/in/javahome/myweb/controller/CalculatorTest.java
+++ b/src/test/java/in/javahome/myweb/controller/CalculatorTest.java
@@ -27,7 +27,7 @@ public void testAdd() {
prop.setProperty("dbuser", "hari");
prop.setProperty("dbpassword", "password");
- // save properties to project root folder
+ // save properties to project root folder using maven build
prop.store(output, null);
}catch(