forked from aquasecurity/aqua-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
151 lines (149 loc) · 4.61 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@Library('aqua-pipeline-lib@master') _
import com.aquasec.deployments.orchestrators.*
def orchestrator = new OrcFactory(this).GetOrc()
def charts = ['server', 'kube-enforcer', 'enforcer', 'gateway', 'aqua-quickstart', 'cyber-center', 'cloud-connector', 'scanner', 'tenant-manager', 'codesec-agent']
def deployCharts = [ 'server', 'kube-enforcer', 'enforcer', 'scanner', 'cyber-center', 'codesec-agent' ]
def debug = false
pipeline {
agent {
label 'deployment_slave'
}
parameters {
string(name: 'AUTOMATION_BRANCH', defaultValue: 'master', description: "Automation branch for MSTP tests", trim: true)
}
options {
ansiColor('xterm')
timestamps()
skipStagesAfterUnstable()
skipDefaultCheckout()
buildDiscarder(logRotator(daysToKeepStr: '7'))
lock("k3s")
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage("Helm lint") {
steps {
script {
parallel charts.collectEntries { chart ->
["${chart}": {
stage("Helm Lint ${chart}") {
helmBasic.lint(chart)
}
}]
}
}
}
}
stage("Helm template") {
steps {
script {
parallel charts.collectEntries { chart ->
["${chart}": {
stage("Helm template ${chart}") {
helmBasic.template(chart)
}
}]
}
}
}
}
stage("Trivy scan") {
steps {
script {
parallel charts.collectEntries { chart ->
["${chart}": {
stage("Trivy scan ${chart}") {
helmBasic.trivyScan(chart)
}
}]
}
}
}
}
stage("Creating K3s Cluster") {
steps {
script {
orchestrator.install()
}
}
}
stage("Update consul") {
steps {
script {
helmBasic.updateConsul("create")
}
}
}
stage("Installing Helm") {
steps {
script {
helmBasic.installHelm()
helmBasic.settingKubeConfig()
}
}
}
stage("Deploy charts") {
steps {
script {
parallel deployCharts.collectEntries { chart ->
["${chart}": {
stage("Deploy ${chart}") {
helmBasic.install(chart)
}
}]
}
}
}
}
stage("Validate charts") {
steps {
script {
parallel deployCharts.collectEntries { chart ->
["${chart}": {
stage("Validate ${chart}") {
helmBasic.validate(chart)
}
}]
}
}
}
}
stage("Running Mstp tests") {
steps {
script {
//helmBasic.runMstpTests debug: debug, afwImage: params.AUTOMATION_BRANCH
print "Running Mstp tests"
}
}
}
stage("Push charts") {
steps {
script {
parallel charts.collectEntries { chart ->
["${chart}": {
stage("Push ${chart}") {
helmBasic.push(chart, "dev")
}
}]
}
}
}
}
}
post {
always {
script {
helmBasic.updateConsul("delete")
orchestrator.uninstall()
echo "k3s & server chart uninstalled"
helmBasic.removeDockerLocalImages()
cleanWs()
notifyFullJobDetailes subject: "${env.JOB_NAME} Pipeline | ${currentBuild.result}", emails: '[email protected]'
}
}
}
}