-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile-dev.deploy
68 lines (65 loc) · 1.63 KB
/
Jenkinsfile-dev.deploy
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
pipeline {
agent {
kubernetes {
cloud 'kubernetes-dev'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
jenkins-agent: agent
spec:
serviceAccountName: helm
containers:
- name: helm
image: lachlanevenson/k8s-helm:v3.1.1
command:
- cat
tty: true
"""
}
}
stages {
stage("Checking out codebase") {
steps {
script {
checkout scm
config = readProperties file: 'Jenkinsfile.config'
}
}
}
stage("Linting helm chart for application") {
steps {
container("helm") {
lintHelmChart(
helmChartDir: "${config.helm_chart_dir}"
)
}
}
}
stage("Appying helm chart app to k8s cluster") {
steps {
container("helm") {
applyHelmChart(
helmChartDir: "${config.helm_chart_dir}",
applicationName: "${config.application_name}"
)
}
}
}
}
}
def lintHelmChart(Map stepParams) {
dir("${stepParams.helmChartDir}") {
sh "helm lint ./ -f values-dev.yaml"
}
}
def applyHelmChart(Map stepParams) {
stage("Setting up the Nodejs Hello application") {
dir("${stepParams.helmChartDir}") {
sh "helm dependency update"
sh "helm upgrade ${stepParams.applicationName} ./ -f values-dev.yaml --namespace default --install"
}
}
}
config = null