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/ diff --git a/Jenkinsfile b/Jenkinsfile index dfa7746..a3e0502 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,46 +1,28 @@ pipeline { - - environment { - registry = "192.168.1.81:5000/justme/myweb" - dockerImage = "" - } - - agent any - +agent any stages { stage('Checkout Source') { steps { - git 'https://github.com/justmeandopensource/playjenkins.git' + git 'https://github.com/jhasourav141/playjenkins.git' } } - stage('Build image') { - steps{ - script { - dockerImage = docker.build registry + ":$BUILD_NUMBER" - } - } - } - - stage('Push Image') { - steps{ - script { - docker.withRegistry( "" ) { - dockerImage.push() - } - } - } - } + stage('Deploy App') { - steps { - script { - kubernetesDeploy(configs: "myweb.yaml", kubeconfigId: "mykubeconfig") + steps { + echo 'deploying the application' + echo "deploying with ${my-kubeconfig}" + bat '${my-kubeconfig}' + } - } - } - - } + } + + } } + + + + diff --git a/README.md b/README.md deleted file mode 100644 index d480ad6..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# playjenkins -Jenkins Playground diff --git a/index.html b/index.html deleted file mode 100644 index 05abbe4..0000000 --- a/index.html +++ /dev/null @@ -1,7 +0,0 @@ -
-

Welcome to Just Me and OpenSource

-

v1.0

-

-

Demo of Jenkins CI/CD Pipeline using BlueOcean and Kubernetes Continuous Deployment plugins

- -
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