Purpose: For contributors, shows how to contribute code, tests, and documentation to the openCenter-cli project.
Prerequisites
Before contributing, you need:
-
Git installed and configured
-
GitHub account with SSH key configured
-
Mise installed (see development-setup.md[Development Setup])
-
Familiarity with Go and Kubernetes concepts
Fork and Clone
-
Fork the repository on GitHub:
```bash # Navigate to https://github.com/opencenter-cloud/openCenter-cli # Click "Fork" button ``` . Clone your fork:
```bash git clone git@github.com:YOUR-USERNAME/openCenter-cli.git cd openCenter-cli ``` . Add upstream remote:
```bash git remote add upstream git@github.com:opencenter-cloud/openCenter-cli.git ``` . Install development tools:
```bash mise install ``` . Build the project:
```bash mise run build ```
Making Changes
Create a Branch
Always create a feature branch for your changes:
# Update your fork
git fetch upstream
git checkout main
git merge upstream/main
# Create feature branch
git checkout -b feat/my-feature
Branch naming conventions:
-
feat/- New features -
fix/- Bug fixes -
docs/- Documentation changes -
refactor/- Code refactoring -
test/- Test additions or fixes
Write Code
Follow the coding standards defined in .kiro/steering/tech.md:
-
Formatting: Code must be formatted with
gofmt```bash mise run fmt ``` . *Import organization*: Standard library → External → Internal
```go import ( "fmt" "os""github.com/spf13/cobra" "gopkg.in/yaml.v3"
"github.com/opencenter-cloud/opencenter-cli/internal/config" ) ``` . *Naming conventions*: * Exported: `CamelCase` * Unexported: `mixedCase` * Test functions: `TestXxx` * Commands: `newCluster<Action>Cmd()` . *Error handling*: Always wrap errors with context
```go if err != nil { return fmt.Errorf("failed to load config: %w", err) } ```
Write Tests
All behavior changes require tests. See testing-guide.md[Testing Guide] for details.
Required tests:
-
Unit tests for new functions (
*_test.go) -
BDD tests for user-facing features (
tests/features/*.feature) -
Property tests for critical logic (
*_property_test.go)
Run tests before committing:
# Unit tests
mise run test
# BDD tests
mise run godog
# All tests
mise run test && mise run godog
Update Documentation
Documentation changes are required for:
-
New commands or flags
-
Configuration schema changes
-
New features or workflows
-
Breaking changes
Update relevant files in docs/:
-
docs/getting-started/- Learning-oriented guides -
docs/operations/- Task-oriented guides -
docs/reference/- Information-oriented specs -
docs/concepts/- Understanding-oriented concepts
Pre-Commit Checklist
Before committing, always run:
# 1. Build to verify compilation
mise run build
# 2. Format code
mise run fmt
# 3. Run tests
mise run test
# 4. Run BDD tests
mise run godog
# 5. Tidy dependencies (if you added/removed imports)
mise run tidy
If you modified configuration schema:
# Comprehensive schema verification
mise run schema-verify
Commit Messages
Use Conventional Commits format:
<type>: <description>
[optional body]
[optional footer]
Types:
-
feat:- New feature -
fix:- Bug fix -
docs:- Documentation changes -
refactor:- Code refactoring -
test:- Test additions or fixes -
chore:- Build process or tooling changes
Examples:
feat: add support for AWS provider
Implements AWS provider with EC2 instance provisioning,
VPC configuration, and IAM role management.
Closes #123
fix: correct VRRP validation logic
When use_octavia=false and vrrp_enabled=true, vrrp_ip
must be set. Previous validation was too permissive.
Fixes #456
docs: add tutorial for VMware deployment
Adds step-by-step guide for deploying clusters on
pre-provisioned VMware VMs.
Submit Pull Request
-
Push your branch to your fork:
```bash git push origin feat/my-feature ``` . Create pull request on GitHub: * Navigate to https://github.com/opencenter-cloud/openCenter-cli * Click "New Pull Request" * Select your fork and branch * Fill in PR template . PR description must include: * What changed and why * Test commands run * Documentation updates * Breaking changes (if any) * Related issues
Example PR description:
## Changes
Adds support for AWS provider with EC2 provisioning.
## Testing
- `mise run test` - All unit tests pass
- `mise run godog` - All BDD tests pass
- Manual testing with AWS account in us-east-1
## Documentation
- Added `docs/getting-started/aws-deployment.md`
- Updated `docs/reference/providers.md`
- Updated `docs/reference/configuration-schema.md`
## Breaking Changes
None
## Related Issues
Closes #123
Code Review Process
-
Automated checks: CI runs tests and linting
-
Maintainer review: At least one maintainer approval required
-
Address feedback: Make requested changes
-
Merge: Maintainer merges when approved
Responding to feedback:
# Make requested changes
git add .
git commit -m "fix: address review feedback"
git push origin feat/my-feature
Common Contribution Types
Adding a New Command
See code-structure.md[Code Structure] for details.
-
Create
cmd/cluster_<action>.go -
Implement
newCluster<Action>Cmd()function -
Register in
cmd/cluster.go -
Add BDD tests in
tests/features/ -
Update
docs/reference/cli-commands.md
Adding a New Provider
See adding-providers.md[Adding Providers] for details.
-
Create
internal/cloud/<provider>/directory -
Implement preflight checks
-
Add provider defaults in
internal/config/defaults.go -
Add provider validation
-
Update documentation
Adding a New Service
See adding-services.md[Adding Services] for details.
-
Add service to
internal/config/defaults.go -
Create templates in
internal/gitops/gitops-base-dir/ -
Add service validation
-
Update
docs/reference/platform-services.md
Getting Help
Questions about contributing:
-
Open a discussion on GitHub
-
Ask in pull request comments
-
Review existing issues and PRs
Found a bug:
-
Search existing issues first
-
Open new issue with reproduction steps
-
Include version:
opencenter version
Feature requests:
-
Open issue with "enhancement" label
-
Describe use case and proposed solution
-
Discuss before implementing large features
License
By contributing, you agree that your contributions will be licensed under the same license as the project (check LICENSE file in repository root).
Evidence
This documentation is based on the following repository files:
-
Contributing guide:
CONTRIBUTING.md:1-82 -
Development workflow:
.kiro/steering/tech.md:103-118 -
Coding standards:
.kiro/steering/tech.md:5-24 -
Commit conventions:
.kiro/steering/tech.md:26-29 -
Project structure:
.kiro/steering/structure.md:1-128 -
Build system:
.mise.toml:1-961(mise tasks) -
Command structure:
cmd/directory (70+ command files)