forked from LandmakTechnology/maven-web-application
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_docker
60 lines (59 loc) · 1.38 KB
/
Jenkinsfile_docker
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
pipeline{
agent any
tools{
maven "maven3.8.4"
}
stages{
stage('GitClone'){
steps{
echo "cloning the lastest applications version"
git "https://github.com/LandmakTechnology/maven-web-application"
}
}
stage('Test+Build'){
steps{
sh "echo Running unitTesting"
sh "mvn clean package"
echo "echo test successful and backupArtifacts created"
}
}
stage('codeQuality'){
steps{
sh "echo Running detail code analysis"
sh "mvn sonar:sonar"
sh "echo All conditions met/passed"
}
}
stage('upLoadArtifacts'){
steps{
sh "echo Running detail code analysis"
sh "mvn deploy"
sh "echo backupArtifacts in nexus"
}
}
stage('predeployment'){
steps{
sh "echo creating docker image"
sh "docker build -t mylandmarktech/maven-web-app . "
sh "docker push mylandmarktech/maven-web-app"
}
}
stage('UnDeploy'){
steps{
sh "echo UNDEPLOYING existing application"
sh "docker rm -f webapp"
}
}
stage('deployment'){
steps{
sh "echo application ready for deployment"
sh "docker run -d -p 8000:8080 --name webapp mylandmarktech/maven-web-app"
}
}
stage('emailNotification'){
steps{
sh "echo deployment successful"
}
}
}
}