-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
59 lines (43 loc) · 1.25 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
@Library('jenkinsBuildLibs@helm')
import com.smarsh.pipeline.helm
properties (
[[ $class: 'BuildDiscarderProperty', strategy: [ $class: 'LogRotator', numToKeepStr: '30' ] ]]
)
name = "${env.JOB_NAME}"
ID = name.tokenize('/')[0]
def podName = "${ID}-${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
podTemplate(label: podName, containers: [
containerTemplate(name: 'kubectl', image: 'quay.io/smarsh/jnlp-slave', ttyEnabled: true, alwaysPullImage: true, command: 'cat')
])
{
currentBuild.result = "SUCCESS"
node(podName) {
// grab the latest code
stage('Checkout') {
checkout scm
}
try {
container('kubectl') {
stage('Helm Lint') {
// chart name must match directory name, so move files around
sh '''
mkdir elasticsearch
mv Chart.yaml README.md templates values.yaml elasticsearch
helm lint elasticsearch
'''
}
stage('Helm DryRun') {
sh "helm install elasticsearch --dry-run --debug"
}
stage('Helm Package Chart') {
sh "Package up Helm Chart"
}
stage('Helm Publish Chart') {
sh "Publish Helm Chart"
}
}
} catch (err) {
currentBuild.result = "FAILURE"
}
}
}