# helm uninstall: Command Reference for CI/CD

> Reference for helm uninstall: remove a release and its resources, --keep-history and --wait flags, and a CI preview-environment teardown example.

Source: https://latchkey.dev/learn/command-reference/helm-uninstall-command-cli-reference  
Updated: 2026-06-26

Remove a release and the resources it created.

helm uninstall deletes a release and the objects Helm installed for it. In CI it tears down per-PR preview environments. This reference covers the flags that control history retention and blocking behaviour.

## Common flags and usage

- uninstall <release>: delete the release and its resources
- --namespace <ns>: scope to the release namespace
- --keep-history: retain release history for later inspection
- --wait: block until resources are fully removed
- --ignore-not-found: do not error if the release is absent (idempotent)

## Example

```shell
helm uninstall web-pr-${PR_NUMBER} \
  --namespace previews --ignore-not-found --wait
```

## In CI

Use --ignore-not-found so a teardown job is idempotent and does not fail when the release was already removed. --wait ensures resources are gone before the step returns, which matters if you then delete the namespace. uninstall does not remove a namespace it did not create.

## Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

```Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes
```

> Always set `--request-timeout` in CI. Without it an unreachable API server hangs until the job times out, which turns a thirty-second failure into a twenty-minute one.

## FAQ

### helm uninstall: Command Reference for CI/CD?

helm uninstall deletes a release and the objects Helm installed for it. In CI it tears down per-PR preview environments. This reference covers the flags that control history retention and blocking behaviour.

### In CI?

Use --ignore-not-found so a teardown job is idempotent and does not fail when the release was already removed. --wait ensures resources are gone before the step returns, which matters if you then delete the namespace. uninstall does not remove a namespace it did not create.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
