Skip to content
Open

Dev #10

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
f25a204
Update pom.xml
Oct 28, 2018
64a3f0f
Update pom.xml
Oct 28, 2018
11702be
Update pom.xml
Oct 28, 2018
ff57e3e
Update CalculatorTest.java
Nov 1, 2018
c4a4ba2
Update CalculatorTest.java
Nov 1, 2018
3db8ad5
Update CalculatorTest.java
Nov 1, 2018
c3b4c42
Update CalculatorTest.java
Nov 1, 2018
11c03ce
Create scm_demo
Nov 1, 2018
97496c9
Update scm_demo
Nov 1, 2018
9f7ae76
Update scm_demo
Nov 1, 2018
84c2ce2
Update scm_demo
Nov 1, 2018
6eb6db9
Update scm_demo
Nov 1, 2018
1aefb6f
Update scm_demo
Nov 1, 2018
a024f9f
Update scm_demo
Nov 1, 2018
550e92a
Update scm_demo
Nov 1, 2018
132a654
Update scm_demo
Nov 1, 2018
463302b
Update scm_demo
Nov 1, 2018
34601b2
Update scm_demo
Nov 1, 2018
b66a467
Update scm_demo
Nov 1, 2018
e8ef00c
Update index.html
Nov 2, 2018
fb0f4b6
Update Calculator.java
Nov 2, 2018
0f481a4
Update Calculator.java
Nov 2, 2018
f6a49ac
Update web.xml
Nov 2, 2018
18546cf
Update web.xml
Nov 2, 2018
ddacad1
Update index.html
Nov 6, 2018
6b19cf6
Update index.html
Nov 12, 2018
c71863c
Create nov-2018-7am-devops
Nov 16, 2018
6ecb98e
Update Dockerfile
Nov 18, 2018
e0b3246
Update Jenkinsfile
Nov 18, 2018
ffc6108
Update Dockerfile
Nov 18, 2018
54b4fdc
Update Dockerfile
Nov 18, 2018
2f29e54
Update index.html
Dec 5, 2018
4f4e0e6
Update pom.xml
Dec 5, 2018
50d6579
Create docker-swarm-ci-cd
Dec 5, 2018
8856957
Update pom.xml
Dec 17, 2018
d248623
Update Jenkinsfile
Dec 20, 2018
da17df9
Update Jenkinsfile
Dec 20, 2018
8d77a88
Update Calculator.java
Dec 21, 2018
87558d7
Update function-demo
Jan 16, 2019
6bf0055
Update pom.xml
Jan 16, 2019
3e6bb77
Update deploy-to-tomcat
Jan 19, 2019
0bd79fe
Update index.html
Apr 27, 2019
e0df037
ssh demo
invalid-email-address May 1, 2019
d1b6f4d
Update Jenkinsfile
May 30, 2019
c4c18b9
Update Jenkinsfile
May 30, 2019
a769a8f
Integrating with sonar qube
javahomehari May 30, 2019
70b434b
Merge pull request #33 from javahometech/feature/sonar-integration
May 30, 2019
e5ad45c
Create Chart.yml
Jun 17, 2019
f3c9582
Update index.html
Jun 28, 2019
00bf3bf
Update web.xml
Jun 28, 2019
350d5aa
Update web.xml
Jun 28, 2019
91f2737
Update index.html
Jul 3, 2019
3691faf
Update index.html
Jul 3, 2019
bbb06aa
Update index.html
Jul 4, 2019
5d7665c
Update Calculator.java
Jul 4, 2019
d0e4ed6
Update Calculator.java
Jul 4, 2019
c3f7b02
Update pom.xml
Jul 31, 2019
c764427
Update pom.xml
Jul 31, 2019
b02523a
Update pom.xml
Jul 31, 2019
4038f68
Update pom.xml
Aug 10, 2019
5db9b02
Update Dockerfile
Aug 13, 2019
56819a6
Create 2019-Aug-9:30Am-jenkinsfile
Aug 13, 2019
bda8ae0
Update pom.xml
Aug 15, 2019
6f7824a
Update pom.xml
Aug 15, 2019
67d34ea
Update Dockerfile
srinivas1987devops Sep 18, 2019
22b422f
Update pom.xml
srinivas1987devops Nov 7, 2019
d8795f9
Update index.html
srinivas1987devops Nov 7, 2019
5d6fa07
Update pom.xml
srinivas1987devops Dec 3, 2019
676c914
Update pom.xml
srinivas1987devops Dec 3, 2019
cca6d79
Update pom.xml
srinivas1987devops Dec 3, 2019
94de8d9
Update pom.xml
srinivas1987devops Dec 5, 2019
99a1674
Update pom.xml
srinivas1987devops Dec 20, 2019
9559a76
Update pom.xml
srinivas1987devops Jan 26, 2020
f17f9a0
Update pom.xml
srinivas1987devops Jan 28, 2020
3b94118
Update pom.xml
srinivas1987devops Feb 10, 2020
cee4108
Update pom.xml
srinivas1987devops Feb 20, 2020
acf9de7
Update pom.xml
srinivas1987devops Mar 10, 2020
8832902
Update pom.xml
srinivas1987devops Jul 11, 2020
1dd069a
Update pom.xml
srinivas1987devops Jul 11, 2020
8479645
Update pom.xml
srinivas1987devops Aug 4, 2020
96a349a
Update pom.xml
srinivas1987devops Aug 11, 2020
e65a575
Update pom.xml
srinivas1987devops Aug 17, 2020
ee347a0
Update pom.xml
srinivas1987devops Sep 13, 2020
1eceaeb
Update pom.xml
srinivas1987devops Oct 5, 2020
5b8056b
Update pom.xml
srinivas1987devops Oct 14, 2020
4aad557
Update pom.xml
srinivas1987devops Nov 5, 2020
c12ca2d
Update pom.xml
srinivas1987devops Nov 18, 2020
b9b5287
Update pom.xml
srinivas1987devops Dec 1, 2020
8a8dfde
Update pom.xml
srinivas1987devops Dec 9, 2020
fc885a9
Update pom.xml
srinivas1987devops Dec 26, 2020
2c2421a
Update pom.xml
srinivas1987devops Jan 22, 2021
2149738
Update pom.xml
srinivas1987devops Feb 1, 2021
077b4d2
Update pom.xml
srinivas1987devops Feb 9, 2021
c7d4928
Update pom.xml
srinivas1987devops Feb 23, 2021
7df4737
Update pom.xml
srinivas1987devops Mar 13, 2021
2568a58
Update pom.xml
srinivas1987devops Mar 13, 2021
dcb4916
Update pom.xml
srinivas1987devops Mar 27, 2021
7c61931
Update pom.xml
srinivas1987devops Apr 19, 2021
96154e2
Update pom.xml
srinivas1987devops May 13, 2021
ee91296
Update pom.xml
srinivas1987devops May 16, 2021
32c6d27
Update pom.xml
srinivas1987devops May 25, 2021
df9d4d4
Update pom.xml
srinivas1987devops Jun 11, 2021
8c5574c
Add files via upload
srinivas1987devops Jun 18, 2021
742f058
Update pom.xml
srinivas1987devops Jun 30, 2021
31b232f
Update pom.xml
srinivas1987devops Jul 26, 2021
55be078
Update pom.xml
srinivas1987devops Aug 2, 2021
096d075
Update pom.xml
srinivas1987devops Sep 2, 2021
8d34c65
Update pom.xml
srinivas1987devops Sep 30, 2021
fade58e
Update pom.xml
srinivas1987devops Oct 5, 2021
c4ee71a
Update pom.xml
srinivas1987devops Nov 1, 2021
71f43a6
Update pom.xml
srinivas1987devops Nov 18, 2021
33f0832
Update pom.xml
srinivas1987devops Nov 24, 2021
b549716
Update pom.xml
srinivas1987devops Dec 14, 2021
7e1c18a
Update pom.xml
srinivas1987devops Dec 20, 2021
758efaf
Update pom.xml
srinivas1987devops Jan 5, 2022
3a35c33
Update pom.xml
srinivas1987devops Jan 20, 2022
6ed445c
Update pom.xml
srinivas1987devops Feb 4, 2022
64dfb78
Update pom.xml
srinivas1987devops Feb 21, 2022
1bc3acd
Update pom.xml
srinivas1987devops Mar 7, 2022
456871f
Update pom.xml
srinivas1987devops Mar 28, 2022
e5e466e
Update pom.xml
srinivas1987devops Apr 8, 2022
ac1f917
Update pom.xml
srinivas1987devops Apr 30, 2022
946c5ab
Update pom.xml
srinivas1987devops May 23, 2022
eb80bb3
Update pom.xml
srinivas1987devops Jun 6, 2022
46a5599
Update pom.xml
srinivas1987devops Jun 20, 2022
a7d07f2
Update pom.xml
venkykosini Jan 24, 2023
66dacb4
Create .gitignore
venkykosini Nov 29, 2023
6583ae9
Create venkatesh
venkykosini Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venkatesh
44 changes: 44 additions & 0 deletions 2019-Aug-9:30Am-jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
node('master'){
// Add maven to path
env.PATH = "/opt/maven3/bin/:$PATH"

stage('Git Clone/Pull'){
git branch: 'dev',
url: 'https://github.com/javahometech/my-app'
}

stage('Build Docker Image'){
sh "mvn clean package"
sh "mv target/*.war target/myweb.war"
sh "docker build -t kammana/my-app:1.0 ."
}

stage('Push Image'){
withCredentials([string(credentialsId: 'docker-hub', variable: 'dockerHubPwd')]) {
sh "docker login -u kammana -p ${dockerHubPwd}"
}
sh "docker push kammana/my-app:1.0"
}

stage('Delete Old Container'){
sshagent (credentials: ['dev-docker']) {
try{
def dockrRm = "docker rm -f my-app"
def dockrRmImage = "docker rmi kammana/my-app:1.0"
sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.43.90 ${dockrRm} "
sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.43.90 ${dockrRmImage} "
}catch(e){
echo "container my-app not found"
}
}

}

stage('Deploy On Dev'){
sshagent (credentials: ['dev-docker']) {
def dockerRun = "docker run -d -p 8080:8080 --name=my-app kammana/my-app:1.0"
sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.43.90 ${dockerRun} "
}
}

}
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FROM tomcat:8
# Take the war and copy to webapps of tomcat
COPY target/*.war /usr/local/tomcat/webapps/
# Added for jenkins demo
COPY /opt/docker/*.war /usr/local/tomcat/webapps/myweb.war
62 changes: 45 additions & 17 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@
node{

node {
def sonarUrl = 'sonar.host.url=http://172.31.30.136:9000'
def mvn = tool (name: 'maven3', type: 'maven') + '/bin/mvn'
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
// Clone repo
git branch: 'master',
credentialsId: 'github',
url: 'https://github.com/javahometech/myweb'

}
stage('Compile-Package'){
// Get maven home path
def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"

stage('Sonar Publish'){
withCredentials([string(credentialsId: 'sonarqube', variable: 'sonarToken')]) {
def sonarToken = "sonar.login=${sonarToken}"
sh "${mvn} sonar:sonar -D${sonarUrl} -D${sonarToken}"
}

}
stage('Email Notification'){
mail bcc: '', body: '''Hi Welcome to jenkins email alerts
Thanks
Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'hari.kammana@gmail.com'


stage('Mvn Package'){
// Build using maven

sh "${mvn} clean package deploy"
}

stage('deploy-dev'){
def tomcatDevIp = '172.31.28.172'
def tomcatHome = '/opt/tomcat8/'
def webApps = tomcatHome+'webapps/'
def tomcatStart = "${tomcatHome}bin/startup.sh"
def tomcatStop = "${tomcatHome}bin/shutdown.sh"

sshagent (credentials: ['tomcat-dev']) {
sh "scp -o StrictHostKeyChecking=no target/myweb*.war ec2-user@${tomcatDevIp}:${webApps}myweb.war"
sh "ssh ec2-user@${tomcatDevIp} ${tomcatStop}"
sh "ssh ec2-user@${tomcatDevIp} ${tomcatStart}"
}
}
stage('Slack Notification'){
slackSend baseUrl: 'https://hooks.slack.com/services/',
channel: '#jenkins-pipeline-demo',
color: 'good',
message: 'Welcome to Jenkins, Slack!',
teamDomain: 'javahomecloud',
tokenCredentialId: 'slack-demo'
stage('Email Notification'){
mail bcc: '', body: """Hi Team, You build successfully deployed
Job URL : ${env.JOB_URL}
Job Name: ${env.JOB_NAME}

Thanks,
DevOps Team""", cc: '', from: '', replyTo: '', subject: "${env.JOB_NAME} Success", to: 'hari.kammana@gmail.com'

}
}

30 changes: 22 additions & 8 deletions deploy-to-tomcat
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
node{

def tomcatIp = '172.31.14.131'
def tomcatUser = 'ec2-user'
def stopTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/shutdown.sh"
def startTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/startup.sh"
def copyWar = "scp -o StrictHostKeyChecking=no target/myweb.war ${tomcatUser}@${tomcatIp}:/opt/tomcat8/webapps/"
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
git branch: 'master',
credentialsId: 'javahometech',
url: 'https://github.com/javahometech/myweb'
}
stage('Maven Build'){
def mvnHome = tool name: 'maven3', type: 'maven'
sh "${mvnHome}/bin/mvn clean package"
}

stage('Deploy Dev'){
sh 'mv target/myweb*.war target/myweb.war'

sshagent(['tomcat-dev']) {
sh "${stopTomcat}"
sh "${copyWar}"
sh "${startTomcat}"
}
}
stage('Compile-Package'){
// Get maven home path
def mvnHome = tool name: 'maven-3', type: 'maven'
sh "${mvnHome}/bin/mvn package"
}

}
41 changes: 41 additions & 0 deletions docker-swarm-ci-cd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
node{
def pom = readMavenPom file: 'pom.xml'
def version = pom.version
def nexus_tag = "172.31.24.222:8083/myweb:${version}"
def mvnHome = tool name: 'maven-3', type: 'maven'
def mvn = "${mvnHome}/bin/mvn"
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
}
stage('Maven Build'){
sh "${mvn} clean package"
sh 'mv target/myweb*.war target/myweb.war'
}

stage('Docker Build'){

sh "docker build -t ${nexus_tag} ."
}

stage('Push to Nexus'){
sh "docker login 172.31.24.222:8083 -u admin -p admin123"
sh "docker push ${nexus_tag}"
}

stage('Deploy to swarm'){
try{
def service = "docker service create -d -p 90:8080 --replicas=7 --name=myweb ${nexus_tag}"
sshagent (credentials: ['docker-swarm-manager']) {
def svs = "ec2-user@13.233.223.243 ${service}"
sh "ssh -o StrictHostKeyChecking=no ${svs}"
}
}catch(e){
def service = "docker service update --image=${nexus_tag} myweb"
sshagent (credentials: ['docker-swarm-manager']) {
def svs = "ec2-user@13.233.223.243 ${service}"
sh "ssh -o StrictHostKeyChecking=no ${svs}"

}
}
}
}
1 change: 1 addition & 0 deletions function-demo
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Added for demo
node{
stage('SCM Checkout'){
git 'https://github.com/javahometech/my-app'
Expand Down
1 change: 1 addition & 0 deletions helm/node-app/Chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added myweb-8.2.0.war
Binary file not shown.
31 changes: 31 additions & 0 deletions nov-2018-7am-devops
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
node{
def mvnHome = tool name: 'maven-3', type: 'maven'
def mvn = "${mvnHome}/bin/mvn"
def tomcatUsr = 'ec2-user'
stage('Git Checkout'){
git branch: 'master',
credentialsId: 'github',
url: 'https://github.com/javahometech/my-app'
}

stage('Build'){
sh "${mvn} clean package"
}
stage('deploy-to-dev'){
sh 'mv target/myweb*.war target/myweb.war'
sshagent(['tomcat-dev']) {
sh "ssh -o StrictHostKeyChecking=no ${tomcatUsr}@172.31.12.253 /opt/tomcat8/bin/shutdown.sh"
sh "ssh ${tomcatUsr}@172.31.12.253 rm -rf /opt/tomcat8/webapps/myweb*"
sh "scp target/myweb.war ${tomcatUsr}@172.31.12.253:/opt/tomcat8/webapps/"
sh "ssh ${tomcatUsr}@172.31.12.253 /opt/tomcat8/bin/startup.sh"
mail bcc: '',
body: '''myweb app deployed to Dev
Thanks
DevOps''',
cc: '',
from: '', replyTo: '',
subject: 'myweb app deployed to Dev',
to: 'hari.kammana@gmail.com'
}
}
}
25 changes: 19 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@
<groupId>in.javahome</groupId>
<artifactId>myweb</artifactId>
<packaging>war</packaging>
<version>0.0.3</version>
<version>0.0.7</version>
<name>my-app</name>

<url>http://maven.apache.org</url>

<properties>
<docker.image.prefix>kammana</docker.image.prefix>
<sonar.host.url>http://35.78.103.43:9000/</sonar.host.url>

</properties>
<dependencies>



<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand All @@ -27,12 +40,12 @@
<distributionManagement>
<snapshotRepository>
<id>nexus</id>
<url>http://172.31.17.173:8081/repository/maven-snapshots/</url>
<url>http://172.31.15.236:8081/repository/maven-snapshots/</url>
</snapshotRepository>

<repository>
<id>nexus</id>
<url>http://172.31.17.173:8081/repository/maven-releases/</url>
<url>http://172.31.15.236:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>

Expand All @@ -43,8 +56,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
Expand Down
6 changes: 6 additions & 0 deletions scm_demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node {

def scmVars = checkout scm
def commitHash = scmVars.GIT_COMMIT
echo commitHash
}
2 changes: 2 additions & 0 deletions src/main/java/in/javahome/myweb/controller/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class Calculator {
* @return int
*/
public int add(int i, int j){
String s = null;
s.toString();
return i+j;
}
public int multiply(int i, int j){
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>

<div class="container-fluid">
<h1>Javahome App - 0.0.3</h1>
<h1 style="color:black">Javahome Webhook demo @ 2019</h1>
</div>

</body>
Expand Down
45 changes: 42 additions & 3 deletions src/test/java/in/javahome/myweb/controller/CalculatorTest.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
package in.javahome.myweb.controller;


import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;

import junit.framework.Assert;
import junit.framework.TestCase;

public class CalculatorTest extends TestCase {
Calculator cal = new Calculator();
public void testAdd(){
Assert.assertEquals(cal.add(10, 20), 30);

public void testAdd() {
Properties prop = new Properties();

OutputStream output = null;

try
{

output = new FileOutputStream("../config.properties");

// set the properties value
prop.setProperty("database", "localhost");
prop.setProperty("dbuser", "hari");
prop.setProperty("dbpassword", "password");

// save properties to project root folder
prop.store(output, null);

}catch(
IOException io)
{
io.printStackTrace();
}finally
{
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}
}
public void testMultiply(){

public void testMultiply() {
Assert.assertEquals(cal.multiply(10, 20), 200);
}
}
1 change: 1 addition & 0 deletions venkatesh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hi venkatesh how are you