-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjenkinsfile
79 lines (65 loc) · 2.85 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
70
71
72
73
74
75
76
77
78
79
pipeline {
agent any
environment {
SONAR_HOME = tool "Sonar" // Ensure "Sonar" matches your SonarQube installation name
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY = credentials('NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY') // Replace with your credentials ID
CLERK_SECRET_KEY = credentials('CLERK_SECRET_KEY') // Replace with your credentials ID
NEXT_PUBLIC_CLERK_SIGN_IN_URL = '/sign-in'
NEXT_PUBLIC_CLERK_SIGN_UP_URL = '/sign-up'
DATABASE_URL = credentials(DATABASE_URL)
// UploadThing
UPLOADTHING_SECRET = credentials('UPLOADTHING_SECRET') // Replace with your credentials ID
UPLOADTHING_APP_ID = credentials('UPLOADTHING_APP_ID') // Replace with your credentials ID
UPLOADTHING_TOKEN = credentials('UPLOADTHING_TOKEN') // Replace with your credentials ID
NEXT_PUBLIC_SITE_URL = 'http://localhost:3000'
// Livekit.io
LIVEKIT_API_KEY = credentials('LIVEKIT_API_KEY') // Replace with your credentials ID
LIVEKIT_API_SECRET = credentials('LIVEKIT_API_SECRET') // Replace with your credentials ID
NEXT_PUBLIC_LIVEKIT_URL = credentials('NEXT_PUBLIC_LIVEKIT_URL')
// Redis connection string
REDIS_CONNECTION_STRING = credentials('REDIS_CONNECTION_STRING')
// PostgreSQL setup using Docker
POSTGRES_USER = credentials('POSTGRES_USER')
POSTGRES_PASSWORD = credentials('POSTGRES_PASSWORD')
POSTGRES_DB = credentials('POSTGRES_DB')
}
stages {
stage('Clone Code From Github') {
steps {
echo 'Fetching the Code'
git url: "https://github.com/CoderSwarup/discord-clone.git", branch: "main"
}
}
stage('Sonarqube Quality Analysis') {
steps {
withSonarQubeEnv("Sonar") {
sh '$SONAR_HOME/bin/sonar-scanner -Dsonar.projectName=discordClone -Dsonar.projectKey=discord-clone'
}
}
}
stage("OWASP Dependency Check") {
steps {
dependencyCheck additionalArguments: '--scan ./', odcInstallation: 'dependency Check' // Match installation name
dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}
}
stage("Sonar Quality Gate Scan") {
steps {
timeout(time: 2, unit: "MINUTES") {
waitForQualityGate abortPipeline: false
}
}
}
stage('Trivy File System Scan') {
steps {
sh 'trivy fs --format table -o trivy-fs-report.html .' // Ensure trivy is accessible
}
}
stage("Deploy using Docker Compose"){
steps {
echo "Starting Docker containers..."
sh 'docker-compose up -d'
}
}
}
}