-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (64 loc) · 1.59 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
pipeline{
agent any
tools{
jdk 'jdk17'
terraform 'terraform'
}
stages{
stage('clean Workspace'){
steps{
cleanWs()
}
}
stage('checkout from Git'){
steps{
git branch: 'main', url: 'https://github.com/Aj7Ay/TERRAFORM-JENKINS-CICD.git'
}
}
stage('Terraform version'){
steps{
sh 'terraform --version'
}
}
stage("Sonarqube Analysis "){
steps{
withSonarQubeEnv('sonar-server') {
sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Terraform \
-Dsonar.projectKey=Terraform '''
}
}
}
stage("quality gate"){
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'Sonar-token'
}
}
}
stage('TRIVY FS SCAN') {
steps {
sh "trivy fs . > trivyfs.txt"
}
}
stage('Excutable permission to userdata'){
steps{
sh 'chmod 777 website.sh'
}
}
stage('Terraform init'){
steps{
sh 'terraform init'
}
}
stage('Terraform plan'){
steps{
sh 'terraform plan'
}
}
stage('Terraform apply'){
steps{
sh 'terraform ${action} --auto approve'
}
}
}
}