forked from cehkunal/webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
60 lines (59 loc) · 1.62 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
pipeline {
agent any
tools {
maven 'Maven'
}
stages {
stage ('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}
stage ('Check-Git-Secrets') {
steps {
sh 'rm trufflehog || true'
sh 'docker run gesellix/trufflehog --json https://github.com/d0uble3L/webapp.git > trufflehog'
sh 'cat trufflehog'
}
}
stage ('Source Composition Analysis') {
steps {
sh 'rm owasp* || true'
sh 'wget "https://raw.githubusercontent.com/d0uble3L/webapp/master/owasp-dependency-check.sh" '
sh 'chmod +x owasp-dependency-check.sh'
sh 'bash owasp-dependency-check.sh'
sh 'cat /var/lib/jenkins/OWASP-Dependency-Check/reports/dependency-check-report.xml'
}
}
stage ('SAST') {
steps {
withSonarQubeEnv('sonar') {
sh 'mvn sonar:sonar'
sh 'cat target/sonar/report-task.txt'
}
}
}
stage ('Build') {
steps {
sh 'mvn clean package'
}
}
stage ('Deploy-To-Tomcat') {
steps {
sshagent(['tomcat']) {
sh 'scp -o StrictHostKeyChecking=no target/*.war ec2-user@tomcat-server:/home/ec2-user/prod/apache-tomcat-9.0.74/webapps/webapp.war'
}
}
}
stage ('DAST') {
steps {
sshagent(['zap']) {
sh 'ssh -o StrictHostKeyChecking=no ec2-user@zap-server "docker run -t owasp/zap2docker-stable zap-baseline.py -t http://tomcat-server:8080/webapp/" || true'
}
}
}
}
}