GeezerVison is showing github.com — feat(deployments): add build server meta and trigger source info by myftija · Pull Request #2767 · triggerdotdev/trigger.dev
Conversation
This PR applies a small change to the deployments table to keep track of:
- where the deployment was triggered from
- build server metadata, if the build server was involved
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
🦋 Changeset detected
Latest commit: cc56f5d
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 26 packages
| Name |
Type |
| trigger.dev |
Patch |
| @trigger.dev/core |
Patch |
| d3-chat |
Patch |
| references-d3-openai-agents |
Patch |
| references-nextjs-realtime |
Patch |
| references-realtime-hooks-test |
Patch |
| references-realtime-streams |
Patch |
| references-telemetry |
Patch |
| @trigger.dev/build |
Patch |
| @trigger.dev/python |
Patch |
| @trigger.dev/redis-worker |
Patch |
| @trigger.dev/schema-to-json |
Patch |
| @trigger.dev/sdk |
Patch |
| @internal/cache |
Patch |
| @internal/clickhouse |
Patch |
| @internal/redis |
Patch |
| @internal/replication |
Patch |
| @internal/run-engine |
Patch |
| @internal/schedule-engine |
Patch |
| @internal/testcontainers |
Patch |
| @internal/tracing |
Patch |
| @internal/zod-worker |
Patch |
| @trigger.dev/react-hooks |
Patch |
| @trigger.dev/rsc |
Patch |
| @trigger.dev/database |
Patch |
| @trigger.dev/otlp-importer |
Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Dec 8, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Walkthrough
This PR extends the deployment system to track build server metadata and deployment trigger sources. Two database migrations add buildServerMetadata (JSON) and triggeredVia (text) columns to the WorkerDeployment table. The Prisma schema and core API schemas are updated to include these new optional fields. The CLI deploy command now detects the CI/CD environment (GitHub Actions, GitLab CI, CircleCI, Jenkins, Azure Pipelines, Bitbucket Pipelines, Travis CI, Buildkite, or manual) and propagates this information as triggeredVia. The deployment initialization service computes and persists buildServerMetadata when native builds are involved. The deployment presenter queries these new fields and uses buildServerMetadata presence to activate S2 event streaming alongside git-based detection.
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
- packages/core/src/v3/schemas/api.ts — Review the new discriminated union integration for InitializeDeploymentRequestBody and ensure the conditional logic for native build scenarios is sound; verify DeploymentTriggeredVia enum covers all intended CI platforms
- packages/cli-v3/src/commands/deploy.ts — Examine the getTriggeredVia() helper logic to confirm CI environment detection is comprehensive and correctly mapped for all supported platforms; verify triggeredVia propagation in both standard and native build deployment paths
- apps/webapp/app/v3/services/initializeDeployment.server.ts — Verify the buildServerMetadata computation logic correctly handles the conditional inclusion of fields based on isNativeBuild and buildId presence
- apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts — Confirm the updated S2 event streaming activation condition (buildServerMetadata presence OR git trigger) aligns with intended activation semantics
Pre-merge checks and finishing touches
❌ Failed checks (2 warnings)
| Check name |
Status |
Explanation |
Resolution |
| Description check |
⚠️ Warning |
The PR description is incomplete. It omits required sections like issue reference, checklist, testing details, and changelog information specified in the template. |
Add missing template sections: issue reference (Closes #), checklist items, detailed testing steps, and expanded changelog description. |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. |
You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (1 passed)
| Check name |
Status |
Explanation |
| Title check |
✅ Passed |
The PR title accurately summarizes the main changes: adding build server metadata and trigger source tracking to deployments. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
build-server-metadata
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between cf63fc9 and cc56f5d.
📒 Files selected for processing (9)
.changeset/fluffy-weeks-sleep.md (1 hunks)
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts (2 hunks)
apps/webapp/app/v3/services/initializeDeployment.server.ts (3 hunks)
internal-packages/database/prisma/migrations/20251208112409_add_build_server_meta_to_deployments/migration.sql (1 hunks)
internal-packages/database/prisma/migrations/20251208144643_add_triggered_via_to_deployments/migration.sql (1 hunks)
internal-packages/database/prisma/schema.prisma (2 hunks)
packages/cli-v3/src/commands/deploy.ts (5 hunks)
packages/cli-v3/src/utilities/gitMeta.ts (1 hunks)
packages/core/src/v3/schemas/api.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
Files:
packages/cli-v3/src/utilities/gitMeta.ts
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Files:
packages/cli-v3/src/utilities/gitMeta.ts
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
**/*.{js,ts,jsx,tsx,json,md,css,scss}
📄 CodeRabbit inference engine (AGENTS.md)
Format code using Prettier
Files:
packages/cli-v3/src/utilities/gitMeta.ts
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use zod for validation in packages/core and apps/webapp
Files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/core/src/v3/schemas/api.ts
apps/webapp/app/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Access all environment variables through the env export of env.server.ts instead of directly accessing process.env in the Trigger.dev webapp
Files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
apps/webapp/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
apps/webapp/**/*.{ts,tsx}: When importing from @trigger.dev/core in the webapp, use subpath exports from the package.json instead of importing from the root path
Follow the Remix 2.1.0 and Express server conventions when updating the main trigger.dev webapp
Files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
apps/webapp/app/v3/services/**/*.server.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Organize services in the webapp following the pattern app/v3/services/*/*.server.ts
Files:
apps/webapp/app/v3/services/initializeDeployment.server.ts
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Use build extensions in trigger.config.ts (additionalFiles, additionalPackages, aptGet, prismaExtension, etc.) to customize the build
📚 Learning: 2025-08-14T12:13:20.455Z
Learnt from: myftija
Repo: triggerdotdev/trigger.dev PR: 2392
File: packages/cli-v3/src/utilities/gitMeta.ts:195-218
Timestamp: 2025-08-14T12:13:20.455Z
Learning: In the GitMeta schema (packages/core/src/v3/schemas/common.ts), all fields are intentionally optional to handle partial data from various deployment contexts (local, GitHub Actions, GitHub App). Functions like getGitHubAppMeta() are designed to work with missing environment variables rather than validate their presence.
Applied to files:
packages/cli-v3/src/utilities/gitMeta.ts
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Use build extensions in trigger.config.ts (additionalFiles, additionalPackages, aptGet, prismaExtension, etc.) to customize the build
Applied to files:
internal-packages/database/prisma/schema.prisma
.changeset/fluffy-weeks-sleep.md
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Run `npx trigger.devlatest init` to initialize a Trigger.dev project
Applied to files:
.changeset/fluffy-weeks-sleep.md
apps/webapp/app/v3/services/initializeDeployment.server.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `trigger.dev/sdk/v3` for all imports in Trigger.dev tasks
Applied to files:
.changeset/fluffy-weeks-sleep.md
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Run `npx trigger.devlatest dev` to start the Trigger.dev development server
Applied to files:
.changeset/fluffy-weeks-sleep.md
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `schemaTask()` from `trigger.dev/sdk/v3` with Zod schema for payload validation
Applied to files:
.changeset/fluffy-weeks-sleep.md
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use the `task()` function from `trigger.dev/sdk/v3` to define tasks with id and run properties
Applied to files:
.changeset/fluffy-weeks-sleep.md
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-14T19:24:39.536Z
Learnt from: myftija
Repo: triggerdotdev/trigger.dev PR: 2685
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.settings/route.tsx:1234-1257
Timestamp: 2025-11-14T19:24:39.536Z
Learning: In the trigger.dev project, version validation for the `useNativeBuildServer` setting cannot be performed at the settings form level because the SDK version is only known at build/deployment time, not when saving project settings.
Applied to files:
.changeset/fluffy-weeks-sleep.md
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : When importing from `trigger.dev/core` in the webapp, use subpath exports from the package.json instead of importing from the root path
Applied to files:
.changeset/fluffy-weeks-sleep.md
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/app/v3/presenters/**/*.server.{ts,tsx} : Organize presenters in the webapp following the pattern `app/v3/presenters/*/*.server.ts` to move complex loader code into classes
Applied to files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : Follow the Remix 2.1.0 and Express server conventions when updating the main trigger.dev webapp
Applied to files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Attach metadata to task runs using the metadata option when triggering, and access/update it inside runs using metadata functions
Applied to files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure build process in trigger.config.ts using `build` object with external packages, extensions, and JSX settings
Applied to files:
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:26:58.661Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2025-11-27T16:26:58.661Z
Learning: Applies to apps/webapp/app/**/*.{ts,tsx} : Access all environment variables through the `env` export of `env.server.ts` instead of directly accessing `process.env` in the Trigger.dev webapp
Applied to files:
apps/webapp/app/v3/services/initializeDeployment.server.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: The SDK at packages/trigger-sdk is an isomorphic TypeScript SDK
Applied to files:
apps/webapp/app/v3/services/initializeDeployment.server.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to packages/trigger-sdk/**/*.{ts,tsx} : In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code
Applied to files:
apps/webapp/app/v3/services/initializeDeployment.server.ts
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Export tasks with unique IDs within the project to enable proper task discovery and execution
Applied to files:
packages/cli-v3/src/commands/deploy.ts
packages/core/src/v3/schemas/api.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `tasks.trigger()` with type-only imports to trigger tasks from backend code without importing the task implementation
Applied to files:
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use logger methods (debug, log, info, warn, error) from `trigger.dev/sdk/v3` for structured logging in tasks
Applied to files:
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use metadata methods (set, del, replace, append, remove, increment, decrement, stream, flush) to update metadata during task execution
Applied to files:
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Configure Trigger.dev project in `trigger.config.ts` using `defineConfig()` with project ref and task directories
Applied to files:
packages/cli-v3/src/commands/deploy.ts
📚 Learning: 2025-11-27T16:27:35.304Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-11-27T16:27:35.304Z
Learning: Applies to **/trigger.config.ts : Specify runtime environment (node or bun) in trigger.config.ts using the `runtime` property
Applied to files:
packages/cli-v3/src/commands/deploy.ts
🧬 Code graph analysis (1)
apps/webapp/app/v3/services/initializeDeployment.server.ts (1)
packages/core/src/v3/schemas/api.ts (2)
BuildServerMetadata (424-430)
BuildServerMetadata (432-432)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: typecheck / typecheck
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (21)
packages/cli-v3/src/utilities/gitMeta.ts (1)
108-115: LGTM!
Exporting isGitHubActions enables reuse in the deploy command for CI environment detection. The function logic is correct and unchanged.
.changeset/fluffy-weeks-sleep.md (1)
1-6: LGTM!
Changeset correctly describes the new triggeredVia field and applies patch versions to the appropriate packages.
internal-packages/database/prisma/migrations/20251208144643_add_triggered_via_to_deployments/migration.sql (1)
1-1: LGTM!
Safe migration adding a nullable TEXT column. Non-blocking and backward compatible.
internal-packages/database/prisma/schema.prisma (2)
1752-1752: LGTM!
New buildServerMetadata field correctly defined as optional JSON, matching the JSONB migration.
1768-1768: LGTM!
New triggeredVia field correctly defined as optional String, matching the TEXT migration.
internal-packages/database/prisma/migrations/20251208112409_add_build_server_meta_to_deployments/migration.sql (1)
1-1: LGTM!
Safe migration adding a nullable JSONB column for structured build server metadata. Non-blocking and backward compatible.
apps/webapp/app/presenters/v3/DeploymentPresenter.server.ts (3)
2-6: LGTM!
Import correctly uses subpath export from @trigger.dev/core/v3 as per coding guidelines.
158-158: LGTM!
Correctly includes buildServerMetadata in the Prisma select clause to fetch the new field.
166-174: Consider using the parsed result's success status for the S2 condition.
The buildServerMetadata variable holds the safeParse result object (with success and data properties), but the S2 streaming condition checks buildServerMetadata for truthiness. Since safeParse always returns an object (never undefined), this condition may not behave as intended when deployment.buildServerMetadata is null/undefined.
However, looking more closely: when deployment.buildServerMetadata is falsy, buildServerMetadata will be undefined due to the conditional on line 166, so the current logic is correct.
packages/cli-v3/src/commands/deploy.ts (5)
9-10: LGTM!
Import of DeploymentTriggeredVia correctly uses subpath export from @trigger.dev/core/v3/schemas.
52-52: LGTM!
Import of isGitHubActions from the gitMeta utility enables reuse of the existing detection logic.
386-386: LGTM!
Correctly propagates triggeredVia in the standard deployment initialization path.
1037-1037: LGTM!
Correctly propagates triggeredVia in the native build server deployment path, maintaining consistency with the standard path.
898-930: Well-structured CI environment detection.
The function correctly detects major CI providers and returns appropriate typed values. All returned string literals ("cli:manual", "cli:ci_other", "cli:github_actions", "cli:gitlab_ci", "cli:circleci", "cli:jenkins", "cli:azure_pipelines", "cli:bitbucket_pipelines", "cli:travis_ci", "cli:buildkite") match the DeploymentTriggeredVia enum defined in packages/core/src/v3/schemas/api.ts. The ordering is logical—specific providers first, then generic CI fallback, and finally manual trigger for non-CI environments.
apps/webapp/app/v3/services/initializeDeployment.server.ts (3)
1-1: LGTM!
The import correctly uses the subpath export @trigger.dev/core/v3 as per the coding guidelines for webapp imports from @trigger.dev/core.
193-206: LGTM!
The buildServerMetadata construction logic correctly differentiates between:
- Non-native builds with only
buildId (minimal metadata)
- Native builds with full build server context (artifactKey, skipPromotion, configFilePath)
The conditional spread pattern is clean and the type annotation matches the Zod schema.
218-225: LGTM!
The new fields buildServerMetadata and triggeredVia are correctly integrated into the deployment creation. The ?? undefined pattern on line 225 is consistent with the existing style for git and runtime fields.
packages/core/src/v3/schemas/api.ts (4)
403-404: LGTM!
The anyString helper using z.custom<string & {}> is a valid pattern for creating a string type that accepts arbitrary values while maintaining type safety. The & {} intersection prevents TypeScript from widening the type to a plain string literal.
405-422: LGTM!
The DeploymentTriggeredVia schema provides excellent forward compatibility by combining a known enum of CI/CD sources with an anyString fallback. This design ensures:
- Type safety for known trigger sources
- Graceful handling of future sources without requiring schema updates
424-432: LGTM!
The BuildServerMetadata schema correctly defines all fields as optional, providing flexibility for:
- Non-native builds (only
buildId)
- Native builds (full metadata with
artifactKey, configFilePath, etc.)
This aligns with the consumption pattern in initializeDeployment.server.ts.
496-497: LGTM!
The new triggeredVia and buildId fields are correctly added to the base object schema. They are appropriately:
- Marked as optional
- Positioned before the discriminated union for
isNativeBuild
- Using the appropriate types (
DeploymentTriggeredVia for triggeredVia, simple string for buildId)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|