-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathJenkinsfile.prod
53 lines (53 loc) · 1.42 KB
/
Jenkinsfile.prod
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
pipeline {
agent any
environment {
AWS_ACCESS_KEY_ID = credentials('jenkins_iam_access_key_id')
AWS_SECRET_ACCESS_KEY = credentials('jenkins_secret_access_key_id')
}
stages {
stage('Terraform Initialization') {
steps {
sh 'terraform init'
sh 'pwd'
sh 'ls -al'
sh 'printenv'
}
}
stage('SonarQube Analysis') {
steps {
script {
def scannerHome = tool 'sonarqube-1';
withSonarQubeEnv('sonarqube-1') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
}
stage('Terraform Format') {
steps {
sh 'terraform fmt -check'
}
}
stage('Terraform Validate') {
steps {
sh 'terraform validate'
}
}
stage('Terraform Planning') {
steps {
sh 'terraform plan -no-color'
}
}
stage('Terraform Apply') {
steps {
sh 'terraform apply -auto-approve'
sh 'sleep 300'
}
}
stage('Terraform Destroy') {
steps {
sh 'terraform destroy -auto-approve'
}
}
}
}