Skip to content

Commit

Permalink
feat:install helm plugin command (#71)
Browse files Browse the repository at this point in the history
* helm-plugin-install (#66)

Co-authored-by: Brian Vu <[email protected]>

* refactor: rename parameters to snake case

* refactor: install script

* ci: add testing for helm plugin installation

* fix: parameter typo

---------

Co-authored-by: akhon <[email protected]>
  • Loading branch information
brivu and akhon authored Sep 15, 2023
1 parent 781a5fd commit c70afaf
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
steps:
- helm/install_helm_client:
version: << parameters.version >>
helm-plugin-install-test:
docker:
- image: cimg/base:current
parameters:
helm_plugin_url:
type: string
steps:
- helm/install_helm_plugin:
helm_plugin_url: << parameters.helm_plugin_url >>
install-helm-on-eks-cluster:
docker:
- image: cimg/python:3.10
Expand Down Expand Up @@ -164,6 +173,10 @@ workflows:
name: helm-client-install-specific-version
version: v3.0.0
filters: *filters
- helm-plugin-install-test:
name: helm-plugin-install-env
helm_plugin_url: https://github.com/adamreese/helm-env
filters: *filters
- aws-eks/create-cluster:
name: create-cluster-helm4
cluster-name: ${AWS_RESOURCE_NAME_PREFIX}-helm4-eks
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Here are the features that the Helm orb provides:

- Installing the helm client (`install-helm-client`)
- Installing helm charts (`install-helm-chart`) and deleting releases (`delete-helm-release`)
- Installing helm plugin (`helm-plugin-install`)

Table of Contents
=================
Expand Down
30 changes: 30 additions & 0 deletions src/commands/install_helm_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
description: |
Installs a helm plugin.
Requirements: helm should be installed on the cluster
parameters:
helm_plugin_url:
description: |
absolute URL to helm plugin to install
(e.g. https://example.com/helm-plugin/helm-plugin-1.2.3.tgz)
type: string
helm_version:
type: string
default: "v3.8.2"
description: the helm client version to install. e.g. v3.0.0
no_output_timeout:
description: |
Elapsed time that the helm command can run on CircleCI without output.
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
default: "30m"

steps:
- install_helm_client:
version: << parameters.helm_version >>
- run:
name: Install helm plugin
environment:
HELM_STR_PLUGIN_URL: << parameters.helm_plugin_url >>
command: <<include(scripts/install_helm_plugin.sh)>>
no_output_timeout: << parameters.no_output_timeout >>
12 changes: 12 additions & 0 deletions src/scripts/install_helm_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
HELM_STR_PLUGIN_URL="$(echo "${HELM_STR_PLUGIN_URL}" | circleci env subst)"

STATUS="$(helm plugin install "${HELM_STR_PLUGIN_URL}")"

if echo "${STATUS}" | grep "Installed plugin:"; then
echo "Installation successful"
exit 0
else
echo "Installation failed. Please check the Helm plugin URL"
exit 1
fi

0 comments on commit c70afaf

Please sign in to comment.