Skip to content

Commit

Permalink
feat!: update parameters (#73)
Browse files Browse the repository at this point in the history
* fix: remove unused parameter

* fix: add default value to parameter

* fix: add validation to run helm repo add command

* ci: edit tests

* fix: remove unused test

* refactor: remove unused parameter

* feat: add debug to upgrade helm chart command

* feat: add debug to install helm chart command

* ci: add testing for debug

* chore: update description
  • Loading branch information
brivu authored Sep 13, 2023
1 parent 6be46e4 commit ce6a016
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 24 deletions.
22 changes: 11 additions & 11 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ jobs:
description: the helm client version to install. e.g. v3.0.0
add_repo:
type: string
default: "https://prometheus-community.github.io/helm-charts"
default: ""
description: the helm chart repository url to use
chart:
type: string
default: "prometheus-community/prometheus"
description: the helm chart to install
update_repositories:
debug:
description: |
Choose to update repositories by running helm repo update.
Enable debug mode
type: boolean
default: true
default: false
steps:
- aws-eks/update-kubeconfig-with-authenticator:
cluster-name: << parameters.cluster-name >>
Expand All @@ -77,7 +77,7 @@ jobs:
add_repo: << parameters.add_repo >>
release_name: << parameters.release_name >>
helm_version: << parameters.helm_version >>
update_repositories: << parameters.update_repositories >>
debug: << parameters.debug >>
upgrade-helm-chart-on-eks-cluster:
docker:
- image: cimg/python:3.10
Expand All @@ -100,11 +100,11 @@ jobs:
type: string
default: "prometheus-community/prometheus"
description: the helm chart to install
update_repositories:
debug:
description: |
Choose to update repositories by running helm repo update.
Enable debug mode
type: boolean
default: true
default: false
steps:
- aws-eks/update-kubeconfig-with-authenticator:
cluster-name: << parameters.cluster-name >>
Expand All @@ -121,7 +121,7 @@ jobs:
chart: << parameters.chart >>
release_name: << parameters.release_name >>
helm_version: << parameters.helm_version >>
update_repositories: << parameters.update_repositories >>
debug: << parameters.debug >>
# test specifying no_output_timeout
no_output_timeout: 25m
delete-helm-release-on-eks-cluster:
Expand Down Expand Up @@ -173,19 +173,19 @@ workflows:
name: install-helm-chart-on-eks-cluster-helm4
helm_version: v3.8.2
# test repo update
update_repositories: true
cluster-name: ${AWS_RESOURCE_NAME_PREFIX}-helm4-eks
add_repo: https://prometheus-community.github.io/helm-charts
chart: prometheus-community/prometheus
debug: true
context: CPE_ORBS_AWS
filters: *filters
requires:
- create-cluster-helm4
- upgrade-helm-chart-on-eks-cluster:
name: upgrade-helm-chart-on-eks-cluster-helm4
helm_version: v3.8.2
update_repositories: false
cluster-name: ${AWS_RESOURCE_NAME_PREFIX}-helm4-eks
debug: true
context: CPE_ORBS_AWS
filters: *filters
requires:
Expand Down
7 changes: 6 additions & 1 deletion src/commands/install_helm_chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ parameters:
The string is a decimal with unit suffix, such as “20m”, “1.25h”, “5s”
type: string
default: "30m"

debug:
description: |
Enable debug mode by adding --debug to helm command. Defaults to false.
type: boolean
default: false
steps:
- install_helm_client:
version: << parameters.helm_version >>
Expand All @@ -84,5 +88,6 @@ steps:
HELM_BOOL_CREATE_NAMESPACE: << parameters.create_namespace >>
HELM_STR_CHART: << parameters.chart >>
HELM_BOOL_WAIT_FOR_JOBS: << parameters.wait_for_jobs >>
HELM_BOOL_DEBUG: << parameters.debug >>
command: <<include(scripts/install_helm_chart.sh)>>
no_output_timeout: << parameters.no_output_timeout >>
5 changes: 0 additions & 5 deletions src/commands/install_helm_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ parameters:
type: string
default: "v3.8.2"
description: the helm client version to install. e.g. v3.8.0
stable_repo_url:
type: string
default: "https://charts.helm.sh/stable"
description: the helm stable repository url to use.

steps:
- run:
name: Install and init the helm client (if necessary)
environment:
HELM_STR_VERSION: << parameters.version >>
HELM_STR_STABLE_REPO_URL: << parameters.stable_repo_url >>
command: <<include(scripts/install_helm_client.sh)>>
12 changes: 7 additions & 5 deletions src/commands/upgrade_helm_chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
The url for the helm chart repository used as part of helm repo add
command
type: string
default: ""
release_name:
description: |
Specify a name for the release.
Expand Down Expand Up @@ -98,11 +99,6 @@ parameters:
command. Format: key1=val1,key2=val2
type: string
default: ""
update_repositories:
description: |
Choose to update repositories by running helm repo update.
type: boolean
default: true
helm_version:
type: string
default: "v3.8.2"
Expand All @@ -119,6 +115,11 @@ parameters:
The --wait flag will be set automatically if --atomic is used
type: boolean
default: false
debug:
description: |
Enable debug mode by adding --debug to helm command. Defaults to false.
type: boolean
default: false
steps:
- install_helm_client:
version: << parameters.helm_version >>
Expand All @@ -144,5 +145,6 @@ steps:
HELM_STR_ADD_REPO: << parameters.add_repo >>
HELM_BOOL_WAIT_FOR_JOBS: << parameters.wait_for_jobs >>
HELM_BOOL_FORCE: << parameters.force >>
HELM_BOOL_DEBUG: << parameters.debug >>
command: <<include(scripts/upgrade_helm_chart.sh)>>
no_output_timeout: << parameters.no_output_timeout >>
3 changes: 3 additions & 0 deletions src/scripts/install_helm_chart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ fi
if [ "${HELM_BOOL_WAIT}" -eq 1 ]; then
set -- "$@" --wait
fi
if [ "${HELM_BOOL_DEBUG}" -eq 1 ]; then
set -- "$@" --debug
fi
if [ -n "${HELM_STR_RELEASE_NAME}" ]; then
helm install "${HELM_STR_RELEASE_NAME}" "${HELM_STR_CHART}" "$@"
else
Expand Down
9 changes: 7 additions & 2 deletions src/scripts/upgrade_helm_chart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ fi
if [ "${HELM_BOOL_FORCE}" -eq 1 ]; then
set -- "$@" --force
fi
if [ "${HELM_BOOL_DEBUG}" -eq 1 ]; then
set -- "$@" --debug
fi

helm repo add "${HELM_STR_RELEASE_NAME}" "${HELM_STR_ADD_REPO}"
helm repo update
if [ -n "${HELM_STR_ADD_REPO}" ]; then
helm repo add "${HELM_STR_RELEASE_NAME}" "${HELM_STR_ADD_REPO}"
helm repo update
fi

helm upgrade --install "${HELM_STR_RELEASE_NAME}" "${HELM_STR_CHART}" "$@"
set +x

0 comments on commit ce6a016

Please sign in to comment.