Skip to content

Commit 9af656f

Browse files
author
Neil Williams
committed
Allow staging builds after a production hot fix
Hot fixes change YYYY.MM to YYYY.MM.X where X is an incrementing number. This causes staging builds after the hot fix to be lower than the builds before the fix. Drop the increment and use the time.day field to increment staging builds. Change-Id: I5af730ee58e6f1044b2dbb1d51c8f05ee8fdf5e6
1 parent 8625be1 commit 9af656f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

version.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,20 @@ def version_tag():
6868
return tag_name
6969
else:
7070
dev_time = datetime.datetime.utcnow()
71+
# production hot fixes can change the tag from year.month
72+
# which would cause staging builds to be lower than the build
73+
# before the tag. Drop the hot fix element of tag names.
74+
bits = tag_name.split('.')
75+
delayed_tag = "%s.%s" % (bits[0], bits[1])
7176
# our tags are one month behind, 04 is tagged in 05
7277
# however, the tag is not necessarily made on the first day of 05
7378
# so if out by two, allow for an "extended month" to ensure
7479
# an incremental version
75-
bits = tag_name.split('.')
7680
tag_month = int(bits[1])
7781
extended = dev_time.day
7882
if int(dev_time.month) - 1 > tag_month:
7983
extended = int(dev_time.day) + 31
80-
delayed_tag = "%d.%02d" % (dev_time.year, dev_time.month)
81-
return "%s.%02d.%02d" % (tag_name, extended, dev_time.hour)
84+
return "%s.%02d.%02d" % (delayed_tag, extended, dev_time.hour)
8285

8386

8487
def main():

0 commit comments

Comments
 (0)