forked from drewthoennes/Bored-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
72 lines (69 loc) · 1.88 KB
/
Copy pathJenkinsfile
File metadata and controls
72 lines (69 loc) · 1.88 KB
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
pipeline {
agent {
docker {
image 'node:14'
}
}
stages {
stage('Prepare Environment') {
steps {
sh "bash devops/install-docker-and-docker-compose.sh"
sh "npm install"
}
}
stage('Build') {
steps {
sh "npm run build"
}
}
stage('SonarQube Analysis') {
steps {
withSonarQubeEnv('https://sonar:9000/'){
sh "npm run sonar"
}
timeout(time:10, unit: 'MINUTES'){
waitForQualityGate abortPipeline: true
}
}
}
stage('Unit Tests') {
steps {
echo "pass unit tests at the moment"
}
}
stage('Security Tests with ZAP') {
steps {
sh "docker-compose up --build -d"
sh "docker run --user root --rm -v \$(pwd):/zap/wrk/:rw -t owasp/zap2docker-stable zap-baseline.py -t http://172.17.0.1:5000 -x report.xml || true"
sh "docker-compose down"
}
post {
always {
junit 'report.xml'
}
}
}
stage('Acceptance Test') {
steps {
sh "npm run test"
}
post {
always {
junit 'test/integration-test-results.xml'
junit 'test/db-test-results.xml'
}
}
}
}
post {
success {
notifyTeams("Pipeline was successful", "SUCCESS")
}
failure {
notifyTeams("Pipeline failed", "FAILURE")
}
}
}
def notifyTeams(msg, status) {
office365ConnectorSend message: "${msg}", status:"${status}", webhookUrl:'${webhookUrl}'
}