Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions helm-delete/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Helm Delete Deployment"
description: "Delete a Helm deployment from a Kubernetes cluster"

inputs:
namespace:
description: "The namespace of the Helm release"
required: true
release-name:
description: "The name of the Helm release"
required: true

runs:
using: "composite"
steps:
- name: Delete Helm deployment
env:
HELM_DRIVER: configmaps
run: |
RELEASE_NAME="${{ inputs.release-name }}"
NAMESPACE="${{ inputs.namespace }}"

echo "Checking Helm release: $RELEASE_NAME in namespace: $NAMESPACE"

STATUS_OUTPUT=$(helm status "$RELEASE_NAME" --namespace "$NAMESPACE" 2>&1) && STATUS_EXIT=0 || STATUS_EXIT=$?

if [ $STATUS_EXIT -eq 0 ]; then
echo "Release found. Uninstalling..."
helm uninstall "$RELEASE_NAME" --namespace "$NAMESPACE"
else
if echo "$STATUS_OUTPUT" | grep -qi "forbidden\|cannot list\|unauthorized\|permission"; then
echo "::error::Permission denied when querying release '$RELEASE_NAME'. Check kubeconfig and RBAC permissions."
echo "$STATUS_OUTPUT"
exit 1
else
echo "Release '$RELEASE_NAME' not found, skipping uninstall."
echo "$STATUS_OUTPUT"
fi
fi
shell: bash
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ The following inputs can be used as `step.with` keys:
| `timeout` | `5m` | The timeout for the Helm command |
| `working-directory` | `.` | The working directory where the action commands will operate |

### Delete Helm Deployment

Delete a Helm deployment from a Kubernetes cluster. Checks if the release exists before attempting uninstall and detects permission errors. Requires Kubernetes to be configured first.

#### Example

```yaml
- uses: aboutbits/github-actions-kubernetes/helm-delete@v4
with:
release-name: my-app
namespace: my-namespace
```

#### Inputs

The following inputs can be used as `step.with` keys:

| Name | Required/Default | Description |
|----------------|------------------|--------------------------------|
| `namespace` | required | The namespace of the Helm release |
| `release-name` | required | The name of the Helm release |

### Setup S3 Preview

Creates an S3 preview prefix by copying from the main prefix.
Expand Down