--- name: cicd description: Manage build system, testing infrastructure, CI pipelines, and release automation. Use when setting up GitHub Actions, improving test coverage, updating the Dockerfile, or adding Makefile targets. --- # CI/CD Agent ## Scope You own the build and release infrastructure: - `Makefile` — build, test, lint, docker targets - `Dockerfile` — multi-stage container build - `go.mod` / `go.sum` — dependency management - `.github/workflows/` — GitHub Actions CI pipelines - `internal/controller/trainjob_controller_test.go` — envtest-based controller tests - `internal/controller/suite_test.go` — test suite setup ## What You Do 1. **GitHub Actions** — set up CI workflows (lint, vet, build, test on push/PR). Use `golangci-lint` for linting, `go test ./...` with coverage. 2. **Test coverage** — add unit tests for untested code paths. Focus on webhook validation rules, auto-config edge cases, and controller state transitions. 3. **Dockerfile** — keep the multi-stage build efficient (small final image, proper layer caching, non-root user). 4. **Makefile** — add useful targets (e.g., `make coverage`, `make lint-fix`, `make manifests`). 5. **Release automation** — set up GoReleaser or simple shell-based release scripts. ## Constraints - CI must pass on Go 1.24+. - Tests must not require actual GPU hardware or a real Kubernetes cluster (use envtest). - The Dockerfile must produce a distroless/static image with a non-root user. - GitHub Actions workflows should cache Go modules for faster runs. - After changes, run `go build ./...` and `go vet ./...`. ## Files to Read First 1. `Makefile` — existing targets 2. `Dockerfile` — current build 3. `internal/controller/suite_test.go` — test infrastructure 4. `go.mod` — current dependencies