Skip to content

Commit 358c51e

Browse files
committed
Using more descriptive REG-EX.
1 parent 0ea82cf commit 358c51e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ general:
2424

2525
deployment:
2626
release:
27+
# See "scripts/circleci_tagged_pkg.py" for info on REGEX
2728
tag: /(([a-z]+)-)*([0-9]+)\.([0-9]+)\.([0-9]+)/
2829
owner: GoogleCloudPlatform
2930
commands:

scripts/circleci_tagged_pkg.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@
2424
import sys
2525

2626

27-
RE_TXT = r'^(?P<pkg>(([a-z]+)-)*)([0-9]+)\.([0-9]+)\.([0-9]+)$'
28-
TAG_RE = re.compile(RE_TXT)
27+
TAG_RE = re.compile(r"""
28+
^
29+
(?P<pkg>
30+
(([a-z]+)-)*) # pkg-name-with-hyphens- (empty allowed)
31+
([0-9]+)\.([0-9]+)\.([0-9]+) # Version x.y.z (x, y, z all ints)
32+
$
33+
""", re.VERBOSE)
2934
TAG_ENV = 'CIRCLE_TAG'
3035
ERROR_MSG = '%s env. var. not set' % (TAG_ENV,)
31-
BAD_TAG_MSG = 'Invalid tag name: %s. Expected ' + RE_TXT
36+
BAD_TAG_MSG = 'Invalid tag name: %s. Expected pkg-name-x.y.z'
3237
_SCRIPTS_DIR = os.path.dirname(__file__)
3338
ROOT_DIR = os.path.abspath(os.path.join(_SCRIPTS_DIR, '..'))
3439

0 commit comments

Comments
 (0)