Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: exit with failure code when CI scripts encounter errors

Sidwebworks5b56b89d34a7
diff --git a/ci/src/deploy.ts b/ci/src/deploy.ts
index df3c4fb7ef..0350f13a30 100644
--- a/ci/src/deploy.ts
+++ b/ci/src/deploy.ts
@@ -75,9 +75,11 @@ async function deploy(): Promise<void> {
if (error) {
console.error("🔴 🍳 Failed to fetch workspaces", error);
- return;
+ process.exit(1);
}
+ let hasErrors = false;
+
console.log("✅ 🛩️ Successfully retreived workspaces");
for await (const workspace of workspaces as Workspace[]) {
@@ -166,7 +168,9 @@ async function deploy(): Promise<void> {
}
if (!database_connection_pooler_url) {
- console.log(`🔴🍳 Missing database connection pooler url for ${workspace.id}`);
+ console.log(
+ `🔴🍳 Missing database connection pooler url for ${workspace.id}`
+ );
continue;
}
@@ -316,8 +320,19 @@ async function deploy(): Promise<void> {
console.log(`✅ 🍗 Successfully deployed ${workspace.id}`);
} catch (error) {
console.error(`🔴 🍳 Failed to deploy ${workspace.id}`, error);
+ hasErrors = true;
}
}
+
+ if (hasErrors) {
+ console.error("🔴 Deployment completed with errors");
+ process.exit(1);
+ }
+
+ console.log("✅ All deployments completed successfully");
}
-deploy();
+deploy().catch((error) => {
+ console.error("🔴 Unexpected error during deployment", error);
+ process.exit(1);
+});
diff --git a/ci/src/migrations.ts b/ci/src/migrations.ts
index b9be677770..08aa5cc501 100644
--- a/ci/src/migrations.ts
+++ b/ci/src/migrations.ts
@@ -33,9 +33,11 @@ async function migrate(): Promise<void> {
if (error) {
console.error("🔴 🍳 Failed to fetch workspaces", error);
- return;
+ process.exit(1);
}
+ let hasErrors = false;
+
console.log("✅ 🛩️ Successfully retreived workspaces");
console.log("👯‍♀️ Copying supabase folder");
@@ -119,8 +121,19 @@ async function migrate(): Promise<void> {
console.log(`✅ 🐓 Successfully migrated ${workspace.id}`);
} catch (error) {
console.error(`🔴 🍳 Failed to migrate ${workspace.id}`, error);
+ hasErrors = true;
}
}
+
+ if (hasErrors) {
+ console.error("🔴 Migration completed with errors");
+ process.exit(1);
+ }
+
+ console.log("✅ All migrations completed successfully");
}
-migrate();
+migrate().catch((error) => {
+ console.error("🔴 Unexpected error during migration", error);
+ process.exit(1);
+});