# CAPA Prow Jobs

Prow job configurations for [cluster-api-provider-aws](https://github.com/kubernetes-sigs/cluster-api-provider-aws).

## Structure

```
cluster-api-provider-aws-prowjob-gen.yaml    # Generator config: branches and test images
templates/
  cluster-api-provider-aws-presubmits.yaml.tpl   # Presubmit job template
  cluster-api-provider-aws-periodics.yaml.tpl    # Periodic job template
cluster-api-provider-aws-presubmits-*.yaml   # Generated presubmit jobs (do not edit)
cluster-api-provider-aws-periodics-*.yaml    # Generated periodic jobs (do not edit)
```

## Regenerating jobs

The job YAML files are generated by `prowjob-gen` from the
[cluster-api](https://github.com/kubernetes-sigs/cluster-api) repo.
Do not edit the generated files directly.

To regenerate after modifying the config or templates:

```bash
cd /path/to/cluster-api/hack/tools

go run sigs.k8s.io/cluster-api/hack/tools/prowjob-gen \
  -config /path/to/test-infra/config/jobs/kubernetes-sigs/cluster-api-provider-aws/cluster-api-provider-aws-prowjob-gen.yaml \
  -templates-dir /path/to/test-infra/config/jobs/kubernetes-sigs/cluster-api-provider-aws/templates \
  -output-dir /path/to/test-infra/config/jobs/kubernetes-sigs/cluster-api-provider-aws
```

## Adding a new release branch

1. Add the branch to `cluster-api-provider-aws-prowjob-gen.yaml` under `branches` with the appropriate `testImage`.
2. Update the templates if the new branch needs different behavior (e.g. mandatory e2e-blocking, periodic exclusions).
3. Run `prowjob-gen` as described above to generate the new files.

## Removing periodic jobs for a branch

The periodic template has an exclusion guard. To stop generating periodics for a branch,
add it to the exclusion list at the top of `templates/cluster-api-provider-aws-periodics.yaml.tpl`:

```
{{- if not (has $.branch (list "release-2.9" "release-2.10")) }}
```
