feat: add project-scoped operations
Generic Container CI/CD / test-build-publish (push) Failing after 6s
Server CI/CD v2 / build-test-publish-and-deploy (push) Failing after 6s

This commit is contained in:
2026-10-22 18:40:20 +08:00
parent d320972d57
commit 1d061f6099
73 changed files with 4384 additions and 228 deletions
+13 -9
View File
@@ -372,7 +372,7 @@ class PeripheralWorkOrderSynchronizer:
event_name = ""
await asyncio.sleep(1)
except (httpx.HTTPError, ValueError, KeyError):
logger.warning("Work-order event stream disconnected; reconciliation remains active")
logger.warning("Work-order event stream disconnected: project=%s; reconciliation remains active", self.settings.project_id)
await asyncio.sleep(5)
async def serve(self, reconcile_seconds: int = 300) -> None:
@@ -399,12 +399,12 @@ class PeripheralWorkOrderSynchronizer:
self.client, self.settings, self.peripheral_url, self.credentials,
**({"work_order_ids": order_ids} if not full_reconcile else {}),
)
logger.info("Peripheral progress synchronization completed: %d revisions", count)
logger.info("Peripheral progress synchronization completed: project=%s revisions=%d", self.settings.project_id, count)
retry_seconds = 5
if full_reconcile:
next_reconcile = asyncio.get_running_loop().time() + reconcile_seconds
except (httpx.HTTPError, ValueError, KeyError):
logger.error("Peripheral synchronization failed; persisted revisions will be retried")
logger.error("Peripheral synchronization failed: project=%s; persisted revisions will be retried", self.settings.project_id)
self.full_reconcile |= full_reconcile
for order_id in order_ids:
self._queue_order(order_id)
@@ -419,17 +419,21 @@ class PeripheralWorkOrderSynchronizer:
async def run(once: bool, reconcile_seconds: int = 300) -> None:
settings = WorkerSettings.from_environment()
peripheral_url = os.environ["OPERATIONAL_ACTION_PERIPHERAL_URL"]
credentials = CredentialProvider(settings)
async with httpx.AsyncClient(timeout=30, follow_redirects=False, trust_env=False) as client:
if once:
try:
count = await sync_once(client, settings, peripheral_url, credentials)
logger.info("Peripheral progress synchronization completed: %d revisions", count)
except (httpx.HTTPError, ValueError, KeyError):
results = await asyncio.gather(*(
sync_once(client, scope, peripheral_url, CredentialProvider(scope))
for scope in settings.project_scopes()
), return_exceptions=True)
if any(isinstance(result, Exception) for result in results):
logger.error("Peripheral synchronization failed; persisted revisions remain available")
raise SystemExit(1) from None
logger.info("Peripheral progress synchronization completed: %d revisions", sum(results))
return
await PeripheralWorkOrderSynchronizer(client, settings, peripheral_url, credentials).serve(reconcile_seconds)
await asyncio.gather(*(
PeripheralWorkOrderSynchronizer(client, scope, peripheral_url, CredentialProvider(scope)).serve(reconcile_seconds)
for scope in settings.project_scopes()
))
if __name__ == "__main__":