Skip to content

Commit 2bdd03a

Browse files
docs: add repo flag validation rules, repo-id guidance, and Jenkins usage (#153)
## Summary - Expanded the repo metadata flags table in the [repositories tutorial](/tutorials/repositories) with detailed descriptions - Added `--repo-url` format section explaining URL validation rules (HTTPS web URLs vs clone URLs vs SSH URLs) - Added `--repo-id` guidance section recommending stable unique identifiers per VCS provider - Added section on using repo flags in unsupported CI systems (e.g. Jenkins) with a Jenkinsfile example - Updated the existing example to include `--repo-id` Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
1 parent a6e2c66 commit 2bdd03a

1 file changed

Lines changed: 49 additions & 5 deletions

File tree

‎tutorials/repositories.md‎

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,57 @@ You can also provide repo metadata explicitly using these flags on `kosli attest
3333

3434
| Flag | Description |
3535
|---|---|
36-
| `--repository` | Name of the git repo as registered in Kosli (e.g. `my-org/my-repo`) |
37-
| `--repo-provider` | VCS provider: `github`, `gitlab`, `bitbucket`, or `azure-devops` |
38-
| `--repo-url` | URL of the repository |
39-
| `--repo-id` | Unique identifier of the repository in the VCS provider |
36+
| `--repository` | Name of the git repo as registered in Kosli (e.g. `my-org/my-repo`). |
37+
| `--repo-provider` | VCS provider: `github`, `gitlab`, `bitbucket`, or `azure-devops`. Must be one of these values if provided. |
38+
| `--repo-url` | URL of the repository. Must be a valid URL with a scheme and host (see URL format details below). |
39+
| `--repo-id` | Unique identifier of the repository in the VCS provider (see choosing a repo ID below). |
40+
41+
All four flags are needed to fully populate repository information in Kosli. In [supported CI systems](/integrations/ci_cd), some of these flags are auto-defaulted from environment variables. In unsupported CI systems (e.g. Jenkins), you must provide all flags explicitly.
42+
43+
### `--repo-url` format
44+
45+
The `--repo-url` flag must be a valid URL with a scheme (`https://`) and a host. The CLI validates this when the flag is provided.
46+
47+
- **HTTPS web URLs** (recommended): `https://github.com/my-org/my-repo` or `https://bitbucket.org/my-workspace/my-repo`
48+
- **HTTPS clone URLs**: `https://bitbucket.org/my-workspace/my-repo.git` — these pass validation and work, but we recommend dropping the `.git` suffix for consistency with how Kosli displays the URL in the app and CLI output.
49+
- **SSH clone URLs**: `git@github.com:my-org/my-repo.git` — these **do not work** because they lack a URL scheme and fail CLI validation.
50+
51+
<Tip>
52+
Use the plain web URL without `.git` (e.g. `https://bitbucket.org/my-workspace/my-repo`). This is the canonical format used across Kosli and matches what appears in the UI and CLI output.
53+
</Tip>
54+
55+
### Choosing a `--repo-id`
56+
57+
The `--repo-id` should be a **stable, unique identifier** for the repository in your VCS provider. Avoid using the repository name, as it can change if the repo is renamed or moved to another provider.
58+
59+
Good choices for `--repo-id`:
60+
- **GitHub**: The numeric repository ID (available via the GitHub API).
61+
- **GitLab**: The `CI_PROJECT_ID` environment variable.
62+
- **Bitbucket**: The `BITBUCKET_REPO_UUID` environment variable (available in Bitbucket Pipelines). If running in Jenkins with a Bitbucket repo, retrieve this value from the Bitbucket API or check a UUID into the repo in a file.
63+
- **Azure DevOps**: The `Build.Repository.ID` predefined variable.
64+
65+
### Using repo flags in unsupported CI systems
66+
67+
If your CI system is not in the [list of supported CI systems](/integrations/ci_cd) (e.g. Jenkins, Bamboo), the CLI cannot auto-default repo metadata from environment variables. You must provide all four flags explicitly — `--repository`, `--repo-provider`, `--repo-url`, and `--repo-id`.
68+
69+
For example, in a Jenkinsfile for a Bitbucket repository:
70+
71+
```shell
72+
kosli attest artifact my-app:latest \
73+
--name my-app \
74+
--flow my-flow \
75+
--trail my-trail \
76+
--artifact-type oci \
77+
--repository my-workspace/my-repo \
78+
--repo-provider bitbucket \
79+
--repo-url https://bitbucket.org/my-workspace/my-repo \
80+
--repo-id "${BITBUCKET_REPO_UUID}" \
81+
--commit $(git rev-parse HEAD)
82+
```
4083

4184
### Attest an artifact with repo metadata
4285

43-
If you are running outside of CI, provide the repo flags explicitly:
86+
If you are running outside of CI or in an unsupported CI system, provide the repo flags explicitly:
4487

4588
```shell
4689
kosli attest artifact my-app:latest \
@@ -51,6 +94,7 @@ kosli attest artifact my-app:latest \
5194
--repository my-org/my-repo \
5295
--repo-provider github \
5396
--repo-url https://github.com/my-org/my-repo \
97+
--repo-id 123456789 \
5498
--commit $(git rev-parse HEAD)
5599
```
56100

0 commit comments

Comments
 (0)