|
1 | | -# Welcome to the OCM community |
| 1 | +# Contributing to the OCM CLI |
2 | 2 |
|
3 | | -We welcome many different types of contributions. |
| 3 | +For the general contribution process (fork-and-pull workflow, commit requirements, code of conduct, and more), see the |
| 4 | +[central contributing guide](https://ocm.software/community/contributing/) on the project website. |
4 | 5 |
|
5 | | -Please refer to the [Contributing Guide in the Community repository](https://github.com/open-component-model/.github/blob/main/CONTRIBUTING.md) for more information on how to get support from maintainers, find work to contribute, the Pull Request checklist, the Pull Request process, and other useful information on how to contribute to OCM. |
| 6 | +This document covers repository-specific development details. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +- **Go 1.26+** |
| 11 | +- **Make** |
| 12 | +- **Docker** — required for integration tests |
| 13 | + |
| 14 | +## Project Structure |
| 15 | + |
| 16 | +```text |
| 17 | +. |
| 18 | +├── api/ # Core Go library (OCM, OCI, credentials, datacontext) |
| 19 | +├── cmds/ # CLI entry-points and plugins |
| 20 | +├── components/ # Component definitions for building OCM component versions |
| 21 | +├── docs/ # CLI reference, plugin reference, ADRs |
| 22 | +├── examples/ # Usage examples |
| 23 | +├── hack/ # Development scripts (generate, format, install, cross-build) |
| 24 | +├── Makefile # Build automation |
| 25 | +└── VERSION # Current version |
| 26 | +``` |
| 27 | + |
| 28 | +## Common Tasks |
| 29 | + |
| 30 | +```bash |
| 31 | +# Build all binaries |
| 32 | +make build |
| 33 | + |
| 34 | +# Run all tests (unit + integration; requires Docker) |
| 35 | +make test |
| 36 | + |
| 37 | +# Run unit tests only |
| 38 | +make unit-test |
| 39 | + |
| 40 | +# Format code (gci + gofumpt) |
| 41 | +make format |
| 42 | + |
| 43 | +# Lint |
| 44 | +make check |
| 45 | + |
| 46 | +# Lint with auto-fix |
| 47 | +make check-fix |
| 48 | + |
| 49 | +# Full pipeline: generate, format, build, test, lint |
| 50 | +make prepare |
| 51 | + |
| 52 | +# Install dev dependencies (vault, oci-registry, ...) |
| 53 | +make install-requirements |
| 54 | +``` |
| 55 | + |
| 56 | +## Testing |
| 57 | + |
| 58 | +Tests use [Ginkgo](https://onsi.github.io/ginkgo/) and [Gomega](https://onsi.github.io/gomega/). |
| 59 | + |
| 60 | +| Build tag | Purpose | Requirements | |
| 61 | +|-----------|---------|--------------| |
| 62 | +| *(none)* | Unit tests | Go only | |
| 63 | +| `integration` | Integration tests | Docker, vault, oci-registry | |
| 64 | +| `docker_test` | Docker-specific tests | Docker | |
| 65 | +| `unix` | Unix-specific tests | Linux / macOS | |
| 66 | + |
| 67 | +`make test` runs all tags. `make unit-test` runs without tags. |
| 68 | + |
| 69 | +## Linting and Formatting |
| 70 | + |
| 71 | +- **Linter**: golangci-lint, configured in `.github/config/golangci.yaml` |
| 72 | +- **Import order** (gci): standard, blank, dot, default, `ocm.software/ocm` prefix |
| 73 | +- **Formatter**: gofumpt |
| 74 | + |
| 75 | +## Code Generation |
| 76 | + |
| 77 | +```bash |
| 78 | +make generate # go generate |
| 79 | +make generate-deepcopy # controller-gen for api/ocm/compdesc/ |
| 80 | +``` |
| 81 | + |
| 82 | +Run these before committing if you change types or CLI commands. |
| 83 | + |
| 84 | +## Pull Requests |
| 85 | + |
| 86 | +PR titles must follow [Conventional Commits](https://www.conventionalcommits.org/): |
| 87 | + |
| 88 | +```text |
| 89 | +<type>(<optional scope>): <description> |
| 90 | +``` |
| 91 | + |
| 92 | +Allowed types: `feat`, `fix`, `chore`, `docs`, `test`, `perf` |
| 93 | + |
| 94 | +## Questions? |
| 95 | + |
| 96 | +- [Project issues](https://github.com/open-component-model/ocm-project/issues) |
| 97 | +- [Repository issues](https://github.com/open-component-model/ocm/issues) |
| 98 | +- [Community engagement](https://ocm.software/community/engagement/) |
| 99 | +- [NeoNephos Code of Conduct](https://github.com/neonephos/.github/blob/main/CODE_OF_CONDUCT.md) |
0 commit comments