From d43dfba73a556ee2ac45e05c25d4595ffbdd8fe6 Mon Sep 17 00:00:00 2001 From: Saadi Myftija Date: Mon, 31 Aug 2026 14:52:41 +0200 Subject: [PATCH] chore(webapp): integration settings copy update (#4850) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Project → Settings → Integrations, build settings for GitHub deploys: - **Trigger config file**: description now says it is auto-detected by default and a path only overrides that. - **Use native build server**: rendered only for admins — GitHub deployments always use the native build server unless an admin opts a project out. The option to disable native builds in GitHub deployments will be removed entirely. --- .../route.tsx | 70 ++++++++++++------- ...cts.$projectParam.env.$envParam.github.tsx | 4 +- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings.integrations/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings.integrations/route.tsx index 37ad3d516..0c00b8791 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings.integrations/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings.integrations/route.tsx @@ -19,12 +19,14 @@ import { import { SpinnerWhite } from "~/components/primitives/Spinner"; import { Switch } from "~/components/primitives/Switch"; import { useEnvironment } from "~/hooks/useEnvironment"; +import { useHasAdminAccess } from "~/hooks/useUser"; import { useOrganization } from "~/hooks/useOrganizations"; import { useProject } from "~/hooks/useProject"; import { redirectBackWithErrorMessage, redirectBackWithSuccessMessage, } from "~/models/message.server"; +import { prisma } from "~/db.server"; import { resolveOrgIdFromSlug } from "~/models/organization.server"; import { OrgIntegrationRepository } from "~/models/orgIntegration.server"; import { logger } from "~/services/logger.server"; @@ -33,7 +35,7 @@ import { ProjectSettingsPresenter } from "~/services/projectSettingsPresenter.se import { dashboardAction, dashboardLoader } from "~/services/routeBuilders/dashboardBuilder"; import { EnvironmentParamSchema, v3BillingPath, vercelResourcePath } from "~/utils/pathBuilder"; import { throwPermissionDenied } from "~/utils/permissionDenied"; -import { type BuildSettings } from "~/v3/buildSettings"; +import { BuildSettingsSchema, type BuildSettings } from "~/v3/buildSettings"; import { GitHubSettingsPanel } from "../resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github"; import type { loader as vercelLoader } from "../resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel"; import { @@ -183,12 +185,24 @@ export const action = dashboardAction( const { installCommand, preBuildCommand, triggerConfigFilePath, useNativeBuildServer } = submission.value; + // Only admins may change the opt-out; other saves carry the stored value forward. + let disableNativeBuildServer: true | undefined = useNativeBuildServer ? undefined : true; + if (!user.admin && !user.isImpersonating) { + const project = await prisma.project.findFirst({ + where: { id: projectId }, + select: { buildSettings: true }, + }); + const stored = BuildSettingsSchema.safeParse(project?.buildSettings); + disableNativeBuildServer = + stored.success && stored.data.disableNativeBuildServer === true ? true : undefined; + } + const resultOrFail = await projectSettingsService.updateBuildSettings(projectId, { installCommand: installCommand || undefined, preBuildCommand: preBuildCommand || undefined, triggerConfigFilePath: triggerConfigFilePath || undefined, // Native build server is the default, so we only persist the opt-out. - disableNativeBuildServer: useNativeBuildServer ? undefined : true, + disableNativeBuildServer, }); if (resultOrFail.isErr()) { @@ -389,7 +403,7 @@ export default function IntegrationsSettingsPage() { <> Applies to deployments triggered from GitHub, and CLI deployments run with the{" "} - --native-build-server + --native-build {" "} flag. @@ -443,6 +457,8 @@ function BuildSettingsForm({ const navigation = useNavigation(); const [hasBuildSettingsChanges, setHasBuildSettingsChanges] = useState(false); + const hasAdminAccess = useHasAdminAccess(); + // The native build server is enabled by default; it's only off when the // project has explicitly opted out via `disableNativeBuildServer`. const nativeBuildServerEnabled = buildSettings?.disableNativeBuildServer !== true; @@ -484,7 +500,7 @@ function BuildSettingsForm({ align="start" htmlFor={fields.triggerConfigFilePath.id} title="Trigger config file" - description="Path relative to your repo root." + description="Path relative to your repo root. Auto-detected by default." action={ { setBuildSettingsValues((prev) => ({ ...prev, @@ -542,7 +558,7 @@ function BuildSettingsForm({ {...getInputProps(fields.preBuildCommand, { type: "text" })} variant="medium" defaultValue={buildSettings?.preBuildCommand || ""} - placeholder="npm run prisma:generate" + placeholder="e.g., npm run prisma:generate" onChange={(e) => { setBuildSettingsValues((prev) => ({ ...prev, @@ -557,27 +573,31 @@ function BuildSettingsForm({ } /> - { - setBuildSettingsValues((prev) => ({ - ...prev, - useNativeBuildServer: isChecked, - })); - }} + {hasAdminAccess ? ( + <> + { + setBuildSettingsValues((prev) => ({ + ...prev, + useNativeBuildServer: isChecked, + })); + }} + /> + } /> - } - /> - - {fields.useNativeBuildServer.errors} - + + {fields.useNativeBuildServer.errors} + + + ) : null} {buildSettingsForm.errors} diff --git a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx index fba94b80b..f41b097f6 100644 --- a/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx +++ b/apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx @@ -698,8 +698,8 @@ function GitHubAppInstalledRow() { title="GitHub app" action={ - Installed + } /> @@ -841,8 +841,8 @@ export function ConnectedGitHubRepoForm({ title="GitHub repo" action={ - Connected + } />