From 12040c485752d008ee008b6212c66398d71f41d4 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Tue, 23 Sep 2025 05:20:00 +0300 Subject: [PATCH] Add skip compiler images option support Signed-off-by: Denys Fedoryshchenko --- database.py | 8 +++++++- github_integration.py | 8 ++++++-- main.py | 4 +++- models.py | 15 ++++++++++++++- orchestrator.py | 7 +++++-- templates/dashboard.html | 19 ++++++++++++++++--- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/database.py b/database.py index cfa61f2..f461bce 100644 --- a/database.py +++ b/database.py @@ -33,7 +33,13 @@ def run_migrations(): "column": "info_message", "type": "TEXT", "description": "Column for informational messages (warnings, skip reasons, etc.)", - } + }, + { + "table": "staging_runs", + "column": "skip_compiler_images", + "type": "BOOLEAN DEFAULT 0", + "description": "Option to skip building compiler images in the workflow", + }, # Add future migrations here ] diff --git a/github_integration.py b/github_integration.py index 7c4a5b2..402056c 100644 --- a/github_integration.py +++ b/github_integration.py @@ -30,7 +30,11 @@ def __init__(self, token: str, repo: str = None, workflow: str = None): } async def trigger_workflow( - self, repo: str = None, workflow: str = None, ref: str = GITHUB_REF + self, + repo: str = None, + workflow: str = None, + ref: str = GITHUB_REF, + inputs: dict = None, ) -> Optional[str]: """ Trigger GitHub workflow and return the workflow run ID @@ -55,7 +59,7 @@ async def trigger_workflow( trigger_time = datetime.now(timezone.utc) url = f"{self.base_url}/repos/{repo}/actions/workflows/{workflow}/dispatches" - payload = {"ref": ref, "inputs": {}} + payload = {"ref": ref, "inputs": inputs or {}} try: async with httpx.AsyncClient() as client: diff --git a/main.py b/main.py index ca6c0cb..95b1da1 100644 --- a/main.py +++ b/main.py @@ -700,6 +700,7 @@ async def trigger_staging_api( try: body = await request.json() kernel_tree = body.get("kernel_tree") + skip_compiler_images = body.get("skip_compiler_images", False) except Exception as e: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid JSON body" @@ -707,7 +708,7 @@ async def trigger_staging_api( real_ip = get_real_ip(request) print( - f"User '{current_user.username}' triggered staging run (kernel_tree='{kernel_tree}') from IP {real_ip}" + f"User '{current_user.username}' triggered staging run (kernel_tree='{kernel_tree}', skip_compiler_images={skip_compiler_images}) from IP {real_ip}" ) # Check if there's already a running staging cycle @@ -745,6 +746,7 @@ async def trigger_staging_api( status=StagingRunStatus.RUNNING, initiated_via="manual", kernel_tree=db_kernel_tree, + skip_compiler_images=skip_compiler_images, ) db.add(staging_run) db.flush() # Get the ID without committing diff --git a/models.py b/models.py index 928b801..55ef290 100644 --- a/models.py +++ b/models.py @@ -2,7 +2,17 @@ # Author: Denys Fedoryshchenko # SPDX-License-Identifier: LGPL-2.1-or-later -from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Enum, Text, JSON +from sqlalchemy import ( + Column, + Integer, + String, + DateTime, + ForeignKey, + Enum, + Text, + JSON, + Boolean, +) from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from datetime import datetime @@ -79,6 +89,9 @@ class StagingRun(Base): # Kernel tree selection (next, mainline, stable) kernel_tree = Column(String, nullable=True) + # Skip compiler images option + skip_compiler_images = Column(Boolean, nullable=False, default=False) + # Overall progress tracking current_step = Column(String, nullable=True) diff --git a/orchestrator.py b/orchestrator.py index 221a54e..bc1353b 100644 --- a/orchestrator.py +++ b/orchestrator.py @@ -261,8 +261,11 @@ async def process_github_workflow_step( staging_run.current_step = "github_workflow" db.commit() - # Trigger workflow - workflow_run_id = await self.github_manager.trigger_workflow() + # Trigger workflow with skip_compiler_images input + inputs = { + "SKIP_COMPILER_IMAGES": str(staging_run.skip_compiler_images).lower() + } + workflow_run_id = await self.github_manager.trigger_workflow(inputs=inputs) if workflow_run_id: step.github_actions_id = workflow_run_id step.details = json.dumps( diff --git a/templates/dashboard.html b/templates/dashboard.html index 89e4c2f..aeb4f8c 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -176,7 +176,17 @@
Start New Run
- + +
+
+ + +
Check this to skip the compiler image building step in the workflow
+
+
+ @@ -445,7 +455,9 @@
Active GitHub Workflows:
async function proceedWithStagingRun() { const modalContent = document.getElementById('stagingModalContent'); const kernelTreeSelect = document.getElementById('kernel_tree'); + const skipCompilerImagesCheckbox = document.getElementById('skip_compiler_images'); const kernelTree = kernelTreeSelect.value; + const skipCompilerImages = skipCompilerImagesCheckbox.checked; // Update modal to show progress modalContent.innerHTML = ` @@ -454,7 +466,7 @@
Active GitHub Workflows:
Starting staging run...

Starting staging run...

- Kernel tree: ${kernelTree} + Kernel tree: ${kernelTree}${skipCompilerImages ? ', Skip compiler images' : ''} `; @@ -465,7 +477,8 @@
Active GitHub Workflows:
'Content-Type': 'application/json', }, body: JSON.stringify({ - kernel_tree: kernelTree + kernel_tree: kernelTree, + skip_compiler_images: skipCompilerImages }) });