-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
47 lines (41 loc) · 1.33 KB
/
Copy pathJenkinsfile
File metadata and controls
47 lines (41 loc) · 1.33 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
pipeline{
agent any
stages {
stage('Initialize'){
steps{
sh '''
echo "Init phase"
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}
stage('Sonarqube test'){
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 isntance'){
steps{
sshagent(['ec2-user']){
sh 'scp -o StrictHostKeyChecking=no target/java-tomcat-maven-example.war ec2-user@ec2-63-33-191-164.eu-west-1.compute.amazonaws.com:/webapp/apache-tomcat-8.5.57/webapps/webapp.war'
}
}
}
stage('DAST'){
steps{
sshagent(['ec2-user']){
sh 'ssh -o StrictHostKeyChecking=no ec2-user@ec2-3-249-153-237.eu-west-1.compute.amazonaws.com "docker run -t owasp/zap2docker-stable zap-baseline.py -t http://ec2-63-33-191-164.eu-west-1.compute.amazonaws.com:8080/webapp"'
}
}
}
}
}