diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000000..81d48a902f42 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,93 @@ +# AGENTS.md + +This file provides guidance to AI assistants when working with code in this repository. + +## Repository Overview + +This is kubernetes/test-infra, which contains tools and configuration files for testing and automation needs of the Kubernetes project. The main components are: + +- **Prow Jobs**: CI/CD job configurations at prow.k8s.io (config/jobs/) +- **TestGrid**: Test result visualization at testgrid.k8s.io (testgrid/) +- **Kettle**: Extracts test results from GCS to BigQuery (kettle/) +- **Label Sync**: Manages GitHub labels across repos (label_sync/) +- **Gopherage**: Go coverage file manipulation (gopherage/) +- **Experiment**: One-off tools and scripts (experiment/) + +## Agents Rules + +- Do not remove configurations in config/jobs without explicit instruction from user + +- If promoted to commit changes, commit messages should not acknowledge use of agent via or . + +## Building and Testing + +@CONTRIBUTING.md + +## Dependency Management + +@docs/deps.md + +## Working with Prow Jobs + +@config/jobs/README.md + +### Generated Jobs + +Some jobs are auto-generated and should NOT be edited directly: + +- **Image validation jobs**: Edit releng/test_config.yaml then run `./hack/update-generated-tests.sh` +- **Release branch jobs**: Use releng/config-forker to fork master jobs for new release branches + +Always run `make verify-generated-jobs` before submitting PRs. + +## TestGrid Configuration + +@testgrid/README.md + +## Repository Structure + +Key directories: + +- **config/**: Prow configuration and job definitions + - **config/jobs/**: All prow job configs (org/repo structure) + - **config/prow/**: Prow cluster configuration + - **config/testgrids/**: TestGrid dashboard configs +- **hack/**: Build and test scripts + - **hack/make-rules/**: Make targets for testing/verification + - **hack/tools/**: Tool dependencies (gotestsum, etc.) +- **releng/**: Release engineering tools + - **releng/config-forker**: Fork jobs for new release branches + - **releng/test_config.yaml**: Image validation job config +- **pkg/**: Shared Go packages (minimal, most moved to prow repo) +- **testgrid/**: TestGrid-specific configs and docs +- **kettle/**: BigQuery data pipeline +- **label_sync/**: GitHub label management +- **experiment/**: Ad-hoc scripts and tools + +## Architecture Notes + +- Prow jobs run in Kubernetes pods on the prow.k8s.io cluster +- Test results stored in GCS buckets (kubernetes-ci-logs) +- Kettle extracts GCS results → BigQuery for metrics/analysis +- TestGrid reads from GCS to display historical results +- GitHub webhooks trigger presubmit jobs on PRs +- Jobs use presets (defined in config/prow/config.yaml) for common credentials/config + +## Common Workflows + +### Updating Job Configs + +1. Edit YAML in config/jobs/org/repo/ +2. Run `make verify` to check for issues +3. Commit and open PR +4. Changes auto-deploy on merge + +### Adding New Release Branch Jobs + +```bash +go run ./releng/config-forker \ + --job-config $(pwd)/config/jobs \ + --version 1.27 \ + --go-version 1.20.2 \ + --output $(pwd)/config/jobs/kubernetes/sig-release/release-branch-jobs/1.27.yaml +``` diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000000..43c994c2d361 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85290a3d769b..18cc91d24dfe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,11 +79,61 @@ If you're not sure where to contribute or what any of these mean, please see ### Build and Test -We use make rules to build, test and deploy code in this repo. In most -cases you can get by just fine with: +#### Running Tests -``` +```bash +# Run all tests (Go + Python unit tests) make test + +# Run only Go unit tests +make go-unit + +# Run only Python unit tests +make py-unit + +# Test a specific Go package or folder +hack/make-rules/go-test/unit.sh +# Examples: +hack/make-rules/go-test/unit.sh kettle/... +hack/make-rules/go-test/unit.sh pkg/benchmarkjunit/... +``` + +#### Verification and Linting + +```bash +# Run all verification checks +make verify + +# Run specific verifications +make go-lint # golangci-lint checks +make verify-gofmt # Go formatting +make verify-eslint # TypeScript/JavaScript linting +make py-lint # Python linting +make verify-boilerplate # License header checks +make verify-yamllint # YAML linting +make verify-spelling # Spell checking +make verify-labels # GitHub label validation +make verify-file-perms # File permission checks +make verify-generated-jobs # Verify generated jobs are up to date +``` + +#### Auto-fixing Issues + +```bash +# Auto-format Go code +make update-gofmt + +# Update Go dependencies (after changing go.mod) +make update-go-deps + +# Auto-fix spelling mistakes +make update-spelling + +# Update file permissions +make update-file-perms + +# Regenerate generated job configs +make generate-jobs ``` ### Dependency Management diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 000000000000..43c994c2d361 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1 @@ +@AGENTS.md