Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand Down
8 changes: 6 additions & 2 deletions github_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,14 +700,15 @@ 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"
)

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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
# Author: Denys Fedoryshchenko <denys.f@collabora.com>
# 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
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 5 additions & 2 deletions orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
19 changes: 16 additions & 3 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,17 @@ <h6 class="mb-0"><i class="fas fa-play me-2"></i>Start New Run</h6>
<option value="stable">Linux Stable</option>
</select>
</div>


<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="skip_compiler_images" name="skip_compiler_images">
<label class="form-check-label" for="skip_compiler_images">
Skip building compiler images
</label>
<div class="form-text">Check this to skip the compiler image building step in the workflow</div>
</div>
</div>

<button type="button" class="btn btn-primary w-100" id="stagingTriggerBtn" onclick="openStagingModal()">
<i class="fas fa-rocket me-2"></i>Trigger Staging Run
</button>
Expand Down Expand Up @@ -445,7 +455,9 @@ <h6>Active GitHub Workflows:</h6>
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 = `
Expand All @@ -454,7 +466,7 @@ <h6>Active GitHub Workflows:</h6>
<span class="visually-hidden">Starting staging run...</span>
</div>
<p class="mt-3 mb-0">Starting staging run...</p>
<small class="text-muted">Kernel tree: ${kernelTree}</small>
<small class="text-muted">Kernel tree: ${kernelTree}${skipCompilerImages ? ', Skip compiler images' : ''}</small>
</div>
`;

Expand All @@ -465,7 +477,8 @@ <h6>Active GitHub Workflows:</h6>
'Content-Type': 'application/json',
},
body: JSON.stringify({
kernel_tree: kernelTree
kernel_tree: kernelTree,
skip_compiler_images: skipCompilerImages
})
});

Expand Down