-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
74 lines (62 loc) · 1.36 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
69
70
71
72
73
74
pipeline{
/*some changes*/
environment{
registry = 'arijmansour/timesheet-devops'
registryCredential= 'dockerHub'
dockerImage = ''
}
agent any
stages {
stage('Checkout GIT') {
steps {
echo 'Pulling...';
git branch: 'master',
url:'https://github.com/ArijMansour/Devops_Timesheet_CI-CD.git';
}
}
stage("Test, Build"){
steps{
bat "mvn clean install"
}
}
stage("package"){
steps{
bat "mvn package"
}
}
stage("Sonar"){
steps{
bat "mvn sonar:sonar"
}
}
stage("Nexus"){
steps{
bat "mvn deploy"
}
}
stage('Building our image'){
steps{
script{
dockerImage= docker.build registry + ":$BUILD_NUMBER"
}
}
}
stage('Deploy our image'){
steps{
script{
docker.withRegistry( '', registryCredential){
dockerImage.push()
}
}
}
}
}
post{
success{
emailext body: 'Build success', subject: 'Jenkins', to:'arijbenmansour1@gmail.com'
}
failure{
emailext body: 'Build failure', subject: 'Jenkins', to:'arijbenmansour1@gmail.com'
}
}
}