Skip to content

Commit cbf9a44

Browse files
authored
docs: add naming convention for flows and trails (#593)
* add naming convention for flows and trails * avoid confusion with org as Kosli org * fix typo
1 parent b63250e commit cbf9a44

3 files changed

Lines changed: 210 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Phase 2: Configure Kosli"
3+
bookCollapseSection: true
4+
weight: 200
5+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Plan Organizational Structure"
3+
bookCollapseSection: true
4+
weight: 100
5+
---
6+
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
title: "Naming Conventions"
3+
bookCollapseSection: false
4+
weight: 200
5+
---
6+
7+
# Naming Conventions
8+
9+
Clear and consistent naming makes it easy for everyone to understand what each item in Kosli represents. Good names help you route attestations correctly and quickly find what you need.
10+
11+
Use these conventions for:
12+
- **Flows** and **Trails**
13+
- **Attestation Types**
14+
- **Environments**
15+
16+
## General Guidelines
17+
18+
The general guidelines should be considered best practices for all naming conventions in Kosli. You can adapt them to fit your organization’s needs, but consistency is key.
19+
20+
All of our proposed conventions follow these general guidelines:
21+
22+
**Structure**: `<element 1>` `<delimiter>` `<element 2>` `<delimiter>`...`<element N>`
23+
24+
25+
1. **Choose Delimiter**: Choose a delimiter that works for your and stick with it consistently.</br>
26+
For example hyphen `-`, underscore `_`, tilde `~` or dot `.`. </br>
27+
Avoid mixing delimiters within the same naming scheme.
28+
2. **Choose case style for elements**: Choose a meaningful case style across elements (e.g., PascalCase, camelCase, snake_case) and use it consistently. Avoid spaces and clashes with delimiters.
29+
3. **Keep it concise**: Shorter names are easier to read and remember. Aim for concise but descriptive names.
30+
4. **Avoid special characters**: Stick to alphanumeric characters and underscores/hyphens
31+
32+
{{% hint warning %}}
33+
Be aware of using underscore `_` as the delimiter, as that conflicts with snake_case for elements.
34+
{{% /hint %}}
35+
36+
{{% hint info %}}
37+
The rest of this document uses hyphen `-` as the delimiter in examples, but you can choose any delimiter that fits your needs.
38+
{{% /hint %}}
39+
40+
### Regular Expression
41+
42+
To help enforce these conventions programmatically, here are sample regular expressions you can use based on your chosen case style.
43+
44+
Adjust the regex if you choose a different delimiter.
45+
46+
{{< tabs "naming-regex" >}}
47+
{{< tab "snake_case" >}}
48+
49+
**Example**: `element_one`-`element_two`-`element_three`
50+
51+
```bash
52+
^[a-z][a-z0-9_]*(-[a-z][a-z0-9_]*)*$
53+
```
54+
55+
{{< /tab >}}
56+
{{< tab "camelCase" >}}
57+
58+
**Example**: `elementOne`-`elementTwo`-`elementThree`
59+
60+
```bash
61+
^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$
62+
```
63+
64+
{{< /tab >}}
65+
{{< tab "PascalCase" >}}
66+
67+
**Example**: `ElementOne`-`ElementTwo`-`ElementThree`
68+
69+
```bash
70+
^[A-Z][a-zA-Z0-9]*(-[A-Z][a-zA-Z0-9]*)*$
71+
```
72+
{{< /tab >}}
73+
{{< /tabs >}}
74+
75+
76+
{{% hint info %}}
77+
If you want a specific length limit (e.g., max 50 characters), you can add a lookahead at the start of the regex:
78+
79+
```bash
80+
^(?=.{1,50}$) # + rest of the regex
81+
```
82+
83+
You can use online regex testers like [regex101](https://regex101.com/) to validate and test these expressions.
84+
85+
{{% /hint %}}
86+
87+
## Flows
88+
89+
A clear naming convention transforms a simple ID into a meaningful identifier that everyone understands. This shared language ensures attestations go to the right place and you can track your releases from start to finish.
90+
91+
### Build Flows
92+
93+
Build Flows represent how code changes move from commit to artifact. Use the following convention to name Build Flows:
94+
95+
**Name Convention:** `org-unit`-`repo`-`[service]`
96+
97+
- **org-unit**: Your organizational unit, division or team name
98+
- **repo**: Your repository name
99+
- **service (Optional)**: The specific service or component that the artifact belongs to
100+
101+
{{% hint info %}}
102+
You can skip `service` if your repository produces only one artifact, i.e. non-monorepo setups.
103+
{{% /hint %}}
104+
105+
{{< tabs "build-flow-examples" >}}
106+
{{< tab "snake_case" >}}
107+
108+
**Examples:**
109+
- `investment-web_app` (single artifact)
110+
- `investment-web_app-frontend` (with service: frontend)
111+
- `devops_team-mobile_app-backend` (with service: backend)
112+
113+
```bash
114+
^[a-z][a-z0-9_]*-[a-z][a-z0-9_]*(-[a-z][a-z0-9_]*)?$
115+
```
116+
117+
{{< /tab >}}
118+
{{< tab "camelCase" >}}
119+
120+
**Examples:**
121+
- `investment-webApp` (single artifact)
122+
- `investment-webApp-frontend` (with service: frontend)
123+
- `devopsTeam-mobileApp-backend` (with service: backend)
124+
125+
```bash
126+
^[a-z][a-zA-Z0-9]*-[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)?$
127+
```
128+
{{< /tab >}}
129+
{{< tab "PascalCase" >}}
130+
131+
**Examples:**
132+
- `Investment-WebApp` (single artifact)
133+
- `Investment-WebApp-Frontend` (with service: frontend)
134+
- `DevOpsTeam-MobileApp-Backend` (with service: backend)
135+
136+
```bash
137+
^[A-Z][a-zA-Z0-9]*-[A-Z][a-zA-Z0-9]*(-[A-Z][a-zA-Z0-9]*)?$
138+
```
139+
{{< /tab >}}
140+
{{< /tabs >}}
141+
142+
### Release Flows
143+
144+
Release Flows represent how artifacts move from build to deployment. Use the following convention to name Release Flows:
145+
146+
**Name Convention:** `org-unit`-`repo`
147+
148+
- **org-unit**: Your organizational unit, division or team name
149+
- **repo**: Your repository name
150+
151+
{{< tabs "release-flow-examples" >}}
152+
{{< tab "snake_case" >}}
153+
**Examples:**
154+
- `investment-web_app`
155+
- `devops_team-mobile_app`
156+
```bash
157+
^[a-z][a-z0-9_]*-[a-z][a-z0-9_]*$
158+
```
159+
{{< /tab >}}
160+
{{< tab "camelCase" >}}
161+
**Examples:**
162+
- `investment-webApp`
163+
- `devopsTeam-mobileApp`
164+
```bash
165+
^[a-z][a-zA-Z0-9]*-[a-z][a-zA-Z0-9]*$
166+
```
167+
{{< /tab >}}
168+
{{< tab "PascalCase" >}}
169+
**Examples:**
170+
- `Investment-WebApp`
171+
- `DevOpsTeam-MobileApp`
172+
```bash
173+
^[A-Z][a-zA-Z0-9]*-[A-Z][a-zA-Z0-9]*$
174+
```
175+
{{< /tab >}}
176+
{{< /tabs >}}
177+
178+
179+
## Trails
180+
181+
### Trails associated with [Build Flows]({{< ref "#build-flows" >}})
182+
183+
**Name Convention:** `sha`
184+
185+
- **sha**: The git commit HEAD SHA that triggered the build.
186+
187+
### Trails associated with [Release Flows]({{< ref "#release-flows" >}})
188+
**Name Convention:** `env`-`pr-number`
189+
190+
- **env**: The target deployment environment (e.g., staging, production)
191+
- **pr-number**: The pull request or change request number associated with the deployment.
192+
193+
**Examples:**
194+
- `staging-42`
195+
- `production-108`
196+
197+
```bash
198+
^[a-z][a-z0-9_]*-[0-9]+$
199+
```

0 commit comments

Comments
 (0)