-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
56 lines (56 loc) · 1.89 KB
/
Jenkinsfile
File metadata and controls
56 lines (56 loc) · 1.89 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
44
45
46
47
48
49
50
51
52
53
54
55
56
pipeline {
agent any
environment {
SONAR_PROJECT_KEY = 'ColasRblr-Group'
SONAR_HOST_URL = 'https://sonarcloud.io'
SONAR_TOKEN = credentials('sonarQubeToken')
}
stages {
stage('Build') {
steps {
echo 'Construction du projet:'
powershell 'mvn clean package'
}
}
stage('Test') {
steps {
echo 'Exécution des tests:'
powershell 'mvn test'
}
}
stage('SonarQube Analysis:') {
steps {
echo 'Analyse SonarQube:'
powershell "mvn sonar:sonar"
}
}
stage('Deploy') {
steps {
script {
if (env.BRANCH_NAME == 'develop' || env.BRANCH_NAME == 'main') {
echo 'Déploiement de l\'application'
powershell 'mvn spring-boot:run'
}
}
}
}
}
post {
always {
junit 'my-reports/test-reports/*.xml'
archiveArtifacts artifacts: 'my-reports/test-reports/*.xml', allowEmptyArchive: true
}
success {
mail to: 'colas.rabiller@gmail.com',
subject: "Build succeeded: ${env.JOB_NAME} [${env.BUILD_NUMBER}]",
body: "Build succeeded: ${env.BUILD_URL} \n You can go to this link for more informations : http://eft-holy-serval.ngrok-free.app/job/multibranch",
from: 'jenkins@notification.com'
}
failure {
mail to: 'colas.rabiller@gmail.com',
subject: "Build failed: ${env.JOB_NAME} [${env.BUILD_NUMBER}]",
body: "Build failed: ${env.BUILD_URL} \n You can go to this link for more informations : http://eft-holy-serval.ngrok-free.app/job/multibranch",
from: 'jenkins@notification.com'
}
}
}