-
Notifications
You must be signed in to change notification settings - Fork 1
/
new-deployment-creation-script-after-adding
41 lines (41 loc) · 1.18 KB
/
new-deployment-creation-script-after-adding
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pipeline {
agent none
environment {
DOCKERHUB_CREDENTIALS=credentials('588da552-478b-4a8f-9edf-a4de0ff29435')
}
stages {
stage('Hello') {
steps {
echo 'Hello World'
}
}
stage('Git') {
agent {
label 'Kubernetes-Master'
}
steps {
git 'https://github.com/visaltyagi/website.git'
}
}
stage('Docker') {
agent {
label 'Kubernetes-Master'
}
steps {
sh 'sudo docker build /home/ubuntu/jenkins/workspace/Testpipeline -t visaltyagi12/project2'
sh 'sudo echo $DOCKERHUB_CREDENTIALS_PSW | sudo docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
sh 'sudo docker push visaltyagi12/project2'
}
}
stage('K8s') {
agent {
label 'Kubernetes-Master'
}
steps {
sh 'kubectl delete deploy nginx-deployment'
sh 'kubectl apply -f deployment.yaml'
sh 'kubectl apply -f service.yaml'
}
}
}
}