@@ -2,7 +2,6 @@ pipeline {
22 agent any
33 tools {
44 nodejs ' node23'
5- docker ' latest'
65 }
76 stages {
87 stage(' Install Dependencies' ) {
@@ -53,48 +52,48 @@ pipeline {
5352 }
5453 }
5554 }
56- stage(' Creating Image' ) {
57- steps {
58- script {
59- sh ' echo "Creating Image..."'
60- sh ' docker build . -t app'
61- // Create manifest file for container
62- sh ''' cat <<EOF > app.yaml
63- apiVersion: apps/v1
64- kind: Deployment
65- metadata:
66- name: app
67- spec:
68- replicas: 1
69- selector:
70- matchLabels:
71- app: app
72- template:
73- metadata:
74- labels:
75- app: app
76- spec:
77- containers:
78- - name: app
79- image: app
80- ports:
81- - containerPort: 3000
82- EOF'''
83- }
84- }
85- }
86- stage(' Deploy' ) {
87- steps {
88- script {
89- withKubeConfig([credentialsId : ' kubeconfig' , serverUrl : ' https://kubernetes.default.svc.cluster.local' ]) {
90- sh ' echo "Deploying..."'
91- sh ' kubectl apply -f app.yaml'
92- sh ' kubectl get pods --watch'
93- sh ' until kubectl get pods | grep app | grep -m 1 "Running"; do sleep 5; done'
94- }
95- }
96- }
97- }
55+ // stage('Creating Image') {
56+ // steps {
57+ // script {
58+ // sh 'echo "Creating Image..."'
59+ // sh 'docker build . -t app'
60+ // // Create manifest file for container
61+ // sh '''cat <<EOF > app.yaml
62+ // apiVersion: apps/v1
63+ // kind: Deployment
64+ // metadata:
65+ // name: app
66+ // spec:
67+ // replicas: 1
68+ // selector:
69+ // matchLabels:
70+ // app: app
71+ // template:
72+ // metadata:
73+ // labels:
74+ // app: app
75+ // spec:
76+ // containers:
77+ // - name: app
78+ // image: app
79+ // ports:
80+ // - containerPort: 3000
81+ // EOF'''
82+ // }
83+ // }
84+ // }
85+ // stage('Deploy') {
86+ // steps {
87+ // script {
88+ // withKubeConfig([credentialsId: 'kubeconfig', serverUrl: 'https://kubernetes.default.svc.cluster.local']) {
89+ // sh 'echo "Deploying..."'
90+ // sh 'kubectl apply -f app.yaml'
91+ // sh 'kubectl get pods --watch'
92+ // sh 'until kubectl get pods | grep app | grep -m 1 "Running"; do sleep 5; done'
93+ // }
94+ // }
95+ // }
96+ // }
9897 stage(' Notify' ) {
9998 steps {
10099 script {
0 commit comments