forked from Java-Techie-jt/devops-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
39 lines (38 loc) · 1.13 KB
/
Jenkinsfile
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
pipeline {
agent any
tools{
maven 'maven_3_5_0'
}
stages{
stage('Build Maven'){
steps{
checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/Java-Techie-jt/devops-automation']]])
sh 'mvn clean install'
}
}
stage('Build docker image'){
steps{
script{
sh 'docker build -t javatechie/devops-integration .'
}
}
}
stage('Push image to Hub'){
steps{
script{
withCredentials([string(credentialsId: 'dockerhub-pwd', variable: 'dockerhubpwd')]) {
sh 'docker login -u javatechie -p ${dockerhubpwd}'
}
sh 'docker push javatechie/devops-integration'
}
}
}
stage('Deploy to k8s'){
steps{
script{
kubernetesDeploy (configs: 'deploymentservice.yaml',kubeconfigId: 'k8sconfigpwd')
}
}
}
}
}