Skip to content

Commit 46555a6

Browse files
authored
Added dry-run option to action (#31)
1 parent 6fc5da1 commit 46555a6

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Following inputs can be used as `step.with` keys
2727
| `aws-region` | String | AWS region to use. This must match the region your desired cluster lies in. |
2828
| `cluster-name` | String | The name of the desired cluster. |
2929
| `cluster-role-arn` | String | If you wish to assume an admin role, provide the role arn here to login as. |
30-
| `action` | String | Determines if we `install`/`uninstall` the chart, or `list`. (Optional, Defaults to `install`) |
30+
| `action` | String | Determines if we `install`/`uninstall` the chart, or `list`. (Optional, Defaults to `install`) |
31+
| `dry-run` | Boolean | Toggles `dry-run` option for `install`/`uninstall` action. (Defaults to `false`) |
3132
| `config-files` | String | Comma separated list of helm values files. |
3233
| `namespace` | String | Kubernetes namespace to use. Will create if it does not exist |
3334
| `values` | String | Comma separated list of value set for helms. e.x:`key1=value1,key2=value2` |
@@ -37,7 +38,7 @@ Following inputs can be used as `step.with` keys
3738
| `version` | String | The version of the chart (Optional) |
3839
| `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) |
3940
| `timeout` | String | The value of the timeout for the helm release |
40-
| `update-deps` | String | Update chart dependencies |
41+
| `update-deps` | Boolean | Update chart dependencies |
4142
| `helm-wait` | String | Add the helm --wait flag to the helm Release (Optional) |
4243
| `atomic` | String | Add the helm --atomic flag if set (Optional) |
4344
| `ca-file` | String | Verify certificates of HTTPS-enabled servers using this CA bundle. |
@@ -52,7 +53,7 @@ Following inputs can be used as `step.with` keys
5253

5354
```yaml
5455
- name: Deploy Helm
55-
uses: bitovi/[email protected].3
56+
uses: bitovi/[email protected].4
5657
with:
5758
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
5859
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -68,7 +69,7 @@ Following inputs can be used as `step.with` keys
6869
## Example 2 - Custom Chart Repo
6970
```yaml
7071
- name: Deploy Helm
71-
uses: bitovi/[email protected].3
72+
uses: bitovi/[email protected].4
7273
with:
7374
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
7475
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -87,7 +88,7 @@ Following inputs can be used as `step.with` keys
8788
## Example 3 - OCI Chart Repo
8889
```yaml
8990
- name: Deploy Helm
90-
uses: bitovi/[email protected].3
91+
uses: bitovi/[email protected].4
9192
with:
9293
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
9394
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -110,7 +111,7 @@ Following inputs can be used as `step.with` keys
110111
aws-region: ${{ env.aws-region }}
111112

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

122123
```yaml
123124
- name: Deploy Helm
124-
uses: bitovi/[email protected].3
125+
uses: bitovi/[email protected].4
125126
with:
126127
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
127128
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -136,7 +137,7 @@ Following inputs can be used as `step.with` keys
136137
137138
```yaml
138139
- name: Deploy Helm
139-
uses: bitovi/[email protected].3
140+
uses: bitovi/[email protected].4
140141
with:
141142
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
142143
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

action.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ inputs:
3737
description: 'Specify whether you want to install or uninstall the target helm chart'
3838
required: false
3939
default: 'install'
40+
dry-run:
41+
description: 'Toggles dry-run flag for install/uninstall actions'
42+
required: false
43+
default: false
4044
chart-path:
4145
description: 'The path of the chart.'
4246
required: false
@@ -107,6 +111,7 @@ runs:
107111
PLUGINS_LIST: ${{ inputs.plugins }}
108112
HELM_ATOMIC: ${{ inputs.atomic }}
109113
HELM_ACTION: ${{ inputs.action }}
114+
DRY_RUN: ${{ inputs.dry-run }}
110115
CA_FILE: ${{ inputs.ca-file }}
111116
CERT_FILE: ${{ inputs.cert-file }}
112117
KEY_FILE: ${{ inputs.key-file }}

deploy.sh

+8
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,17 @@ if [ "${HELM_ACTION}" == "install" ]; then
154154
HELM_COMMAND="${HELM_COMMAND} --dependency-update"
155155
fi
156156

157+
if [ "${DRY_RUN}" == "true" ]; then
158+
HELM_COMMAND="${HELM_COMMAND} --dry-run"
159+
fi
157160

158161
elif [ "${HELM_ACTION}" == "uninstall" ]; then
159162
HELM_COMMAND="helm uninstall --timeout ${TIMEOUT}"
163+
164+
if [ "${DRY_RUN}" == "true" ]; then
165+
HELM_COMMAND="${HELM_COMMAND} --dry-run"
166+
fi
167+
160168
elif [ "${HELM_ACTION}" == "list" ]; then
161169
HELM_COMMAND="helm list"
162170
else

0 commit comments

Comments
 (0)