-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
115 lines (108 loc) · 5.15 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
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
pipeline {
agent any
stages {
stage('Pre Build stages') {
parallel {
stage('Npm Install') {
steps {
echo '====================================== Npm Install ======================================'
sh 'npm install'
}
}
stage('version Up') {
steps {
echo '====================================== Update build-info ======================================'
script {
jsonDictionary = readJSON file: "build-info.json"
jsonDictionary.buildDateTime = "${BUILD_TIMESTAMP}".toString()
jsonDictionary.buildId = "${BUILD_ID}".toString()
writeJSON(file: 'build-info.json', json: jsonDictionary, pretty: 4)
sh 'cat build-info.json'
}
}
}
stage('notifications before build') {
steps {
mail from: '',
to: "[email protected]",
cc: '',
bcc: '',
replyTo: '',
subject: "From Jenkins -> ${JOB_NAME} #${BUILD_NUMBER} STARTED",
body: "<b>Project: ${env.JOB_NAME}</b><br> Build Number: #${env.BUILD_NUMBER} <br> Build Status: STARTED <br>URL build: ${env.BUILD_URL}",
charset: 'UTF-8',
mimeType: 'text/html';
discordSend title: "**${JOB_NAME} #${BUILD_NUMBER} STARTED**",
description: "**`Status: STARTED`**",
footer: "time: ${currentBuild.durationString}",
result: "${currentBuild.currentResult}",
thumbnail: "https://www.treehugger.com/thmb/eFvSYtTgdWT4SucO5nd1oBJBcyo=/768x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__mnn__images__2019__01__grumpy_cat-c653c9bb27604d6e92c4ca8df4d9e3bb.jpg",
link: "${BUILD_URL}",
webhookURL: "https://discord.com/api/webhooks/781998432919355425/8XK5CZDTXgqrtgZSk8eur77Z1ClCppNQYySdPA4wPTo9STiEhSZa9c-rVNTvnKVO78JP"
}
}
}
}
stage('Static code analysis') {
parallel {
stage('linting') {
steps {
echo '====================================== linting ======================================'
sh 'ng lint'
}
}
// stage('Unit tests') {
// steps {
// echo '====================================== Unit tests ======================================'
// echo 'testing'
// }
// }
stage('Sonar Scanner') {
steps {
echo '====================================== Sonar Scanner ======================================'
sh '/srv/dev-disk-by-label-Magazyn-SSHD/SonarQube/sonar-scanner-4.5.0.2216-linux/bin/sonar-scanner -Dproject.settings=/srv/dev-disk-by-label-Magazyn-SSHD/jenkins/workspace/Eoroid2144/sonar-project.properties'
}
}
}
}
stage('Npm Build') {
steps {
echo '====================================== Npm Build ======================================'
sh 'ng build -c production'
}
}
stage ('Deploy to Webio') {
steps {
echo '====================================== Deploy to Webio ======================================'
ftpPublisher alwaysPublishFromMaster: false,
continueOnError: false,
failOnError: false,
masterNodeName: '',
paramPublish: null,
publishers: [
[configName: 'webio-ftp', transfers: [[asciiMode: false, cleanRemote: false, excludes: '', flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'eoroid2144.hostingasp.pl/wwwroot', remoteDirectorySDF: false, removePrefix: 'dist/Eoroid2144/', sourceFiles: 'dist/Eoroid2144/*,dist/Eoroid2144/**/*']], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true]]
}
}
}
post {
always {
echo '============================ post build actions =============================='
mail from: '',
to: "[email protected]",
cc: '',
bcc: '',
replyTo: '',
subject: "From Jenkins -> ${JOB_NAME} #${BUILD_NUMBER} ${currentBuild.currentResult}",
body: "<b>Project: ${env.JOB_NAME}</b><br> Build Number: #${env.BUILD_NUMBER} <br> Build Result: #${currentBuild.currentResult} <br>URL build: ${env.BUILD_URL}",
charset: 'UTF-8',
mimeType: 'text/html';
discordSend title: "**${JOB_NAME} #${BUILD_NUMBER} ${currentBuild.currentResult}**",
description: "**`Result: ${currentBuild.currentResult}`**",
footer: "time: ${currentBuild.durationString}",
result: "${currentBuild.currentResult}",
thumbnail: "https://www.treehugger.com/thmb/eFvSYtTgdWT4SucO5nd1oBJBcyo=/768x0/filters:no_upscale():max_bytes(150000):strip_icc()/__opt__aboutcom__coeus__resources__content_migration__mnn__images__2019__01__grumpy_cat-c653c9bb27604d6e92c4ca8df4d9e3bb.jpg",
link: "${BUILD_URL}",
webhookURL: "https://discord.com/api/webhooks/781998432919355425/8XK5CZDTXgqrtgZSk8eur77Z1ClCppNQYySdPA4wPTo9STiEhSZa9c-rVNTvnKVO78JP"
}
}
}