-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.txt
More file actions
88 lines (79 loc) · 2.32 KB
/
dev.txt
File metadata and controls
88 lines (79 loc) · 2.32 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
pipeline{
agent any
tools {
jdk 'jdk'
nodejs 'nodejs'
}
environment {
SCANNER_HOME = tool 'sonarqube'
SONAR_TOKEN=credentials('sonar-token-camp')
}
stages{
stage('git checkout'){
steps{
git branch: 'main', credentialsId: 'github', url: 'https://github.com/rahul6364/yelp_camp.git'
}
}
stage('install dependencies'){
steps{
sh 'npm install'
}
}
stage('test case'){
steps{
sh 'npm test'
}
}
stage('trivy fs scan'){
steps{
sh "trivy fs --format table -o trivy-report.txt ."
}
}
stage('sonarqube scanner'){
steps{
withSonarQubeEnv('sonarqube') {
sh '''
$SCANNER_HOME/bin/sonar-scanner \
-Dsonar.projectKey=camp \
-Dsonar.projectName=camp \
-Dsonar.sources=. \
-Dsonar.host.url=http://sonarqube:9000 \
-Dsonar.token=${SONAR_TOKEN}
'''
}
}
}
stage('image build and tag'){
steps{
script{
withDockerRegistry(credentialsId: 'dockerhub', toolName: 'docker') {
sh "docker build -t rahul6364/yelp-camp:latest ."
}
}
}
}
stage('trivy image scan'){
steps{
sh "trivy image --format table -o trivy-report.txt rahul6364/yelp-camp:latest"
}
}
stage('image run'){
steps{
script{
withDockerRegistry(credentialsId: 'dockerhub', toolName: 'docker') {
sh '''
docker run -d -p 3000:3000
-e ..
rahul6364/yelp-camp:latest \
'''
}
}
}
}
}
}
//pipeline{
// agent any
//parameters{
string(name: 'IMAGE_TAG', defaultValue: 'v1.0', description: 'tag of the docker image to deploy')
}