Skip to content

Commit 8425bed

Browse files
committed
Merge branch 'refs/heads/main' into feat/tri-6733-reset-an-idempotencykey
2 parents 4db1c68 + 28a66ac commit 8425bed

File tree

59 files changed

+2582
-1243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2582
-1243
lines changed

.changeset/fluffy-weeks-sleep.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/fuzzy-ghosts-admire.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/ninety-cougars-remember.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/typecheck.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535

3636
- name: 🔎 Type check
3737
run: pnpm run typecheck
38+
env:
39+
NODE_OPTIONS: --max-old-space-size=8192
3840

3941
- name: 🔎 Check exports
4042
run: pnpm run check-exports

apps/supervisor/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ class ManagedSupervisor {
244244
}
245245

246246
try {
247+
if (!message.deployment.friendlyId) {
248+
// mostly a type guard, deployments always exists for deployed environments
249+
// a proper fix would be to use a discriminated union schema to differentiate between dequeued runs in dev and in deployed environments.
250+
throw new Error("Deployment is missing");
251+
}
252+
247253
await this.workloadManager.create({
248254
dequeuedAt: message.dequeuedAt,
249255
envId: message.environment.id,
@@ -252,6 +258,8 @@ class ManagedSupervisor {
252258
machine: message.run.machine,
253259
orgId: message.organization.id,
254260
projectId: message.project.id,
261+
deploymentFriendlyId: message.deployment.friendlyId,
262+
deploymentVersion: message.backgroundWorker.version,
255263
runId: message.run.id,
256264
runFriendlyId: message.run.friendlyId,
257265
version: message.version,

apps/supervisor/src/workloadManager/docker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export class DockerWorkloadManager implements WorkloadManager {
7272
`TRIGGER_DEQUEUED_AT_MS=${opts.dequeuedAt.getTime()}`,
7373
`TRIGGER_POD_SCHEDULED_AT_MS=${Date.now()}`,
7474
`TRIGGER_ENV_ID=${opts.envId}`,
75+
`TRIGGER_DEPLOYMENT_ID=${opts.deploymentFriendlyId}`,
76+
`TRIGGER_DEPLOYMENT_VERSION=${opts.deploymentVersion}`,
7577
`TRIGGER_RUN_ID=${opts.runFriendlyId}`,
7678
`TRIGGER_SNAPSHOT_ID=${opts.snapshotFriendlyId}`,
7779
`TRIGGER_SUPERVISOR_API_PROTOCOL=${this.opts.workloadApiProtocol}`,

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ export class KubernetesWorkloadManager implements WorkloadManager {
123123
name: "TRIGGER_ENV_ID",
124124
value: opts.envId,
125125
},
126+
{
127+
name: "TRIGGER_DEPLOYMENT_ID",
128+
value: opts.deploymentFriendlyId,
129+
},
130+
{
131+
name: "TRIGGER_DEPLOYMENT_VERSION",
132+
value: opts.deploymentVersion,
133+
},
126134
{
127135
name: "TRIGGER_SNAPSHOT_ID",
128136
value: opts.snapshotFriendlyId,

apps/supervisor/src/workloadManager/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export interface WorkloadManagerCreateOptions {
2929
envType: EnvironmentType;
3030
orgId: string;
3131
projectId: string;
32+
deploymentFriendlyId: string;
33+
deploymentVersion: string;
3234
runId: string;
3335
runFriendlyId: string;
3436
snapshotId: string;

apps/webapp/app/components/BlankStatePanels.tsx

Lines changed: 148 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ import {
5252
} from "./SetupCommands";
5353
import { StepContentContainer } from "./StepContentContainer";
5454
import { V4Badge } from "./V4Badge";
55+
import {
56+
ClientTabs,
57+
ClientTabsContent,
58+
ClientTabsList,
59+
ClientTabsTrigger,
60+
} from "./primitives/ClientTabs";
61+
import { GitHubSettingsPanel } from "~/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github";
5562

5663
export function HasNoTasksDev() {
5764
return (
@@ -93,62 +100,7 @@ export function HasNoTasksDev() {
93100
}
94101

95102
export function HasNoTasksDeployed({ environment }: { environment: MinimumEnvironment }) {
96-
return (
97-
<PackageManagerProvider>
98-
<div>
99-
<div className="mb-6 flex items-center justify-between border-b">
100-
<div className="mb-2 flex items-center gap-2">
101-
<EnvironmentIcon environment={environment} className="-ml-1 size-8" />
102-
<Header1>Deploy your tasks to {environmentFullTitle(environment)}</Header1>
103-
</div>
104-
<div className="flex items-center">
105-
<SimpleTooltip
106-
button={
107-
<LinkButton
108-
variant="small-menu-item"
109-
LeadingIcon={BookOpenIcon}
110-
leadingIconClassName="text-blue-500"
111-
to={docsPath("deployment/overview")}
112-
/>
113-
}
114-
content="Deploy docs"
115-
/>
116-
<SimpleTooltip
117-
button={
118-
<LinkButton
119-
variant="small-menu-item"
120-
LeadingIcon={QuestionMarkCircleIcon}
121-
leadingIconClassName="text-blue-500"
122-
to={docsPath("troubleshooting#deployment")}
123-
/>
124-
}
125-
content="Troubleshooting docs"
126-
/>
127-
<AskAI />
128-
</div>
129-
</div>
130-
<StepNumber stepNumber="1a" title="Run the CLI 'deploy' command" />
131-
<StepContentContainer>
132-
<Paragraph spacing>
133-
This will deploy your tasks to the {environmentFullTitle(environment)} environment. Read
134-
the <TextLink to={docsPath("deployment/overview")}>full guide</TextLink>.
135-
</Paragraph>
136-
<TriggerDeployStep environment={environment} />
137-
</StepContentContainer>
138-
<StepNumber stepNumber="1b" title="Or deploy using GitHub Actions" />
139-
<StepContentContainer>
140-
<Paragraph spacing>
141-
Read the <TextLink to={docsPath("github-actions")}>GitHub Actions guide</TextLink> to
142-
get started.
143-
</Paragraph>
144-
</StepContentContainer>
145-
<StepNumber stepNumber="2" title="Waiting for tasks to deploy" displaySpinner />
146-
<StepContentContainer>
147-
<Paragraph>This page will automatically refresh when your tasks are deployed.</Paragraph>
148-
</StepContentContainer>
149-
</div>
150-
</PackageManagerProvider>
151-
);
103+
return <DeploymentOnboardingSteps />;
152104
}
153105

154106
export function SchedulesNoPossibleTaskPanel() {
@@ -266,45 +218,7 @@ export function TestHasNoTasks() {
266218
}
267219

268220
export function DeploymentsNone() {
269-
const organization = useOrganization();
270-
const project = useProject();
271-
const environment = useEnvironment();
272-
273-
return (
274-
<InfoPanel
275-
icon={ServerStackIcon}
276-
iconClassName="text-deployments"
277-
title="Deploy for the first time"
278-
panelClassName="max-w-full"
279-
>
280-
<Paragraph spacing variant="small">
281-
There are several ways to deploy your tasks. You can use the CLI or a Continuous Integration
282-
service like GitHub Actions. Make sure you{" "}
283-
<TextLink href={v3EnvironmentVariablesPath(organization, project, environment)}>
284-
set your environment variables
285-
</TextLink>{" "}
286-
first.
287-
</Paragraph>
288-
<div className="flex gap-3">
289-
<LinkButton
290-
to={docsPath("v3/cli-deploy")}
291-
variant="docs/medium"
292-
LeadingIcon={BookOpenIcon}
293-
className="inline-flex"
294-
>
295-
Deploy with the CLI
296-
</LinkButton>
297-
<LinkButton
298-
to={docsPath("v3/github-actions")}
299-
variant="docs/medium"
300-
LeadingIcon={BookOpenIcon}
301-
className="inline-flex"
302-
>
303-
Deploy with GitHub actions
304-
</LinkButton>
305-
</div>
306-
</InfoPanel>
307-
);
221+
return <DeploymentOnboardingSteps />;
308222
}
309223

310224
export function DeploymentsNoneDev() {
@@ -313,46 +227,52 @@ export function DeploymentsNoneDev() {
313227
const environment = useEnvironment();
314228

315229
return (
316-
<div className="space-y-8">
317-
<InfoPanel
318-
icon={ServerStackIcon}
319-
iconClassName="text-deployments"
320-
title="Deploying tasks"
321-
panelClassName="max-w-full"
322-
>
323-
<Paragraph spacing variant="small">
230+
<>
231+
<div className="mb-6 flex items-center justify-between border-b">
232+
<div className="mb-2 flex items-center gap-2">
233+
<EnvironmentIcon environment={environment} className="-ml-1 size-8" />
234+
<Header1>Deploy your tasks</Header1>
235+
</div>
236+
<div className="flex items-center">
237+
<SimpleTooltip
238+
button={
239+
<LinkButton
240+
variant="small-menu-item"
241+
LeadingIcon={BookOpenIcon}
242+
leadingIconClassName="text-blue-500"
243+
to={docsPath("deployment/overview")}
244+
/>
245+
}
246+
content="Deploy docs"
247+
/>
248+
<SimpleTooltip
249+
button={
250+
<LinkButton
251+
variant="small-menu-item"
252+
LeadingIcon={QuestionMarkCircleIcon}
253+
leadingIconClassName="text-blue-500"
254+
to={docsPath("troubleshooting#deployment")}
255+
/>
256+
}
257+
content="Troubleshooting docs"
258+
/>
259+
<AskAI />
260+
</div>
261+
</div>
262+
<StepNumber stepNumber="→" title="Switch to a deployed environment" />
263+
<StepContentContainer className="mb-4 flex flex-col gap-4">
264+
<Paragraph>
324265
This is the Development environment. When you're ready to deploy your tasks, switch to a
325266
different environment.
326267
</Paragraph>
327-
<Paragraph spacing variant="small">
328-
There are several ways to deploy your tasks. You can use the CLI or a Continuous
329-
Integration service like GitHub Actions. Make sure you{" "}
330-
<TextLink href={v3EnvironmentVariablesPath(organization, project, environment)}>
331-
set your environment variables
332-
</TextLink>{" "}
333-
first.
334-
</Paragraph>
335-
<div className="flex gap-3">
336-
<LinkButton
337-
to={docsPath("v3/cli-deploy")}
338-
variant="docs/medium"
339-
LeadingIcon={BookOpenIcon}
340-
className="inline-flex"
341-
>
342-
Deploy with the CLI
343-
</LinkButton>
344-
<LinkButton
345-
to={docsPath("v3/github-actions")}
346-
variant="docs/medium"
347-
LeadingIcon={BookOpenIcon}
348-
className="inline-flex"
349-
>
350-
Deploy with GitHub actions
351-
</LinkButton>
352-
</div>
353-
</InfoPanel>
354-
<SwitcherPanel />
355-
</div>
268+
<EnvironmentSelector
269+
organization={organization}
270+
project={project}
271+
environment={environment}
272+
className="w-fit border border-charcoal-600 bg-secondary hover:border-charcoal-550 hover:bg-charcoal-600"
273+
/>
274+
</StepContentContainer>
275+
</>
356276
);
357277
}
358278

@@ -670,3 +590,99 @@ export function BulkActionsNone() {
670590
</div>
671591
);
672592
}
593+
594+
function DeploymentOnboardingSteps() {
595+
const environment = useEnvironment();
596+
const organization = useOrganization();
597+
const project = useProject();
598+
599+
return (
600+
<PackageManagerProvider>
601+
<div className="mb-2 flex items-center justify-between border-b">
602+
<div className="mb-2 flex items-center gap-2">
603+
<EnvironmentIcon environment={environment} className="-ml-1 size-8" />
604+
<Header1>Deploy your tasks to {environmentFullTitle(environment)}</Header1>
605+
</div>
606+
<div className="flex items-center">
607+
<SimpleTooltip
608+
button={
609+
<LinkButton
610+
variant="small-menu-item"
611+
LeadingIcon={BookOpenIcon}
612+
leadingIconClassName="text-blue-500"
613+
to={docsPath("deployment/overview")}
614+
/>
615+
}
616+
content="Deploy docs"
617+
/>
618+
<SimpleTooltip
619+
button={
620+
<LinkButton
621+
variant="small-menu-item"
622+
LeadingIcon={QuestionMarkCircleIcon}
623+
leadingIconClassName="text-blue-500"
624+
to={docsPath("troubleshooting#deployment")}
625+
/>
626+
}
627+
content="Troubleshooting docs"
628+
/>
629+
<AskAI />
630+
</div>
631+
</div>
632+
<ClientTabs defaultValue="github">
633+
<ClientTabsList variant="segmented" className="mb-6">
634+
<ClientTabsTrigger value={"github"} variant="segmented" layoutId="deploy-tabs">
635+
GitHub
636+
</ClientTabsTrigger>
637+
<ClientTabsTrigger value={"cli"} variant="segmented" layoutId="deploy-tabs">
638+
Manual
639+
</ClientTabsTrigger>
640+
<ClientTabsTrigger value={"github-actions"} variant="segmented" layoutId="deploy-tabs">
641+
GitHub Actions
642+
</ClientTabsTrigger>
643+
</ClientTabsList>
644+
<ClientTabsContent value={"github"}>
645+
<StepNumber stepNumber="1" title="Connect your GitHub repository" />
646+
<StepContentContainer>
647+
<Paragraph spacing>
648+
Deploy automatically with every push. Read the{" "}
649+
<TextLink to={docsPath("github-integration")}>full guide</TextLink>.
650+
</Paragraph>
651+
<div className="w-fit">
652+
<GitHubSettingsPanel
653+
organizationSlug={organization.slug}
654+
projectSlug={project.slug}
655+
environmentSlug={environment.slug}
656+
billingPath={v3BillingPath({ slug: organization.slug })}
657+
/>
658+
</div>
659+
</StepContentContainer>
660+
</ClientTabsContent>
661+
<ClientTabsContent value={"cli"}>
662+
<StepNumber stepNumber="1" title="Run the CLI 'deploy' command" />
663+
<StepContentContainer>
664+
<Paragraph spacing>
665+
This will deploy your tasks to the {environmentFullTitle(environment)} environment.
666+
Read the <TextLink to={docsPath("deployment/overview")}>full guide</TextLink>.
667+
</Paragraph>
668+
<TriggerDeployStep environment={environment} />
669+
</StepContentContainer>
670+
</ClientTabsContent>
671+
<ClientTabsContent value={"github-actions"}>
672+
<StepNumber stepNumber="1" title="Deploy using GitHub Actions" />
673+
<StepContentContainer>
674+
<Paragraph spacing>
675+
Read the <TextLink to={docsPath("github-actions")}>GitHub Actions guide</TextLink> to
676+
get started.
677+
</Paragraph>
678+
</StepContentContainer>
679+
</ClientTabsContent>
680+
</ClientTabs>
681+
682+
<StepNumber stepNumber="2" title="Waiting for tasks to deploy" displaySpinner />
683+
<StepContentContainer>
684+
<Paragraph>This page will automatically refresh when your tasks are deployed.</Paragraph>
685+
</StepContentContainer>
686+
</PackageManagerProvider>
687+
);
688+
}

0 commit comments

Comments
 (0)