Skip to content

Commit

Permalink
feat(helmInstall): install helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
jlegrone committed Jun 6, 2018
1 parent 7eb5dae commit 3a4e235
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
19 changes: 19 additions & 0 deletions vars/helmInstall.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env groovy

def call(Map config) {
List<String> arguments = config.getOrDefault('args', [])

if (config.values) {
arguments.add(0, "--values ${config.values}")
}
if (config.version) {
arguments.add("--version ${config.version}")
}
if (config.namespace) {
arguments.add("--namespace ${config.namespace}")
} else if (env.OC_PROJECT) {
arguments.add("--namespace ${env.OC_PROJECT}")
}

sh "helm upgrade --install ${config.name} ${config.chart} --wait --force ${arguments.join(' ')}"
}
36 changes: 36 additions & 0 deletions vars/helmInstall.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Install a helm chart.

<hr>
<br>

<strong>Example Pipeline:</strong>

<pre>
<code>
// ./Jenkinsfile
pipeline {
agent { label 'default' }
stage('Install') {
steps {
helmInstall name: 'jenkins', // the helm release name
namespace: 'myapp-build', // the namespace in which to install the release
chart: 'stable/jenkins', // helm chart to install
version: '0.16.1', // helm chart version
values: 'overrides.yaml', // path to values override file
args: ["--set rbac.serviceAccountName=jenkins"] // additional helm arguments
}
}
}
</code>
</pre>

<br>

<pre>
<code>
# ./overrides.yaml
Master:
Image: quay.io/jlegrone/jenkins
ImageTag: latest
</code>
</pre>

0 comments on commit 3a4e235

Please sign in to comment.