unembargo: separate out milestone lookup into function
The recent change
0c2430a ("unembargo: Check and warn for any pending milestones")
ended up re-assigning to the same `series` variable, breaking package
publications for multiple source packges:
$UQT/security-tools/unembargo -n --ppa=ubuntu-security-proposed/ppa openjdk-8 openjdk-lts openjdk-17 openjdk-18
Loading Ubuntu Distribution ...
Loading Ubuntu Archive ...
Loading ubuntu-security-proposed 'ppa' PPA ...
Locating openjdk-8 ...
WARNING: jammy is approaching milestone ubuntu-22.04.1 (due 2022-08-04)
NOTE: Please coordinate with the #ubuntu-release team before releasing.
NOTE: To override this check and publish anyway please use the --force.
NOTE: unembargo for jammy will be skipped.
Want to publish openjdk-8 8u342-b07-0ubuntu1~20.04 to ubuntu/primary focal (Security)...
Want to publish openjdk-8 8u342-b07-0ubuntu1~18.04 to ubuntu/primary bionic (Security)...
Locating openjdk-lts ...
Traceback (most recent call last):
File "/home/steve/git/ubuntu-qa-tools/security-tools/unembargo", line 146, in <module>
if len(series) > 0:
TypeError: object of type 'Entry' has no len()
Fix this by moving the lookup of milestones to a separate function, so
that any variables set there won't pollute the global namespace. Also it
makes it easier to isolate the milestone lookup for future improvements.
v2: rename milestone discovery function to `pending_milestone()`
unembargo: Add grace period to milestone date and assume UTC
Milestone dates are in UTC so make sure we use UTC for the local time as
well when comparing, plus since the release is due *on* that date, check
for the day *after* that to make sure we don't release whilst it is still
being prepared.
unembargo: Check and warn for any pending milestones
Rather than use a hard-coded check for the pending jammy point release,
lookup milestones via LP and warn if 7 days or less until one is due. This
does not appear to have any noticeable performance impact during the
unembargo.