forked from sudheer76R/java-example
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkins-sonar-docker
More file actions
43 lines (43 loc) · 1.25 KB
/
Jenkins-sonar-docker
File metadata and controls
43 lines (43 loc) · 1.25 KB
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
pipeline{
agent none
stages{
stage('Git Checkout Stage'){
agent {label 'sonar_node'}
steps{
git branch: 'main', url: 'https://github.com/fatimatabassum05/sonarqube-example.git'
}
}
stage('Build Stage'){
agent {label 'sonar_node'}
steps{
sh 'mvn clean install'
}
}
stage('SonarQube Analysis Stage') {
agent {label 'sonar_node'}
steps{
withSonarQubeEnv('sonarqube_1') {
sh "mvn clean verify sonar:sonar -Dsonar.projectKey=sonarqube_1"
}
}
}
stage('Build docker Image'){
agent {label 'docker_node_new'}
steps{
sh 'docker build -t fatimatabassum/fatima12:${BUILD_NUMBER} .'
}
}
stage('Push To Dockerhub'){
agent {label 'docker_node_new'}
steps{
sh 'docker push fatimatabassum/fatima12:${BUILD_NUMBER}'
}
}
stage('Deploy Stage') {
agent {label 'docker_node_new'}
steps{
sh 'docker run -d -p 8080:8080 fatimatabassum/fatima12:${BUILD_NUMBER}'
}
}
}
}