-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helmInstall): install helm charts
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(' ')}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |