diff options
| author | Pavel <[email protected]> | 2026-07-04 08:37:13 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-04 08:37:13 +0300 |
| commit | 56ba803bccce30a694ea8506f7cef6048eb9da88 (patch) | |
| tree | 9de58efcc7cded170fdd0fdb57a1dc56485bf767 /.github/scripts | |
| parent | 4a7d6319fb151f9bfb88c87181deceb12609ea3b (diff) | |
Revert PR-check/postcommit CI refactor (#44879) (#45522)
Diffstat (limited to '.github/scripts')
| -rw-r--r-- | .github/scripts/analytics/resolve_ci_job_name.py | 40 | ||||
| -rw-r--r-- | .github/scripts/telegram/alert_queued_jobs.py | 41 |
2 files changed, 15 insertions, 66 deletions
diff --git a/.github/scripts/analytics/resolve_ci_job_name.py b/.github/scripts/analytics/resolve_ci_job_name.py deleted file mode 100644 index de8ef59ca4c..00000000000 --- a/.github/scripts/analytics/resolve_ci_job_name.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -"""Map GitHub workflow + build preset to analytics job_name / github_workflow.""" - -# Exact legacy workflow names (mute rules, BI queries). -POSTCOMMIT_LEGACY_NAMES = { - "relwithdebinfo": "Postcommit_relwithdebinfo", - "release-asan": "Postcommit_asan", -} - - -def _postcommit_preset_suffix(build_preset: str) -> str: - if build_preset.startswith("release-"): - return build_preset.removeprefix("release-") - return build_preset - - -def resolve_ci_job_name( - workflow_name: str, build_preset: str, event_name: str = "" -) -> str: - is_postcommit = workflow_name == "Postcommit" or ( - workflow_name == "PR-check" and event_name == "push" - ) - if is_postcommit: - if build_preset in POSTCOMMIT_LEGACY_NAMES: - return POSTCOMMIT_LEGACY_NAMES[build_preset] - return f"Postcommit_{_postcommit_preset_suffix(build_preset)}" - return workflow_name - - -if __name__ == "__main__": - import sys - - if len(sys.argv) not in (3, 4): - print( - "usage: resolve_ci_job_name.py <workflow_name> <build_preset> [event_name]", - file=sys.stderr, - ) - sys.exit(2) - event_name = sys.argv[3] if len(sys.argv) == 4 else "" - print(resolve_ci_job_name(sys.argv[1], sys.argv[2], event_name)) diff --git a/.github/scripts/telegram/alert_queued_jobs.py b/.github/scripts/telegram/alert_queued_jobs.py index d081fb7b564..7b37dbf9341 100644 --- a/.github/scripts/telegram/alert_queued_jobs.py +++ b/.github/scripts/telegram/alert_queued_jobs.py @@ -33,27 +33,6 @@ WORKFLOW_THRESHOLDS = [ ("Postcommit", "Postcommit", 6), ] -def stuck_job_display_type(run: Dict[str, Any]) -> str: - """Classify a queued run for threshold/display (PR-check push → Postcommit).""" - workflow_name = run.get('name', '') - event = run.get('event', '') - if workflow_name == 'PR-check' and event == 'push': - return 'Postcommit' - for pattern, display_name, _spec in WORKFLOW_THRESHOLDS: - if pattern in workflow_name: - return display_name - return 'Other' - - -def threshold_spec_for_run(run: Dict[str, Any]): - display_type = stuck_job_display_type(run) - if display_type == 'Other': - return None - for _pattern, display_name, spec in WORKFLOW_THRESHOLDS: - if display_name == display_type: - return spec - return None - EMPTY_QUEUE_MESSAGE = ( "✅ *GITHUB ACTIONS MONITORING*\n\nQueue is empty - all jobs are working normally! 🎉" ) @@ -289,10 +268,11 @@ def is_job_stuck_by_criteria(run, waiting_hours): Returns: bool: True if job is considered stuck """ + workflow_name = run.get('name', '') current_time = datetime.now(timezone.utc) - spec = threshold_spec_for_run(run) - if spec is not None and waiting_hours > threshold_for_time(current_time, spec): - return True + for pattern, display_name, spec in WORKFLOW_THRESHOLDS: + if pattern in workflow_name and waiting_hours > threshold_for_time(current_time, spec): + return True return False def generate_stuck_jobs_summary(stuck_jobs: List[Dict[str, Any]]) -> List[str]: @@ -340,8 +320,17 @@ def count_stuck_jobs_by_type(stuck_jobs: List[Dict[str, Any]]) -> Dict[str, int] counts['Other'] = 0 for stuck_job in stuck_jobs: - display_type = stuck_job_display_type(stuck_job['run']) - counts[display_type] = counts.get(display_type, 0) + 1 + workflow_name = stuck_job['run'].get('name', '') + found_type = False + for pattern, display_name, spec in WORKFLOW_THRESHOLDS: + if pattern in workflow_name: + counts[display_name] += 1 + found_type = True + break + + # If no type found, add to Other + if not found_type: + counts['Other'] += 1 return counts |
