Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM tomcat:8.0.20-jre8

RUN mkdir /usr/local/tomcat/webapps/myapp

COPY project/target/project-1.0-RAMA.war /usr/local/tomcat/webapps/project-1.0-RAMA.war
107 changes: 107 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
pipeline {

agent any

environment {

PROJECT_ID = 'devops-vinay-262018'

CLUSTER_NAME = 'k8-cluster1'

LOCATION = 'us-east1-b'

CREDENTIALS_ID = 'k8'

}

stages {

stage("Checkout code") {

steps {

checkout scm

}

}

stage("Build") {

steps {

echo "cleaning and packaging"

sh 'mvn clean package'

}

}

stage("Test") {

steps {

echo "Testing"

sh 'mvn test'

}

}

stage("Build image") {

steps {

script {

myapp = docker.build("vinaymahesh/devops:${env.BUILD_ID}")

}

}

}

stage("Push image") {

steps {

script {

docker.withRegistry('https://registry.hub.docker.com', 'docker') {

myapp.push("${env.BUILD_ID}")

}

}

}

}

stage('Deploy to GKE') {

steps{

echo "Deployment started"

sh 'ls -ltr'

sh 'pwd'

sh "sed -i 's/tagversion/${env.BUILD_ID}/g' deployment.yaml"

step([$class: 'KubernetesEngineBuilder', projectId: env.PROJECT_ID, clusterName: env.CLUSTER_NAME, location: env.LOCATION, manifestPattern: 'deployment.yaml', credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])

echo "Deployment Finished"

}

}

}

}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# CI-with-Jenkins-in-GCP-Demo
#AAABBB
#AAABBCCCCCCB
22 changes: 22 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp1
spec:
replicas: 3
selector:
matchLabels:
app: webapp1
template:
metadata:
labels:
app: webapp1
spec:
containers:
-
image: "vinaymahesh/devops:tagversion"
name: webapp1
ports:
-
containerPort: 8080
2 changes: 1 addition & 1 deletion project/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/devops-pic.png">
<img src="images/devops-pic.png" alt="sprint 3 test ">
</td>
<td>
<h1>Hello DevOps Engineers and Architects!</h1>
Expand Down
Empty file added vim.exe
Empty file.