-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
73 lines (70 loc) · 2.33 KB
/
Jenkinsfile
File metadata and controls
73 lines (70 loc) · 2.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
pipeline {
agent any
tools {
jdk 'jdk21'
maven 'maven3'
nodejs 'node'
}
environment {
SCANNER_HOME= tool 'sonar-scanner'
}
stages {
stage('Git Pull') {
steps {
git branch: 'dev', credentialsId: 'git-cred-d', url: 'https://github.com/shumisoft/realtime-chatapp-message-service'
}
}
stage('Maven Compile') {
steps {
sh 'mvn compile'
}
}
stage('Trivy Vulnarability Scan') {
steps {
sh 'trivy fs -f table -o trivy-rtca-msgs-fs-report.html . && cat trivy-rtca-msgs-fs-report.html'
}
}
stage('Build, Test & SonarQube') {
steps {
withSonarQubeEnv('SonarQubeOC-DS') {
sh '''
mvn clean verify sonar:sonar \
-Dsonar.projectKey=Realtime_Chatapp-Message_Service \
-Dsonar.projectName=Realtime-Chatapp-Message-Service \
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml
'''
}
}
}
stage('Sonar Quality Gate') {
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'sonarqube-cred-d'
}
}
}
stage('Build') {
steps {
sh 'mvn package'
}
}
stage('Build & Push Multi-Arch Docker Image') {
steps {
script {
withDockerRegistry(credentialsId: 'dockerhub-cred-d') {
sh "docker buildx create --name mybuilder --use"
sh """docker buildx build \
--platform linux/amd64,linux/arm64 \
-t dipanshushukla/realtime-chatapp-message-service:latest-dev \
--push ."""
}
}
}
}
stage('Trivy Docker Image Scan') {
steps {
sh 'trivy image -f table -o trivy-rtca-msgs-container-image-report.html dipanshushukla/realtime-chatapp-message-service:latest-dev && cat trivy-rtca-msgs-container-image-report.html'
}
}
}
}