forked from TheSolutionArchitect/spring-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
60 lines (54 loc) · 1.78 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
stages {
stage('Welcome') {
steps {
echo 'This is a DevSecOps pipeline created by AWSTechGuide'
}
}
stage('Pull Sources') {
steps {
git url: 'https://github.com/awstechguide/spring-webapp.git'
}
}
stage('Check-Git-Secrets') {
steps {
sh 'rm trufflehog* || true'
sh 'docker pull gesellix/trufflehog'
sh 'docker run -t gesellix/trufflehog --json https://github.com/awstechguide/spring-webapp.git > trufflehog'
sh 'cat trufflehog'
}
}
/*
stage('SCA') {
steps {
echo 'Initiating Source Composition Analysis by OWASP'
sh 'rm owasp* || true'
sh 'wget "https://raw.githubusercontent.com/awstechguide/spring-webapp/master/owasp-dependency-checker.sh"'
sh 'chmod +x owasp-dependency-checker.sh'
sh 'bash owasp-dependency-checker.sh'
sh 'cat /var/lib/jenkins/OWASP-Dependency-Check/reports/dependency-check-report.xml'
}
}
*/
stage('Build') {
steps {
sh 'mvn clean install'
}
}
stage ('Deploy') {
steps {
sshagent(['deployuser']) {
sh "scp -o StrictHostKeyChecking=no target/webapptest.war [email protected]:/usr/local/tomcat/webapps/webapptest.war"
}
}
}
stage ('DAST') {
steps {
sshagent(['zap']) {
sh 'ssh -o StrictHostKeyChecking=no [email protected] "docker run -t owasp/zap2docker-stable zap-baseline.py -t http://54.92.220.219:8080/webapptest/home" || true'
}
}
}
}
}