Skip to content

Commit

Permalink
Align release date calculation with documentation
Browse files Browse the repository at this point in the history
To improve the predictability of release dates, it was agreed to start
the stabilization phase on the last Monday of the first Month in the
quarter. Consequently, the release is expected two weeks after the
stabilization period is started.

Signed-off-by: Marcus Burghardt <[email protected]>
  • Loading branch information
marcusburghardt committed Jul 30, 2024
1 parent 847ea1a commit 918149d
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions utils/release_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,42 @@ def get_monday_that_follows(date) -> datetime:
return date + timedelta((0 - date.weekday()) % 7)


def get_next_quarter_first_month(latest_release_date: datetime) -> int:
last_release_quarter = (latest_release_date.month - 1) // 3 + 1
if last_release_quarter == 4:
next_release_quarter = 1
else:
next_release_quarter = last_release_quarter + 1
return (next_release_quarter - 1) * 3 + 1


def get_last_monday_of_month(year: int, month: int) -> datetime:
if month == 12:
last_month_day = datetime(year, month, 31)
else:
last_month_day = datetime(year, month + 1, 1) - timedelta(days=1)

days_since_monday = (last_month_day.weekday() - 0) % 7
return last_month_day - timedelta(days=days_since_monday)


def get_next_stabilization_date(release_date) -> datetime:
two_weeks_before = release_date - timedelta(weeks=2)
stabilization_monday = get_monday_that_follows(two_weeks_before)
return stabilization_monday.date()


def get_next_release_date(latest_release_date) -> datetime:
three_months_ahead = latest_release_date + timedelta(days=90)
return get_friday_that_follows(three_months_ahead)
def get_next_release_date(latest_release_date: datetime) -> datetime:
month = get_next_quarter_first_month(latest_release_date)
now = datetime.now()

if month > 9 and latest_release_date <= now:
year = latest_release_date.year + 1
else:
year = latest_release_date.year

last_monday = get_last_monday_of_month(year, month)
return get_friday_that_follows(last_monday + timedelta(weeks=1))


def is_next_release_in_progress(repo) -> bool:
Expand Down

0 comments on commit 918149d

Please sign in to comment.