| doc_type | how-to |
|---|---|
| title | Contributing to openCenter-cli |
| audience | contributors |
Purpose: For contributors, shows how to contribute code, tests, and documentation to the openCenter-cli project.
Before contributing, you need:
- Git installed and configured
- GitHub account with SSH key configured
- Mise installed (see Development Setup)
- Familiarity with Go and Kubernetes concepts
-
Fork the repository on GitHub:
# Navigate to https://github.com/opencenter-cloud/openCenter-cli # Click "Fork" button
-
Clone your fork:
git clone git@github.com:YOUR-USERNAME/openCenter-cli.git cd openCenter-cli -
Add upstream remote:
git remote add upstream git@github.com:opencenter-cloud/openCenter-cli.git
-
Install development tools:
mise install
-
Build the project:
mise run build
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-featureBranch naming conventions:
feat/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or fixes
Follow the coding standards defined in .kiro/steering/tech.md:
-
Formatting: Code must be formatted with
gofmtmise run fmt
-
Import organization: Standard library → External → Internal
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()
- Exported:
-
Error handling: Always wrap errors with context
if err != nil { return fmt.Errorf("failed to load config: %w", err) }
All behavior changes require tests. See 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 godogDocumentation changes are required for:
- New commands or flags
- Configuration schema changes
- New features or workflows
- Breaking changes
Update relevant files in docs/:
docs/tutorials/- Learning-oriented guidesdocs/how-to/- Task-oriented guidesdocs/reference/- Information-oriented specsdocs/explanation/- Understanding-oriented concepts
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 tidyIf you modified configuration schema:
# Comprehensive schema verification
mise run schema-verifyUse Conventional Commits format:
<type>: <description>
[optional body]
[optional footer]
Types:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Test additions or fixeschore:- 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.
-
Push your branch to your fork:
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/tutorials/aws-deployment.md`
- Updated `docs/reference/providers.md`
- Updated `docs/reference/configuration-schema.md`
## Breaking Changes
None
## Related Issues
Closes #123- 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-featureSee 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
See 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
See 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
- Create failing test that reproduces bug
- Fix the bug
- Verify test now passes
- Add regression test if needed
- Identify documentation gap or error
- Update relevant documentation files
- Follow Diátaxis framework (tutorial/how-to/reference/explanation)
- Include evidence citations where applicable
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
By contributing, you agree that your contributions will be licensed under the same license as the project (check LICENSE file in repository root).
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)