forked from maheshz09/Swiggy-Clone-App-eks-argocd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile
67 lines (61 loc) · 1.92 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
pipeline {
agent any
tools {
jdk 'jdk17'
nodejs 'nodejs16'
}
environment {
SCANNER_HOME = tool name: 'sonar-scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
SONAR_PROJECT_KEY = 'Food-Clone-App-eks-argocd'
SONAR_PROJECT_NAME = 'Food-Clone-App-eks-argocd'
SONAR_QUALITY_PROFILE = 'Sonar-check'
}
stages {
stage('Clean workspace') {
steps {
cleanWs()
}
}
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/harykryshnan-Master/Food-Clone-App-eks-argocd.git'
}
}
stage('SonarQube Analysis') {
steps {
withSonarQubeEnv('sonar') {
sh """
${env.SCANNER_HOME}/bin/sonar-scanner \
-Dsonar.projectKey=${env.SONAR_PROJECT_KEY} \
-Dsonar.projectName=${env.SONAR_PROJECT_NAME} \
-Dsonar.qualitygate.wait=true \
-Dsonar.qualitygate.timeout=300 \
-Dsonar.qualityprofile=${env.SONAR_QUALITY_PROFILE}
"""
}
}
}
stage('Quality Gates') {
steps {
timeout(time: 1, unit: 'HOURS') {
script {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}
stage('Dependency Install') {
steps {
sh "npm install"
}
}
stage('Trivy Filesystem Scan') {
steps {
sh "trivy fs . > trivy-fs.txt"
}
}
}
}