You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default remains `'{module}/v{version}'` so the behavior is predictable for monorepos.
85
85
86
+
### Large tag repository strategy
87
+
88
+
A repository with hundreds of thousands or millions of tags must not run `git fetch --tags` in every pipeline. The script should support a GitLab API tag source so CI can query only relevant tag names instead of downloading all tag refs and tag objects.
89
+
90
+
Recommended source priority:
91
+
92
+
1.`gitlab-api` in GitLab CI for large repositories.
93
+
2.`ls-remote` for generic remote-only tag discovery when the GitLab API is not available.
94
+
3.`git` local tags only for small repositories or local developer runs.
95
+
96
+
GitLab API query shape:
97
+
98
+
```text
99
+
GET /projects/:id/repository/tags?search=^<module>/v&order_by=version&sort=desc&per_page=100
100
+
```
101
+
102
+
Important notes:
103
+
104
+
- URL-encode the project id/path and the `search` value.
105
+
- GitLab's tag API supports `search` with `^term` for prefix matching and supports `order_by=version` for semantic-version ordering.
106
+
- Still parse and validate versions client-side because tags may include invalid names, non-SemVer tags, or tags from older conventions.
107
+
- For RC generation, query the narrowest prefix possible, for example `^token-rotate/v1.5.0-rc.`.
108
+
- If a module has more than one page of matching tags, follow pagination headers or keyset pagination. Do not assume the first page is sufficient unless the query prefix is narrow enough to prove it.
109
+
110
+
GitLab CI should keep checkout shallow and prevent runner auto-fetching tags:
Avoid branch reachability checks such as `git tag --merged` in the first version because they require commit history and defeat shallow-checkout performance. Tags are global refs, not branch-local refs. If the business rule needs branch-specific versions, encode the release line into the tag prefix or branch name instead of trying to infer it from commit reachability.
141
+
86
142
### Branch/mode strategy
87
143
88
144
Support both auto-detection and explicit mode:
@@ -183,7 +239,15 @@ Options:
183
239
Write CI dotenv output.
184
240
185
241
--fetch-tags
186
-
Run git fetch --tags before reading tags.
242
+
Run git fetch --tags before reading tags. Intended only for small repos.
243
+
244
+
--tag-source git|gitlab-api|ls-remote
245
+
Tag discovery source. Default: git for local runs, gitlab-api when GitLab CI
246
+
variables are present. Large repositories should use gitlab-api.
247
+
248
+
--gitlab-token-var NAME
249
+
CI/CD variable that contains a GitLab API token. Default: CI_JOB_TOKEN,
250
+
falling back to GITLAB_TOKEN. Never print this value.
187
251
188
252
--repo PATH
189
253
Repository path. Default: current working directory.
@@ -583,7 +647,69 @@ git commit -m "feat: discover semantic version tags from git"
583
647
584
648
---
585
649
586
-
### Task 5: Implement patch version calculation
650
+
### Task 5: Add GitLab API tag discovery for large repositories
651
+
652
+
**Objective:** Query only module-relevant tags from GitLab without fetching all tags into the job workspace.
0 commit comments