Skip to content

Commit

Permalink
Added dry-run option to action (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDiazL authored Apr 18, 2023
1 parent 6fc5da1 commit 46555a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Following inputs can be used as `step.with` keys
| `aws-region` | String | AWS region to use. This must match the region your desired cluster lies in. |
| `cluster-name` | String | The name of the desired cluster. |
| `cluster-role-arn` | String | If you wish to assume an admin role, provide the role arn here to login as. |
| `action` | String | Determines if we `install`/`uninstall` the chart, or `list`. (Optional, Defaults to `install`) |
| `action` | String | Determines if we `install`/`uninstall` the chart, or `list`. (Optional, Defaults to `install`) |
| `dry-run` | Boolean | Toggles `dry-run` option for `install`/`uninstall` action. (Defaults to `false`) |
| `config-files` | String | Comma separated list of helm values files. |
| `namespace` | String | Kubernetes namespace to use. Will create if it does not exist |
| `values` | String | Comma separated list of value set for helms. e.x:`key1=value1,key2=value2` |
Expand All @@ -37,7 +38,7 @@ Following inputs can be used as `step.with` keys
| `version` | String | The version of the chart (Optional) |
| `plugins` | String | Comma separated list of plugins to install. e.x:` https://github.com/hypnoglow/helm-s3.git, https://github.com/someuser/helm-plugin.git` (defaults to none) |
| `timeout` | String | The value of the timeout for the helm release |
| `update-deps` | String | Update chart dependencies |
| `update-deps` | Boolean | Update chart dependencies |
| `helm-wait` | String | Add the helm --wait flag to the helm Release (Optional) |
| `atomic` | String | Add the helm --atomic flag if set (Optional) |
| `ca-file` | String | Verify certificates of HTTPS-enabled servers using this CA bundle. |
Expand All @@ -52,7 +53,7 @@ Following inputs can be used as `step.with` keys

```yaml
- name: Deploy Helm
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -68,7 +69,7 @@ Following inputs can be used as `step.with` keys
## Example 2 - Custom Chart Repo
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -87,7 +88,7 @@ Following inputs can be used as `step.with` keys
## Example 3 - OCI Chart Repo
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -110,7 +111,7 @@ Following inputs can be used as `step.with` keys
aws-region: ${{ env.aws-region }}

- name: Install Helm Chart
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-region: ${{ env.aws-region }}
cluster-name: eks-cluster-${{ env.environment }}
Expand All @@ -121,7 +122,7 @@ Following inputs can be used as `step.with` keys

```yaml
- name: Deploy Helm
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -136,7 +137,7 @@ Following inputs can be used as `step.with` keys
```yaml
- name: Deploy Helm
uses: bitovi/[email protected].3
uses: bitovi/[email protected].4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
5 changes: 5 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ inputs:
description: 'Specify whether you want to install or uninstall the target helm chart'
required: false
default: 'install'
dry-run:
description: 'Toggles dry-run flag for install/uninstall actions'
required: false
default: false
chart-path:
description: 'The path of the chart.'
required: false
Expand Down Expand Up @@ -107,6 +111,7 @@ runs:
PLUGINS_LIST: ${{ inputs.plugins }}
HELM_ATOMIC: ${{ inputs.atomic }}
HELM_ACTION: ${{ inputs.action }}
DRY_RUN: ${{ inputs.dry-run }}
CA_FILE: ${{ inputs.ca-file }}
CERT_FILE: ${{ inputs.cert-file }}
KEY_FILE: ${{ inputs.key-file }}
Expand Down
8 changes: 8 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,17 @@ if [ "${HELM_ACTION}" == "install" ]; then
HELM_COMMAND="${HELM_COMMAND} --dependency-update"
fi

if [ "${DRY_RUN}" == "true" ]; then
HELM_COMMAND="${HELM_COMMAND} --dry-run"
fi

elif [ "${HELM_ACTION}" == "uninstall" ]; then
HELM_COMMAND="helm uninstall --timeout ${TIMEOUT}"

if [ "${DRY_RUN}" == "true" ]; then
HELM_COMMAND="${HELM_COMMAND} --dry-run"
fi

elif [ "${HELM_ACTION}" == "list" ]; then
HELM_COMMAND="helm list"
else
Expand Down

0 comments on commit 46555a6

Please sign in to comment.