-
Notifications
You must be signed in to change notification settings - Fork 732
/
CICD-pipeline-complete
49 lines (42 loc) · 1.39 KB
/
CICD-pipeline-complete
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
42
43
44
45
46
47
48
49
new commit for poll scm-- commit on the repo for webhook
Complete CICD pipeline
go to vim /etc/sudoers
add this line
Jenkins ALL=NOPASSWD: ALL
Change permissions for jenkins to run docker commands:
chmod 777 /var/run/docker.sock
pipeline{
tools{
maven 'mymaven'
}
agent any
stages{
stage('clone repo'){
steps{
git 'https://github.com/Sonal0409/DevOpsCodeDemo.git'
}
}
stage('build the code'){
steps{
sh 'mvn clean install package'
}
}
stage('Build Image'){
steps{
sh 'docker build -t myimagejenkins .'
}
}
stage('Push image to dockerhub'){
steps{
sh 'docker tag myimagejenkins edu123/myimagejenkins:$BUILD_NUMBER'
sh 'docker login --username edu123 --password Edureka@123'
sh 'docker push edu123/myimagejenkins:$BUILD_NUMBER'
}
}
stage('Deploy in kube'){
steps{
kubernetesDeploy configs: 'kubedeploy.yml', kubeConfig: [path: ''], kubeconfigId: 'kube_config', secretName: '', ssh: [sshCredentialsId: '*', sshServer: ''], textCredentials: [certificateAuthorityData: '', clientCertificateData: '', clientKeyData: '', serverUrl: 'https://']
}
}
}
}