-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
60 lines (57 loc) · 1.55 KB
/
Jenkinsfile
File metadata and controls
60 lines (57 loc) · 1.55 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
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 dxa4481/trufflehog --json https://github.com/ashishgavali10/DevSecOps.git > trufflehog'
sh 'cat trufflehog'
}
}
stage('Software composition analysis'){
steps{
sh 'rm owasp* || true'
sh 'wget https://raw.githubusercontent.com/ashishgavali10/DevSecOps/master/owasp-dependency-check.sh'
sh 'chmod +x owasp-dependency-check.sh'
sh 'sudo bash owasp-dependency-check.sh'
}
}
stage('SAST'){
steps{
withSonarQubeEnv('sonarqube'){
sh 'mvn sonar:sonar'
}
}
}
stage ('Build') {
steps {
sh 'mvn clean package'
}
}
stage ('Deploy to tomcat') {
steps {
sshagent(['TomcatServer']) {
sh 'scp -o StrictHostKeyChecking=no target/*.war ubuntu@3.85.30.94:/home/ubuntu/workspace/apache-tomcat-8.5.59/webapps/webapp.war'
}
}
}
stage ('DAST') {
steps {
sshagent(['TomcatServer']){
sh 'ssh -o StrictHostKeyChecking=no ubuntu@3.85.30.94 "docker run -t owasp/zap2docker-stable zap-baseline.py -t http://52.54.136.50:8080/webapp/" || exit 0 '
}
}
}
}
}