fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/37676?usp=email )


Change subject: OBS: add tag_pattern(), make tag patterns stricter
......................................................................

OBS: add tag_pattern(), make tag patterns stricter

* add a convenience helper to avoid regexp body duplication
* r'[0-9]*' is not strict enough, we want one or more digits
* replace r'[0-9]' with r'\d' to make statements a bit shorter

Change-Id: I6724af203e9ab8783515a6cf34f7263b9903bebe
---
M scripts/obs/lib/config.py
1 file changed, 26 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/76/37676/1

diff --git a/scripts/obs/lib/config.py b/scripts/obs/lib/config.py
index 95f89fd..15d0125 100644
--- a/scripts/obs/lib/config.py
+++ b/scripts/obs/lib/config.py
@@ -114,14 +114,20 @@
     "open5gs": "main",
 }

-git_latest_tag_pattern_default = r'^[0-9]*\.[0-9]*\.[0-9]*$'
+def tag_pattern(prefix: str = '',
+                a: str = r'\d+',
+                b: str = r'\.\d+',
+                c: str = r'\.\d+') -> str:
+    return rf'^{prefix}{a}{b}{c}$'
+
+git_latest_tag_pattern_default = tag_pattern()
 git_latest_tag_pattern_other = {
-        "limesuite": r'^v[0-9]*\.[0-9]*\.[0-9]*$',
-        "open5gs": r'^v[0-9]*\.[0-9]*\.[0-9]*$',
-        "osmo-fl2k": r'^v[0-9]*\.[0-9]*\.[0-9]*$',
-        "rtl-sdr": r'^v[0-9]*\.[0-9]*\.[0-9]*$',
-        "strongswan-epdg": r'^osmo-epdg-[0-9]*\.[0-9]*\.[0-9a-z]*$',
-        "wireshark": r'^v[0-9]*\.[0-9]*\.[0-9a-z]*$',
+        "limesuite": tag_pattern('v'),
+        "open5gs": tag_pattern('v'),
+        "osmo-fl2k": tag_pattern('v'),
+        "rtl-sdr": tag_pattern('v'),
+        "strongswan-epdg": tag_pattern('osmo-epdg-', c=r'\.[0-9a-z]+'),
+        "wireshark": tag_pattern('v', c=r'\.[0-9a-z]+'),
 }

 docker_distro_default = "debian:12"

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/37676?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I6724af203e9ab8783515a6cf34f7263b9903bebe
Gerrit-Change-Number: 37676
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to