Răsfoiți Sursa

non-empty pre-deploy command validation (#4016)

Feroze Mohideen 2 ani în urmă
părinte
comite
34909758cf
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      dashboard/src/lib/porter-apps/index.ts

+ 12 - 0
dashboard/src/lib/porter-apps/index.ts

@@ -109,6 +109,18 @@ export const porterAppFormValidator = z
     deletions: deletionValidator,
     redeployOnSave: z.boolean().default(false),
   })
+  .refine(
+    ({ app }) => {
+      if (app.predeploy?.[0]?.run) {
+        return app.predeploy[0].run.value.length > 0;
+      }
+      return true;
+    },
+    {
+      message: "if using a pre-deploy job, its start command must be non-empty",
+      path: ["app", "services"],
+    }
+  )
   .refine(
     ({ app, source }) => {
       if (source.type !== "docker-registry" && app.build.method === "pack") {