df78ef96d9
Closes this feature request: [https://triggerdev.featurebase.app/p/isolated-dev-sessions-for-multiple-local-trigger-dev-instances](https://triggerdev.featurebase.app/p/isolated-dev-sessions-for-multiple-local-trigger-dev-instances) ### Feature notes: - CLI `trigger dev` works as before - `trigger dev --branch my-branch` to create a new branch and run against it. - `trigger dev archive --branch my-branch` to archive (or in webapp). - New webapp page to manage and archive dev branches, currently feature flagged. ### Implementation details: - No changes to data model, no backfill. `isBranchableEnvironment` column is ignored for dev branches, we use `parentEnvironmentId IS NULL` instead. - `x-trigger-branch` overloaded for preview and dev branches - New `TRIGGER_DEV_BRANCH` env var available locally. `TRIGGER_PREVIEW_BRANCH` overloaded for child runs. - Lots of new glue code to sanitise the branch checks. ### Rollout - Deploy webapp/API changes (all backwards compatible) - Manual tests on some orgs - Deploy docs, release CLI, flip feature flag for webapp feature ### NB - `api.v1.projects.$projectRef.environments.ts` will return `isBranchableEnvironment: true` for all dev environments. ### Prerequisites - [x] Typecheck will not pass until we make a new release of `@trigger.dev/platform` and bump it here
25 lines
809 B
TypeScript
25 lines
809 B
TypeScript
import { GitMeta } from "@trigger.dev/core/v3";
|
|
import { z } from "zod";
|
|
|
|
/** Search/filter params for the branches list pages. */
|
|
export const BranchesOptions = z.object({
|
|
search: z.string().optional(),
|
|
showArchived: z.preprocess((val) => val === "true" || val === true, z.boolean()).optional(),
|
|
page: z.preprocess((val) => Number(val), z.number()).optional(),
|
|
});
|
|
|
|
/** Payload accepted by the create-branch service/action. */
|
|
export const CreateBranchOptions = z.object({
|
|
projectId: z.string(),
|
|
env: z.enum(["preview", "development"]),
|
|
branchName: z.string().min(1),
|
|
git: GitMeta.optional(),
|
|
});
|
|
|
|
/** The create-branch form schema (payload + the form's failure redirect path). */
|
|
export const CreateBranchFormSchema = CreateBranchOptions.and(
|
|
z.object({
|
|
failurePath: z.string(),
|
|
})
|
|
);
|