|
1 | | -# Harbor Next - Claude Code Instructions |
| 1 | +# Harbor Next |
2 | 2 |
|
3 | | -## Project Overview |
| 3 | +Enhanced fork of [goharbor/harbor](https://github.com/goharbor/harbor). Go backend in `src/`, Angular frontend in `src/portal/`, build automation via Taskfile. |
4 | 4 |
|
5 | | -Harbor Next is an enhanced fork of [goharbor/harbor](https://github.com/goharbor/harbor) - a cloud-native container registry. It adds patches, improvements, and CI/CD automation on top of the upstream Harbor project. |
6 | | - |
7 | | -- **Go backend** in `src/` (multi-module, Go 1.25+) |
8 | | -- **Angular frontend** in `src/portal/` (Angular 16, built with Bun) |
9 | | -- **Build automation** via Taskfile (see `Taskfile.yml` and `taskfile/`) |
10 | | - |
11 | | -## Key Commands |
| 5 | +## Commands |
12 | 6 |
|
13 | 7 | ```bash |
14 | | -task build # Build all Go binaries (linux/amd64 locally, multi-arch in CI) |
15 | | -task test:quick # API spec lint + unit tests (fast) |
16 | | -task test:ci # Full CI pipeline with reports |
17 | | -task test:unit # Go unit tests with race detection |
18 | | -task test:lint # golangci-lint via Docker |
19 | | -task test:lint:api # Swagger spec lint via Spectral Docker |
20 | | -task images # Build and push all Docker images |
21 | | -task dev:up # Start full dev environment with hot reload |
22 | | -task info # Print version and build info |
23 | | -``` |
24 | | - |
25 | | -## Contribution Workflow |
26 | | - |
27 | | -All changes go through PRs - never push directly to `main`. |
28 | | - |
| 8 | +task build # Build Go binaries |
| 9 | +task test:quick # API lint + unit tests |
| 10 | +task test:ci # Full CI pipeline |
| 11 | +task images # Build/push Docker images |
| 12 | +task dev:up # Local dev with hot reload |
29 | 13 | ``` |
30 | | -git checkout -b feat/my-feature |
31 | | -# ... make changes with conventional commits (git commit -s) ... |
32 | | -git push origin feat/my-feature |
33 | | -gh pr create |
34 | | -``` |
35 | | - |
36 | | -PR title must follow Conventional Commits with lowercase type prefix and capitalized subject: `feat: Add New Feature`, `fix: Resolve Issue`, `docs: Update README`, etc. |
37 | | -All commits require DCO sign-off: `git commit -s`. |
38 | | - |
39 | | -**PR description** must follow this template: |
40 | | - |
41 | | -```markdown |
42 | | -## Summary |
43 | | -<!-- Brief description of what this PR does --> |
44 | | - |
45 | | -## Related Issues |
46 | | -<!-- Fixes #123 --> |
47 | | - |
48 | | -## Type of Change |
49 | | -- [ ] Bug fix (`fix:`) |
50 | | -- [ ] New feature (`feat:`) |
51 | | -- [ ] Breaking change (`feat!:` / `fix!:`) |
52 | | -- [ ] Documentation (`docs:`) |
53 | | -- [ ] Refactoring (`refactor:`) |
54 | | -- [ ] CI/CD or build changes (`ci:` / `build:`) |
55 | | -- [ ] Dependencies update (`chore:`) |
56 | | -- [ ] Tests (`test:`) |
57 | | - |
58 | | -## Release Notes |
59 | | -<!-- |
60 | | -Optional. Fill in for user-facing changes (new features, breaking changes, deprecations). |
61 | | -Leave blank for ci:/chore:/refactor:/docs:/test: PRs. |
62 | | ---> |
63 | | - |
64 | | -## Testing |
65 | | -- [ ] Unit tests added/updated |
66 | | -- [ ] Manual testing performed |
67 | | - |
68 | | -## Checklist |
69 | | -- [ ] PR title follows [Conventional Commits](https://www.conventionalcommits.org/) format |
70 | | -- [ ] Commits are signed off (`git commit -s`) |
71 | | -- [ ] No new warnings introduced |
72 | | -``` |
73 | | - |
74 | | -**Merging PRs:** Always use **Squash and merge**. Never "Create a merge commit" or "Rebase and merge". Non-squash merges create `Merge pull request #N` commits that break release-please's commit parser. |
75 | | - |
76 | | -## Release Process |
77 | | - |
78 | | -Releases are automated via release-please: |
79 | | -1. Merge any `feat:` or `fix:` PR to `main` |
80 | | -2. Release-please opens a "chore: release X.Y.Z" PR automatically |
81 | | -3. Review the PR (it updates `VERSION` and `CHANGELOG.md`) |
82 | | -4. Merge the release PR -> GitHub Release is created + images are built and pushed |
83 | | - |
84 | | -Version bump rules: |
85 | | -- `fix:` -> patch (2.15.0 -> 2.15.1) |
86 | | -- `feat:` -> minor (2.15.0 -> 2.16.0) |
87 | | -- `feat!:` or `BREAKING CHANGE:` footer -> major |
88 | | - |
89 | | -`ci:`, `build:`, `chore:`, `test:` commits are hidden from release notes. |
90 | | - |
91 | | -**exclude-paths:** Commits that only touch `.github/`, `docs/`, or `tests/` do NOT trigger a version bump even with `feat:` or `fix:`. Use `ci:` for CI-only changes to avoid misleading PR titles. |
92 | | - |
93 | | -## File Structure |
94 | | - |
95 | | -``` |
96 | | -Taskfile.yml # Root task runner (includes taskfile/*.yml) |
97 | | -taskfile/ |
98 | | - build.yml # Go binary compilation, swagger codegen |
99 | | - image.yml # Docker multi-arch image builds |
100 | | - test.yml # Linting, unit tests, vulnerability scanning |
101 | | - dev.yml # Local dev environment (docker-compose) |
102 | | -versions.env # Pinned versions for all tools and base images |
103 | | -VERSION # Current release version (managed by release-please) |
104 | | -src/ # Go backend source |
105 | | - go.mod |
106 | | - core/ # Core registry service |
107 | | - jobservice/ # Background job service |
108 | | - registryctl/ # Registry controller |
109 | | - cmd/exporter/ # Prometheus exporter |
110 | | - portal/ # Angular frontend |
111 | | - package.json |
112 | | - bun.lock |
113 | | -api/v2.0/swagger.yaml # Harbor REST API spec |
114 | | -dockerfile/ # Dockerfiles for each service |
115 | | -devenv/ # Docker Compose for local development |
116 | | -.github/workflows/ # CI/CD pipelines |
117 | | -``` |
118 | | - |
119 | | -## GitHub Actions Workflows |
120 | | - |
121 | | -| Workflow | Trigger | Purpose | |
122 | | -|----------|---------|---------| |
123 | | -| `build.yml` | PRs to main | Compile check | |
124 | | -| `test.yml` | PRs to main | Unit tests + API lint | |
125 | | -| `release-please.yml` | Push to main | Release PR automation + image publishing | |
126 | | -| `pr-title.yml` | PR opened/edited | Enforce conventional commit format | |
127 | | -| `labeler.yml` | PR opened | Auto-label by component | |
128 | | -| `dependency-review.yml` | PRs to main | Block high-severity CVEs | |
129 | | -| `spellcheck.yml` | PRs + main | Typos in docs/configs | |
130 | | -| `scorecard.yml` | Weekly + main | OpenSSF security score | |
131 | | -| `welcome.yml` | First issue/PR | Welcome new contributors | |
132 | | - |
133 | | -## Local Git Hooks (lefthook) |
134 | 14 |
|
135 | | -Install: `lefthook install` (requires [lefthook](https://github.com/evilmartians/lefthook)) |
| 15 | +## PRs |
136 | 16 |
|
137 | | -Hooks enforce: |
138 | | -- Spell check on staged `.md`/`.yml` files |
139 | | -- Conventional commit message format |
140 | | -- DCO sign-off on every commit |
| 17 | +- Branch off `main`, never push direct. |
| 18 | +- Conventional Commits, capitalized subject: `feat: Add Foo`, `fix: Resolve Bar`. |
| 19 | +- DCO sign-off required: `git commit -s`. |
| 20 | +- **Squash and merge only** — other merge types break release-please. |
| 21 | +- No `Co-Authored-By` / AI attribution trailers. |
141 | 22 |
|
142 | | -## Image Registry |
| 23 | +## Release-please |
143 | 24 |
|
144 | | -Images are pushed to `8gears.container-registry.com/8gcr/` by default. |
145 | | -Override with `REGISTRY_ADDRESS` and `REGISTRY_PROJECT` vars (e.g., `task image:all-images REGISTRY_ADDRESS=ttl.sh REGISTRY_PROJECT=harbor-next`). |
| 25 | +`feat:` → minor, `fix:` → patch, `feat!:` / `BREAKING CHANGE:` → major. `ci:`, `build:`, `chore:`, `test:` are hidden from release notes. |
146 | 26 |
|
147 | | -Required secrets for image publishing: `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`. |
| 27 | +**exclude-paths:** changes touching only `.github/`, `docs/`, or `tests/` don't bump version — use `ci:` for CI-only changes. |
148 | 28 |
|
149 | | -## AI Commits |
| 29 | +## Registry |
150 | 30 |
|
151 | | -Do not add `Co-Authored-By` or any AI attribution trailers to commit messages. |
| 31 | +Default: `8gears.container-registry.com/8gcr/`. Override with `REGISTRY_ADDRESS` / `REGISTRY_PROJECT`. Publishing needs `REGISTRY_USERNAME` / `REGISTRY_PASSWORD` secrets. |
0 commit comments