-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
68 lines (63 loc) · 2.06 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pipeline {
agent any
stages {
stage('Pulling from git...'){
steps{
git branch : 'main',
url : 'https://github.com/THE-B-M-A-K-E-R-S/Jenkins-pipelines'
}
}
stage('Running the unit test...'){
steps{
sh 'mvn clean test'
}
}
stage("Build") {
steps {
sh 'mvn install -DskipTests=true'
}
}
stage("SonarQube Analysis") {
steps {
sh 'mvn sonar:sonar'
}
}
stage('Nexus Deploy ') {
steps {
nexusArtifactUploader artifacts: [
[
artifactId: 'achat',
classifier: '',
file: 'target/achat.jar',
type: 'jar'
]
],
credentialsId: 'nexus3',
groupId: 'tn.esprit.rh',
nexusUrl: 'localhost:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'Achat-release',
version: '1.0.0'
}
}
stage('Build backend docker image') {
steps {
sh 'docker build -t bmakes/spring .'
}
}
stage('Push images to Dockerhub') {
steps{
script{
sh 'docker login -u bmakes -p ehNRW3QFpeL835h'
sh 'docker push bmakes/spring'
}
}
}
stage("Email notification sender ..."){
steps{
emailext attachLog: true, body: "${env.BUILD_URL} has result ${currentBuild.result}", compressLog: true, subject: "Status of pipeline: ${currentBuild.fullDisplayName}", to: 'bassem.jadoui@esprit.tn,karim.mannai@esprit.tn,naceuramine.saddem@esprit.tn,ahmed.jelassi@esprit.tn,khaled.battiche@esprit.tn'
}
}
}
}