Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Binary file added .README.md.swp
Binary file not shown.
54 changes: 54 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
pipeline {
agent any
environment {
PROJECT_ID = 'karthikhdk'
CLUSTER_NAME = 'kube-demo'
LOCATION = 'us-central1-c'
CREDENTIALS_ID = 'kuberneteslogin'
}
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("gcr.io/karthikhdk/kubernetesrepos:${env.BUILD_ID}")
}
}
}
stage("Push image") {
steps {
script {
docker.withRegistry('https://gcr.io', 'gcr:kuberneteslogin') {
myapp.push("${env.BUILD_ID}")
}
}
}
}
stage('Deploy to Google Kubernetes') {
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"
}
}
}
}
54 changes: 54 additions & 0 deletions Jenkinsfile_old
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
pipeline {
agent any
environment {
PROJECT_ID = 'karthikhdk'
CLUSTER_NAME = 'kube-demo'
LOCATION = 'us-central1-c'
CREDENTIALS_ID = 'kuberneteslogin'
}
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("1313657/kubernetesrepos:${env.BUILD_ID}")
}
}
}
stage("Push image") {
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'docker') {
myapp.push("${env.BUILD_ID}")
}
}
}
}
stage('Deploy to Google Kubernetes') {
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"
}
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# CI-with-Jenkins-in-GCP-Demo
This is for testing the git push command
Test CI
47 changes: 47 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp2
spec:
replicas: 3
selector:
matchLabels:
app: webapp2
template:
metadata:
labels:
app: webapp2
spec:
containers:
- name: webapp2
image: gcr.io/karthikhdk/kubernetesrepos:tagversion
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: webapp2-svc
labels:
app: webapp2
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 8080
selector:
app: webapp2
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: webapp2
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: webapp2
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 3
34 changes: 34 additions & 0 deletions deployment_old.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp1
spec:
replicas: 3
selector:
matchLabels:
app: webapp1
template:
metadata:
labels:
app: webapp1
spec:
containers:
- name: webapp1
image: 1313657/kubernetesrepos:tagversion
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: webapp1-svc
labels:
app: webapp1
spec:
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: 8080
selector:
app: webapp1
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/mywebapp

COPY project/target/project-1.0-RAMA.war /usr/local/tomcat/webapps/project-1.0-RAMA.war
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/src/main/Webapp/images/devops-pic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions project/src/main/Webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<html>
<head>
<title>Welcome to Worldclass DevOps Workshop </title>

<title>Welcome to Continous Integration with Jenkins in AWS Yottabyte session</title>
</head>
<body bgcolor=white>

<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/test.jpg">
<img src="images/devops-pic.png">
</td>
<td>
<h1>Hello DevOps Engineers and Architects!</h1>
<h1>Hello DevOps Engineers and Architects!</h1>
</td>
</tr>
</table>

<p>This session is to demonstrate how to setup CI CD </p>
</body>
<p>This session is to demonstrate how to setup simple pipeline </p>
<p> This is testing of Git-Github push </p>
</body>
</html>