Skip to content

Commit

Permalink
Add helm list command support (#28)
Browse files Browse the repository at this point in the history
* Adding list command support
  • Loading branch information
LeoDiazL authored Mar 17, 2023
1 parent b5bcfbd commit 25cd424
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Although Helm repositories are different than [OCI registries](https://helm.sh/d

See [example below](https://github.com/bitovi/github-actions-deploy-eks-helm#example-3) for reference, but should be similar to using a repo.

### Note on charts list command

You can use the name as a way to filter results, or just leave it blank to get all the charts available.

### Inputs

Following inputs can be used as `step.with` keys
Expand All @@ -23,7 +27,7 @@ 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` or `uninstall` the chart. (Optional, Defaults to `install`) |
| `action` | String | Determines if we `install`/`uninstall` the chart, or `list`. (Optional, Defaults to `install`) |
| `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 @@ -48,7 +52,7 @@ Following inputs can be used as `step.with` keys

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

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

```yaml
- name: Deploy Helm
uses: bitovi/[email protected].2
uses: bitovi/[email protected].3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand All @@ -128,6 +132,20 @@ Following inputs can be used as `step.with` keys
name: release_name
```
## Example List
```yaml
- name: Deploy Helm
uses: bitovi/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
action: list
namespace: dev
name: release_name
```
## Contributing
We would love for you to contribute to [`bitovi/github-actions-deploy-eks-helm`](https://github.com/bitovi/github-actions-deploy-eks-helm). [Issues](https://github.com/bitovi/github-actions-deploy-eks-helm/issues) and [Pull Requests](https://github.com/bitovi/github-actions-deploy-eks-helm/pulls) are welcome!

Expand Down
13 changes: 11 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,25 @@ if [ "${HELM_ACTION}" == "install" ]; then

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

elif [ "${HELM_ACTION}" == "list" ]; then
HELM_COMMAND="helm list"
else
echo "::error:: HELM_ACTION specified doesn't exist in this context. Please use 'install' or 'uninstall'"
echo "::error:: HELM_ACTION specified doesn't exist in this context. Please use 'install','uninstall' or 'list'"
exit 2
fi

if [ -n "$DEPLOY_NAMESPACE" ]; then
HELM_COMMAND="${HELM_COMMAND} -n ${DEPLOY_NAMESPACE}"
fi

if [ "${HELM_ACTION}" == "list" ]; then
if [ -n "$DEPLOY_NAME" ]; then
HELM_COMMAND="${HELM_COMMAND} --filter"
else
HELM_COMMAND="${HELM_COMMAND} --all"
fi
fi

# Execute Commands
HELM_COMMAND="${HELM_COMMAND} ${DEPLOY_NAME}"

Expand Down

0 comments on commit 25cd424

Please sign in to comment.