-
Notifications
You must be signed in to change notification settings - Fork 0
/
NWC_data_retrival_DL_service.groovy
32 lines (32 loc) · 2.13 KB
/
NWC_data_retrival_DL_service.groovy
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
node('master') {
try {
stage('Checkout') {
cleanWs()
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: '585fa701-720a-4602-abe6-b977c8773a4c', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'https://192.168.1.200/svn/api/Products/Cloud BLM/Application/branches/Experimental branch/BackEnd Services- Unified Database/CloudBLM-NWCDataRetrieval/NWCDataRetrieval-DatabaseLogic']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
}
stage('NPM Install') {
sh 'npm install'
}
stage('Build') {
sh 'npm run prod'
}
stage('Publish') {
sh label: 'Copy dist/server.js', script: 'sudo cp -v ${WORKSPACE}/dist/server.js /opt/apps/NWCDataRetrievalService/BusinessLogic/server.js'
sh label: 'Copy Node Modules', script: 'sudo cp -R ${WORKSPACE}/node_modules /opt/apps/NWCDataRetrievalService/BusinessLogic'
sh label: 'Copy server.config.js', script: 'sudo cp -v ${WORKSPACE}/server.config.js /opt/apps/NWCDataRetrievalService/BusinessLogic/server.config.js'
sh label: 'Copy appversion.json', script: 'sudo cp -v ${WORKSPACE}/appversion.json /opt/apps/NWCDataRetrievalService/BusinessLogic/appversion.json'
}
stage('Restart') {
sh 'sudo pm2 start /opt/apps/NWCDataRetrievalService/BusinessLogic/server.config.js'
deleteDir()
}
currentBuild.result = 'SUCCESS'
} catch (Exception err) {
currentBuild.result = 'FAILURE'
}
stage('Notify') {
if(currentBuild.result == 'FAILURE') {
mail bcc: '', body: "Hi,\n Jenkins have some issues in ${JOB_NAME} build #${BUILD_NUMBER} \n\n Build URL = ${BUILD_URL} \n\n Job URL = ${JOB_URL}", cc: '', from: '[email protected]', replyTo: '', subject: "Problem in ${JOB_NAME} build #${BUILD_NUMBER}", to: '[email protected]'
}
}
}