Repository navigation
Description
Is your feature request related to a problem? Please describe.
We prove unmerged code in CI before it lands on the default branch. That proof should include building the exact deploy artefact for our tasks, so that a broken bundle is caught before merge. Then, once the change is on the default branch, a separate trusted job ships that same artefact.
The rule we follow is common: a job that runs unmerged code never holds a production credential. Today trigger deploy can't be split that way. In v4.9.3:
deploycallsauthenticateForProjectbefore anything else. That covers--dry-runtoo, which fails with "You must login first" ifTRIGGER_ACCESS_TOKENis absent.- On the local-build path, the bundle step (
buildWorker) also fetches the environment's variables and the forced externals through the project client, so it needs the token as well. - The hidden
--from-bundle <dir>flag can consume a pre-built bundle. But no public, tokenless command produces that bundle, and--from-bundleis marked internal and conflicts with the native build server.
So the choice today is to hand the token to a job running unmerged code, or to build the deploy artefact only after merge, which puts the whole bundle and image build on the release critical path.
Describe the solution you'd like to see
Split deploy into a tokenless build and a credentialed ship, for example:
# Job 1: unmerged code, no credentials. Fully offline with respect to Trigger.dev.
trigger deploy --build-only --output ./trigger-artefact # or an image ref: --output registry/repo:tag
# Job 2: default branch only, holds TRIGGER_ACCESS_TOKEN.
trigger deploy --from ./trigger-artefact --env prod [--skip-promotion]Properties that would make this useful:
--build-onlymakes no API call and needs no token. Anything it would have fetched (env vars for the build, forced externals) is either not needed to bundle or is resolved in the second step.- The output is content-addressed, with
contentHashinbuild.jsonand, if an image is built, its digest, so the second step can prove it ships exactly what was built and tested. --fromregisters and pushes that artefact without re-bundling. If it builds the image, it does so deterministically from the bundle. If the first step produced an image, it pushes that image with its digest preserved.- It is documented and supported, not an internal flag.
--from-bundlealready looks like most of the second half.
Describe alternate solutions
- Build with the token at the PR stage, using
--skip-promotion: this still places a production credential beside unmerged build scripts. - GitHub OIDC trusted deploys: these remove the stored token, but the job running unmerged code still obtains a deploy credential.
--local-bundleand--from-bundleare also refused with OIDC. - Build only after merge: this is safe, but it adds several minutes to every release.
- Use
--dry-runas the proof: this needs the token too, and it doesn't produce an artefact that can be shipped later.
Additional information
Checked against trigger.dev@4.9.3 (dist/esm/commands/deploy.js: _deployCommand, handleFromBundleDeploy; dist/esm/deploy/trustedDeploy.js). I couldn't find an existing issue or discussion asking for this. Happy to test a prerelease.
Activity
Justify-social commentedon Dec 6, 2026
I've implemented this on a fork branch, and I've asked for a vouch in #5010 so I can open it as a draft PR: main...Justify-social:trigger.dev:cli-deploy-build-only
Summary:
deploy --build-only --output <dir>makes no login and no API call. It writes the bundle and atrigger-bundle.jsonmanifest: CLI version, environment, build content hash, a hash of every bundle file and a config hash. Server env vars aren't fetched, so build extensions see only the process env and--env-file. The forced-externals list is the CLI's built-in one, and the deploy step checks it against the server's.deploy --from <dir>(the public form of--from-bundle, which stays as the local-build alias) verifies the manifest and then uploads that exact bundle through the existing nativefromBundlepath. With--local-buildit builds with local Docker. Either way it bundles nothing again.--auth-method oidcaccepts--from. The trusted prepare route can issue adeployment_bundleartifact, and submit acceptsfromBundlewith itscontentHash. Caller-supplied build env vars stay refused.I tested
--build-onlyend to end with no token, no stored login and an unreachable API URL. Two runs produced the same bundle hash.