| |
@@ -286,17 +286,12 @@
|
| |
return "rhel-11"
|
| |
return None
|
| |
|
| |
- def does_divergent_branch_exist(repo_name, rhel_version, rhel_dist_git, pp_api_url, namespace):
|
| |
+ def does_divergent_branch_exist(repo_name, rhel_version, active_y, rhel_dist_git, pp_api_url, namespace):
|
| |
logger = logging.getLogger(__name__)
|
| |
|
| |
# Determine if the Y-1 branch exists for this repo
|
| |
|
| |
- # Look up the Y-1 branch name
|
| |
- divergent_branch = determine_divergent_branch(
|
| |
- rhel_version,
|
| |
- pp_api_url,
|
| |
- namespace,
|
| |
- )
|
| |
+ divergent_branch = active_y - 1
|
| |
logger.debug("Divergent branch: {}".format(divergent_branch))
|
| |
|
| |
g = gitpython.cmd.Git()
|
| |
@@ -316,48 +311,6 @@
|
| |
raise
|
| |
return branch_exists
|
| |
|
| |
- def determine_divergent_branch(rhel_version, pp_api_url, namespace):
|
| |
- logger = logging.getLogger(__name__)
|
| |
-
|
| |
- # Query the "package pages" API for the current active Y-stream release
|
| |
- # Phase 230 is "Planning / Development / Testing" (AKA DeveTestDoc)
|
| |
- request_params = {
|
| |
- "phase": 230,
|
| |
- "product__shortname": "rhel",
|
| |
- "relgroup__shortname": rhel_version,
|
| |
- "format": "json",
|
| |
- }
|
| |
-
|
| |
- res = requests.get(
|
| |
- os.path.join(pp_api_url, "latest", "releases"),
|
| |
- params=request_params,
|
| |
- timeout=60,
|
| |
- )
|
| |
- res.raise_for_status()
|
| |
- payload = json.loads(res.text)
|
| |
- logger.debug(
|
| |
- "Response from PP API: {}".format(json.dumps(payload, indent=2))
|
| |
- )
|
| |
- if len(payload) < 1:
|
| |
- raise RuntimeError("Received zero potential release matches)")
|
| |
-
|
| |
- active_y_version = -1
|
| |
- for entry in payload:
|
| |
- shortname = entry["shortname"]
|
| |
-
|
| |
- # The shortname is in the form rhel-9-1.0
|
| |
- # Extract the active Y-stream version
|
| |
- m = re.search("(?<={}-)\d+(?=\.0)".format(rhel_version), shortname)
|
| |
- if not m:
|
| |
- raise RuntimeError(
|
| |
- "Could not determine active Y-stream version from shortname"
|
| |
- )
|
| |
- y_version = int(m.group(0))
|
| |
- if y_version > active_y_version:
|
| |
- active_y_version = y_version
|
| |
-
|
| |
- # The divergent branch is Y-1
|
| |
- return "{}.{}.0".format(rhel_version, active_y_version - 1)
|
| |
|
| |
def _datesplit(isodate):
|
| |
date_string_tuple = isodate.split('-')
|
| |
@@ -372,9 +325,10 @@
|
| |
logger = logging.getLogger(__name__)
|
| |
|
| |
# Query the "package pages" API for the current active Y-stream release
|
| |
- # Phase 230 is "Planning / Development / Testing" (AKA DeveTestDoc)
|
| |
+ # Phase 230 is "Planning / Development / Testing" (AKA DevTestDoc)
|
| |
+ # Phase 450 is "Stabilization"
|
| |
request_params = {
|
| |
- "phase": 230,
|
| |
+ "phase__in": "230,450",
|
| |
"product__shortname": "rhel",
|
| |
"relgroup__shortname": rhel_version,
|
| |
"format": "json",
|
| |
@@ -391,7 +345,7 @@
|
| |
"Response from PP API: {}".format(json.dumps(payload, indent=2))
|
| |
)
|
| |
if len(payload) < 1:
|
| |
- raise RuntimeError("Received zero potential release matches)")
|
| |
+ raise RuntimeError("Received zero potential release matches")
|
| |
|
| |
release_id = -1
|
| |
active_y_version = -1
|
| |
@@ -410,26 +364,7 @@
|
| |
active_y_version = y_version
|
| |
release_id = entry["id"]
|
| |
|
| |
- # Now look up whether we are in the Exception Phase for this Y-stream release
|
| |
- request_params = {
|
| |
- "name__regex": "(Excep|Stabiliza)tion Phase",
|
| |
- "format": "json",
|
| |
- }
|
| |
- res = requests.get(os.path.join(pp_api_url, "latest", "releases", str(release_id), "schedule-tasks"), params=request_params)
|
| |
- res.raise_for_status()
|
| |
- payload = json.loads(res.text)
|
| |
- logger.debug(
|
| |
- "Response from phase lookup: {}".format(json.dumps(payload, indent=2))
|
| |
- )
|
| |
-
|
| |
- # This lookup *must* return exactly one value or the Product Pages are
|
| |
- # wrong and must be fixed.
|
| |
- assert len(payload) == 1
|
| |
-
|
| |
- # Determine if this Y-stream release is in the exception phase
|
| |
- today = datetime.now(tz=pytz.utc).date()
|
| |
- exception_start_date = date(*_datesplit(payload[0]["date_start"]))
|
| |
- in_exception_phase = today >= exception_start_date
|
| |
+ in_exception_phase = entry["phase"] == 450
|
| |
|
| |
logger.debug("Active Y-stream: {}, Enforcing: {}".format(active_y_version, in_exception_phase))
|
| |
|
| |
There is now a separate phase for Stabilization, rather than just a section of time within the DevTestDoc phase.
Signed-off-by: Troy Dawson tdawson@redhat.com