-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
69 lines (63 loc) · 2.24 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
pipeline {
agent any
tools {
maven 'Maven_3_5_2'
}
stages {
stage('CompileandRunSonarAnalysis') {
steps {
sh 'mvn clean verify sonar:sonar -Dsonar.projectKey=devsecops28_devsecops-demo -Dsonar.organization=devsecops28 -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=3d75b426c597d81980065bcf2087657ff5306998'
}
}
stage('RunSCAAnalysisUsingSnyk') {
steps {
echo 'Testing...'
snykSecurity(
snykInstallation: 'synktool',
snykTokenId: 'synk_token',
failOnError: 'false',
failOnIssues: 'false'
)
}
}
stage('Build') {
steps {
withDockerRegistry([credentialsId: "docker", url: ""]) {
script {
app = docker.build("secops")
}
}
}
}
stage('Push') {
steps {
script {
docker.withRegistry('https://056296809003.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:aws-cred') {
app.push("latest")
}
}
}
}
stage('Kubernetes Deployment of secops Bugg Web Application') {
steps {
withKubeConfig([credentialsId: 'kubelogin']) {
sh('kubectl delete all --all -n devsecops')
sh('kubectl apply -f deployment.yaml --namespace=devsecops')
}
}
}
stage('wait_for_testing') {
steps {
sh 'pwd; sleep 180; echo "Application Has been deployed on K8S"'
}
}
stage('RunDASTUsingZAP') {
steps {
withKubeConfig([credentialsId: 'kubelogin']) {
sh('zap.sh -cmd -quickurl http://$(kubectl get services/asgbuggy --namespace=devsecops -o json| jq -r ".status.loadBalancer.ingress[] | .hostname") -quickprogress -quickout ${WORKSPACE}/zap_report.html')
archiveArtifacts artifacts: 'zap_report.html'
}
}
}
}
}