Files
alma-assignments-reporter/README.md
T
Joe Julian 5f16410960
CI / test (push) Successful in 30s
CI / publish (push) Failing after 27s
Add container publishing and env-based runtime
2026-03-28 15:36:52 -07:00

73 lines
2.0 KiB
Markdown

# Alma Assignments Reporter
This service logs into Alma, reads the `Missing / Revise` assignments table, walks the schedule page to find each class, collects upcoming assignments from each class page, and emails a daily report.
## Configuration
Required when `SEND_EMAIL=true`:
- `SMTP_HOST`
- `EMAIL_FROM`
- `EMAIL_TO`
Recommended settings:
- `ALMA_ASSIGNMENTS_URL=https://example.invalid/children/student-id/assignments`
- `ALMA_SCHEDULE_URL=https://example.invalid/children/student-id/schedule`
- `ALMA_START_DATE=2026-01-20`
- `ALMA_UPCOMING_DAYS=14`
- `ALMA_CREDS_FILE=/config/alma.creds`
- `ALMA_USERNAME`
- `ALMA_PASSWORD`
- `SMTP_PORT=587`
- `SMTP_STARTTLS=true`
- `SMTP_USERNAME`
- `SMTP_PASSWORD`
- `PRINT_REPORT=true`
- `SEND_EMAIL=false`
Any setting can also be supplied via a `*_FILE` variant such as `SMTP_PASSWORD_FILE`.
The Alma credentials can be supplied either by:
- `ALMA_USERNAME` and `ALMA_PASSWORD`
- `ALMA_CREDS_FILE` containing:
```yaml
username: your-alma-username
password: your-alma-password
```
## Local run
```bash
go test ./...
PRINT_REPORT=true SEND_EMAIL=false ALMA_CREDS_FILE=/path/to/alma.creds go run .
```
## CI
This repo includes a Gitea Actions workflow in `.gitea/workflows/ci.yaml`.
It runs on pushes to `main` and pull requests, and currently:
- runs `go test ./...`
- runs `go build .`
- builds and pushes `:main` and `:sha-<commit>` container tags on pushes to `main`
The workflow expects a runner with the `ubuntu-latest` label and a repository Actions secret named `REGISTRY_PASSWORD` that can push to the Gitea container registry. The cluster runner deployed for this repo provides the required runner label.
## Container
Build:
```bash
docker build -t example.invalid/alma-assignments-reporter:latest .
```
The container image uses a static Go binary in `scratch`, with only the CA bundle copied in for HTTPS and SMTP TLS.
## Kubernetes
Use a Secret for Alma and SMTP credentials. The example manifest in `cronjob.example.yaml` reads all runtime settings from Kubernetes secrets and does not require a credentials file mount.