forked from LandmakTechnology/nodejs-application
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkinsfilenodejs-declarative
124 lines (110 loc) · 4.11 KB
/
jenkinsfilenodejs-declarative
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
@Library('akugbenodejs-ss') _
pipeline{
agent {
label {
label 'sonar'
retries 2
}
}
//agent any
tools {
nodejs 'nodejs17'
}
//options{}
//triggers{}
stages{
stage('1.CLONE CODE '){
steps{
sh "echo 'cloning the latest application version.' "
git "https://github.com/dizzy-101/nodejs-application.git"
}
}
stage('2.INTRO'){
steps{
akugbenodejs("Intro")
sh "echo 'Deploying akugbe NOW'"
}
}
stage('3.BUILD'){
steps{
sh "echo 'building akugbe'"
akugbenodejs("Build")
}
}
stage('3.EXECUTE SONARQUBE REPORT'){
steps{
akugbenodejs("SonarQube Report")
sh "echo 'running QA on akugbe'"
}
}
stage('5.UPLOAD ARTIFACTS TO NEXUS'){
steps{
sh "echo 'backup on akugbe'"
akugbenodejs("Upload Into Nexus")
// always-auth=true
//_auth=YWRtaW46anVtcGVk
//## use this for authn = echo -n 'username:password' | openssl base64
//allowRepublish=true
//sh 'chmod u+x ./scripts/nexus.sh'
//sh './scripts/nexus.sh'
//sh 'npm publish'
}
}
stage('5.DEPLOY TO UAT'){
steps{
sh "echo 'TESTING THE WEBHOOK without a running server, LOOKS GOOD' "
sh "echo 'testing the deploying to UAT stage without a running server' "
//deploy adapters: [tomcat9(credentialsId: 'kevtom', path: '', url: 'http:https://54.197.6.138:8080/')], contextPath: null, war: 'target/*.war'
//sh " npm start"
sh 'chmod u+x ./scripts/runApp.sh'
sh './scripts/runApp.sh'
sh 'npm start &'
}
}
stage('6.MANUAL APPROVAL'){
steps{
sh "echo 'Please review the application performance.' "
timeout(time:600, unit:'MINUTES') {
input message: 'Application ready for deployment, Please review and approve'
}
}
}
stage('7.DEPLOY TO PROD'){
steps{
sh "echo 'testing the deploying to Prod stage without a running server' "
//deploy adapters: [tomcat9(credentialsId: 'kevtom', path: '', url: 'http:https://54.197.6.138:8080/')], contextPath: null, war: 'target/*.war'
// sh " npm start"
sh 'chmod u+x ./scripts/runApp.sh'
sh './scripts/runApp.sh'
sh 'npm start &'
}
}
stage('8.APM'){
steps{
sh "echo 'monitoring and observation and alerting' "
sh "echo 'application performance Monitoring in progress' "
}
}
}
post{
always{
emailext attachLog: true, body: '''hello Team,
The build and deployment status is a success. kudos to you all and i appreciate all the efforts
BRGDS,
KLIK ENGINEERING. ''', compressLog: true, recipientProviders: [buildUser(), contributor(), developers(), requestor()], replyTo: '[email protected]', subject: 'Build and Deployment Status', to: '[email protected], [email protected], [email protected]'
}
success{
emailext attachLog: true, body: '''hello Team,
The build and deployment status is a success. kudos to you all and i appreciate all the efforts
BRGDS,
KLIK ENGINEERING. ''', compressLog: true, recipientProviders: [buildUser(), contributor(), developers(), requestor()], replyTo: '[email protected]', subject: 'Build and Deployment Status', to: '[email protected], [email protected], [email protected]'
}
failure{
emailext attachLog: true, body: '''hello Team,
The build and deployment status failed. kudos to you all and i appreciate all the efforts, lets find out the issues and fix them.
BRGDS,
KLIK ENGINEERING. ''', compressLog: true, recipientProviders: [buildUser(), contributor(), developers(), requestor()], replyTo: '[email protected]', subject: 'Build and Deployment Status', to: '[email protected], [email protected], [email protected]'
}
}
}