From 8a2badb8f62c1f71f6f928caa5a2b229547d19dd Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Mon, 27 Jun 2022 16:58:17 +0530 Subject: [PATCH 01/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index dfa7746..0589665 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { environment { - registry = "192.168.1.81:5000/justme/myweb" + registry = "localhost:50000/justme/myweb" dockerImage = "" } From a3e1d1731f0595693236d9420901dccae5758708 Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Wed, 29 Jun 2022 16:06:58 +0530 Subject: [PATCH 02/13] Update and rename myweb.yaml to testpod.yaml --- myweb.yaml | 38 -------------------------- testpod.yaml | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 38 deletions(-) delete mode 100644 myweb.yaml create mode 100644 testpod.yaml diff --git a/myweb.yaml b/myweb.yaml deleted file mode 100644 index fba9532..0000000 --- a/myweb.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: myweb - name: myweb -spec: - replicas: 1 - selector: - matchLabels: - app: myweb - template: - metadata: - labels: - app: myweb - spec: - containers: - - image: 192.168.1.81:5000/justme/myweb:1 - imagePullPolicy: Always - name: myweb - ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: myweb - name: myweb -spec: - ports: - - nodePort: 32223 - port: 80 - protocol: TCP - targetPort: 80 - selector: - app: myweb - type: NodePort diff --git a/testpod.yaml b/testpod.yaml new file mode 100644 index 0000000..98c7ed8 --- /dev/null +++ b/testpod.yaml @@ -0,0 +1,77 @@ +--- +kind: Pod +apiVersion: v1 +metadata: + name: testpod +spec: + containers: + - name: c01 + image: httpd + ports: + - containerPort: 80 +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: testpod +spec: + replicas: 1 + selector: # tells the controller which pods to watch/belong to + matchLabels: + name: deployment + template: + metadata: + name: testpod1 + labels: + name: deployment + spec: + containers: + - name: c00 + image: httpd + ports: + - containerPort: 80 +--- +kind: Service # Defines to create Service type Object +apiVersion: v1 +metadata: + name: testpod +spec: + ports: + - port: 80 # Containers port exposed + targetPort: 80 # Pods port + selector: + name: deployment # Apply this service to any pods which has the specific label + type: NodePort + # Specifies the service type i.e ClusterIP or NodePort +--- + +kind: ReplicationController +apiVersion: v1 +metadata: + name: testpod +spec: + replicas: 2 + selector: + myname: deployment + template: + metadata: + name: testpod + labels: + myname: deployment + spec: + containers: + - name: c01 + image: httpd + command: ["/bin/bash", "-c", "while true; do echo Hello-Bhupinder; sleep 5 ; done"] +--- +kind: Service # Defines to create Service type Object +apiVersion: v1 +metadata: + name: testpod +spec: + ports: + - port: 80 # Containers port exposed + targetPort: 80 # Pods port + selector: + name: deployment # Apply this service to any pods which has the specific label + type: LoadBalancer From 26fd4a135369a0e0fcc7c2a3fea1012d79a6a96c Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Wed, 29 Jun 2022 16:22:35 +0530 Subject: [PATCH 03/13] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0589665..c4dad68 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { environment { - registry = "localhost:50000/justme/myweb" + registry = "localhost:50000" dockerImage = "" } @@ -11,7 +11,7 @@ pipeline { stage('Checkout Source') { steps { - git 'https://github.com/justmeandopensource/playjenkins.git' + git 'https://github.com/jhasourav141/playjenkins.git' } } @@ -36,7 +36,7 @@ pipeline { stage('Deploy App') { steps { script { - kubernetesDeploy(configs: "myweb.yaml", kubeconfigId: "mykubeconfig") + kubernetesDeploy(configs: "testpod.yaml", kubeconfigId: "mykubeconfig") } } } From 4c4ce6496e099077bf9d12394ff6e0f4ab15c7bd Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Fri, 1 Jul 2022 10:24:33 +0530 Subject: [PATCH 04/13] Update Jenkinsfile --- Jenkinsfile | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4dad68..0b92e17 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,5 @@ pipeline { - - environment { - registry = "localhost:50000" - dockerImage = "" - } - - agent any - +agent any stages { stage('Checkout Source') { @@ -15,23 +8,7 @@ pipeline { } } - stage('Build image') { - steps{ - script { - dockerImage = docker.build registry + ":$BUILD_NUMBER" - } - } - } - - stage('Push Image') { - steps{ - script { - docker.withRegistry( "" ) { - dockerImage.push() - } - } - } - } + stage('Deploy App') { steps { From 1cd5d46925f11ff291c4f7ed4aeded20bdbe5c37 Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:40:44 +0530 Subject: [PATCH 05/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b92e17..fc720fc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ agent any stage('Deploy App') { steps { script { - kubernetesDeploy(configs: "testpod.yaml", kubeconfigId: "mykubeconfig") + kubernetesDeploy(configs: "testpod.yaml") } } } From eaee49054eb9f5f9d3656f8d537a80a01039e1f1 Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:57:44 +0530 Subject: [PATCH 06/13] Delete Dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 56c3134..0000000 --- a/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM httpd:2.4 -COPY ./index.html /usr/local/apache2/htdocs/ From 048b5aa80e6571a22e15905947b6d8d02f0f6737 Mon Sep 17 00:00:00 2001 From: Sourav Kumar Jha <60103363+jhasourav141@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:57:56 +0530 Subject: [PATCH 07/13] Delete index.html --- index.html | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 05abbe4..0000000 --- a/index.html +++ /dev/null @@ -1,7 +0,0 @@ -
Demo of Jenkins CI/CD Pipeline using BlueOcean and Kubernetes Continuous Deployment plugins
- -