Thank you for your interest in contributing to the Addon project.
- Setup: Install Go 1.22.7+, operator-sdk v1.21.0
- Install tools:
make tools - Run pre-commit:
pip install pre-commit && pre-commit install - Build:
make go-build - Test:
make go-test - Lint:
make go-check
See DEVELOPMENT.md for detailed setup instructions.
All contributions must pass:
- Formatting & linting:
pre-commit run --all-files - Unit tests:
make go-test - Build verification:
make go-build - Security scan: Automatic via pre-commit (gitleaks)
# Create a feature branch
git checkout -b feature/my-change
# Make changes, following existing code patterns
# Add/update tests for your changes
# Run validation locally
pre-commit run --all-files
make go-test
# Commit with descriptive message
git commit -m "feat: add support for X"
# Push and create PR
git push origin feature/my-changeWhen using AI coding agents (Claude Code, GitHub Copilot, Cursor, etc.):
Agents MUST:
- Run
pre-commit runon changed files before committing - Execute relevant tests after code changes:
make go-test - Preserve existing code style and patterns
- Avoid editing generated files (
**/zz_generated.*.go,go.sumwithoutgo.mod) - Never bypass hooks with
--no-verify - Never commit secrets, tokens, or credentials
- Reuse existing utilities and abstractions
- Make incremental, focused changes
Validation expectations:
- Format check:
go fmt ./... - Lint:
make go-check(orpre-commit run golangci-lint) - Type safety: Verified by
go build ./...in pre-commit - Tests:
make go-testfor affected packages - Secret scan: Automatic via pre-commit gitleaks hook
Required checks before PR:
- All pre-commit hooks pass
- Unit tests pass for modified packages
- No new linter warnings introduced
- No secrets or credentials in diff
- Mocks regenerated if interfaces changed:
boilerplate/_lib/container-make generate
Follow existing patterns:
- Standard Go formatting (
gofmt) - golangci-lint rules in
boilerplate/openshift/golang-osd-operator/golangci.yml - Ginkgo/Gomega for tests
- GoMock for interface mocking
- Unit tests required for all new functionality
- Use Ginkgo BDD style:
Describe,Context,It - Mock external dependencies with GoMock
- Aim for meaningful test coverage, not just metrics
See TESTING.md for testing guidelines.
After modifying API types or interfaces:
# Regenerate deepcopy, OpenAPI, mocks (in container for consistency)
boilerplate/_lib/container-make generateNever commit:
- API keys, tokens, passwords
- AWS credentials, kubeconfig files
- Private keys, certificates
.envfiles with secrets- Debug statements printing sensitive data
The pre-commit gitleaks hook will block commits containing secrets.
High-risk changes (requiring extra review):
- Authentication/authorization logic
- RBAC manifests with wildcard permissions
- Network policies
- CI/CD pipeline modifications
- Dockerfile changes
Use conventional commits style:
<type>: <short summary>
<optional body>
<optional footer>
Types: feat, fix, docs, test, refactor, chore, ci
Examples:
feat: add support for fleet notification filteringfix: correct RBAC permissions for service monitortest: add unit tests for network policy handler
- Title: Clear, descriptive summary
- Description: Explain what changed and why
- Testing: Describe how you tested the changes
- CI: All Tekton pipeline checks must pass
- Review: Address review feedback promptly
- Check existing documentation in docs/
- Review similar PRs for patterns
- Ask in PR comments for clarification
All contributions are licensed under Apache 2.0. See LICENSE.