# frontend-rollback

Reverts a frontend app's unhashed S3 objects (`index*.html`, `manifest`,
`main.dml.js`, etc.) to a previous version. Triggered via the Jenkins
**frontend-rollback** job, which also runs CloudFront cache invalidation
after a successful rollback.

## Jenkins parameters

| Parameter | Required | Description |
|---|---|---|
| `ENV` | Yes | `qa`, `uat`, or `prod` |
| `APP_NAME` | Yes | App folder in S3, e.g. `frontend-insights` |
| `NUMBER_OF_DEPLOYMENTS_TO_ROLLBACK` | Yes | Versions to go back (1–10) |
| `S3_BUCKET` | No | Override default CDN bucket (e.g. `app.qa.theorchard.io`) |

Default buckets: `qa-orcd-cdn`, `uat-orcd-cdn`, `prod-orcd-cdn`.

When `S3_BUCKET` is set, CloudFront and Cloudflare cache invalidations are skipped, since traffic goes directly to the load balancer and does not use CDNs

## Running locally

```sh
APP_NAME=frontend-insights ENV=qa NUMBER_OF_DEPLOYMENTS_TO_ROLLBACK=1 \
  docker compose run --rm frontend-rollback
```

## Development

```sh
./scripts/unit-lint.sh   # lint + tests
make ci_unit_lint         # same, in Docker (wipes build/ first)
```
