-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
63 lines (53 loc) · 1.89 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
pipeline {
agent any
tools{
jdk 'jdk11'
maven 'maven3'
}
environment{
SCANNER_HOME= tool 'sonar-scanner'
}
stages {
stage('Git Checkout') {
steps {
git branch: 'main', changelog: false, credentialsId: '15fb69c3-3460-4d51-bd07-2b0545fa5151', poll: false, url: 'https://github.com/jaiswaladi246/Shopping-Cart.git'
}
}
stage('COMPILE') {
steps {
sh "mvn clean compile -DskipTests=true"
}
}
stage('OWASP Scan') {
steps {
dependencyCheck additionalArguments: '--scan ./ ', odcInstallation: 'DP'
dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}
}
stage('Sonarqube') {
steps {
withSonarQubeEnv('sonar-server'){
sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Shopping-Cart \
-Dsonar.java.binaries=. \
-Dsonar.projectKey=Shopping-Cart '''
}
}
}
stage('Build') {
steps {
sh "mvn clean package -DskipTests=true"
}
}
stage('Docker Build & Push') {
steps {
script{
withDockerRegistry(credentialsId: '2fe19d8a-3d12-4b82-ba20-9d22e6bf1672', toolName: 'docker') {
sh "docker build -t shopping-cart -f docker/Dockerfile ."
sh "docker tag shopping-cart sudebdocker/shopping-cart:latest"
sh "docker push sudebdocker/shopping-cart:latest"
}
}
}
}
}
}