Metadata-Version: 2.4
Name: helmrelease-verifier
Version: 0.1.0
Summary: Verify Flux HelmRelease rollout and collect Helm test feedback
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: click<9.0.0,>=8.1.0
Requires-Dist: kubernetes<33.0.0,>=31.0.0
Requires-Dist: pytest<9.0.0,>=8.0.0
Requires-Dist: pytest-html<5.0.0,>=4.1.0
Requires-Dist: pytest-xdist<4.0.0,>=3.6.0

# HelmRelease Verifier

Small Python CLI to verify Flux HelmRelease deployments via the Kubernetes API and publish JUnit-compatible results.

## Local Run

Prerequisites:

- Python 3.11+
- kubeconfig/context with access to target cluster

Single release (pipeline-like):

```bash
uv run helmrelease-verifier verify \
  -r <release> \
  -e <app-version> \
  -o ./results.xml
```

If `-n/--namespace` is omitted, the current kube context namespace is used.

Short alias (same command, fewer keystrokes):

```bash
uv run hrv verify -r <release> -e <app-version>
```

Dynamic pytest sweep across HelmReleases:

```bash
uv run hrv verify -A -r "api|service"
```

All targets in current namespace (omit `-r`):

```bash
uv run hrv verify -o pytest-report.html
```

All targets in all namespaces:

```bash
uv run hrv verify -A -o pytest-report.html
```

Controller selection (repeatable):

```bash
uv run hrv verify -A -c flux -c argo -r "sample"
```

Current Argo CD support is a discovery and pytest stub path. It is intended as extension scaffolding and reports `argo.stub` test cases.

Default sweep behavior: no rollout waiting (`-w 0`). This is ideal for full-cluster audits.

Optional bounded wait per release (seconds):

```bash
uv run hrv verify -A -w 30
```

Optional parallel execution:

```bash
uv run hrv verify -A -P 4
```

Namespace and release filtering:

```bash
uv run hrv verify -n "^(dev|stage|prod)-apps$" -r "service$"
```

Generated by discovery mode:

- Default HTML report: `pytest-report.html`
- Override/add outputs with `-o`:
  - `.html` => pytest HTML report
  - `.xml` => JUnit XML
- Examples:
  - `-o pytest-report.html`
  - `-o results.xml`
  - `-o pytest-report.html -o results.xml`

Using pipx (from repo checkout):

```bash
pipx run --spec . helmrelease-verifier -h
```

Run tests:

```bash
uv run pytest
```

Tool unit tests do not generate an HTML report by default.

If needed:

```bash
uv run pytest --html=pytest-report.html --self-contained-html
```

## CI Integration Examples

Ready-to-copy examples:

- GitHub Actions: `examples/github-actions/verify-helmreleases.yml`
- Azure DevOps Pipelines: `examples/azure-pipelines/verify-helmreleases.yml`

Both examples publish the dynamic pytest HTML report as build artifact and fail the job when one or more HelmReleases fail verification.
Both examples intentionally use `uv` for consistent developer and CI behavior; PyPI publishing is handled by the release workflow.

Repository workflows:

- CI: `.github/workflows/ci.yml`
- Release to PyPI (tag-triggered): `.github/workflows/release.yml`
