Skip to content

Commit dc80129

Browse files
docs: usage approaches defined
Signed-off-by: Wilfred Almeida <[email protected]>
1 parent df0aaaf commit dc80129

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

proposals/new/versatile-replication-filters.md

+120
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,123 @@ src/pkg/reg/util
121121
├── util.go
122122
└── util_test.go
123123
```
124+
125+
126+
---
127+
128+
# Proposal Updates as per discussions
129+
130+
Proposal updates as per discussion with [Vadim Bauer](https://twitter.com/vad1mo)
131+
132+
Approach 2 specified in the proposal on taking regular expression from users is favored more.
133+
134+
Various approaches to get this done that we discussed are as follows:
135+
136+
137+
138+
1. **Add a new input field for regex:**
139+
140+
An additional input field to take user input can be added as follows along with the existing ones. Users can input an expression that will be matched against the artifacts' name, label, and tag.
141+
142+
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682791477555/dcc6ea2d-be9f-4343-acc0-a633638e9a0b.png)
143+
144+
145+
**Pros:**
146+
147+
* No migration is needed. Existing rules will continue working.
148+
149+
* Users can switch to regex-based filtering at their convenience.
150+
151+
152+
**Cons:**
153+
154+
* Logical and development complexity as novice users might need/try to combine regex and glob-based filtering which is complex to understand and develop.
155+
156+
* The development effort needed is significant. UI portal, databases, API handlers, and filtering logic are some of the components that need to be modified which is time-consuming, complex, and has the potential of breaking and causing bugs.
157+
158+
159+
160+
2. **Accept regular expressions in existing input fields and distinguish between glob pattern and regex using some specifier like** `/<regex>/` **as follows**
161+
162+
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682791786810/47f44272-f632-49a3-93ca-9a4b5df02d6a.png)
163+
164+
165+
**Pros:**
166+
167+
* Reuse of existing UI
168+
169+
* Existing filters continue working
170+
171+
172+
**Cons:**
173+
174+
* Users might try to combine glob and regex rules which is complex to handle on the backend
175+
176+
* Distinguishing between the glob rule and regex rule might fail at the backend due to unidentified edge cases
177+
178+
* Database schema change needed to store glob rule and regex separately or a status field to indicate if a rule is a glob or regex
179+
180+
181+
182+
3. **Provide an option for choosing between glob and regex like following**
183+
184+
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682792140270/b081d468-d45f-427f-a2f1-98254df55f77.png)
185+
186+
187+
**Pros:**
188+
189+
* Easy to understand and use
190+
191+
* Seamless, convenient migration
192+
193+
194+
**Cons:**
195+
196+
* UI, API, and Database schema changes are needed to accept, process, and store regex rules which is a lot of work
197+
198+
* Higher development and maintenance complexity
199+
200+
201+
202+
203+
4. **Depreciate glob pattern and migrate completely to regex**
204+
205+
Pros:
206+
207+
* Instant migration to regex rules
208+
209+
* No need to maintain both regex and glob
210+
211+
212+
Cons:
213+
214+
* Will break all existing installations and cause heavy migrations
215+
216+
217+
218+
219+
5. **Accept both regex and glob on UI, implement regex filtering and convert glob rules to regex in the backend**
220+
221+
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1682792611965/2eba4664-3760-46e9-aacd-e91cf0d528bf.png)
222+
223+
224+
Existing glob rules stored in the database in can be converted to regex on runtime.
225+
226+
New rules will be stored as regex
227+
228+
A migration script can be provided to migrate existing glob rules to regex
229+
230+
**Pros:**
231+
232+
* Existing rules continue working
233+
234+
* Regex filtering gets implemented without any change to the UI
235+
236+
237+
**Cons:**
238+
239+
* Needs migration script
240+
241+
* Might break if upgrade versions
242+
243+
* Conversion of glob pattern to regex must have 100% coverage, any unidentified edge cases might break the working.

0 commit comments

Comments
 (0)