{{ message }}
feat(apps): add publish option and DD_APPS_PUBLISH env var#416
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 11 commits intoJul 1, 2026
Merged
Conversation
Add a `publish` option to the apps plugin that controls whether the `release/live` API call fires after a successful upload. Defaults to `true` (existing behavior unchanged). Set `publish: false` in vite.config.ts or pass `DD_APPS_PUBLISH=false` to upload a draft without making it live. Recommended package.json pattern: "upload-no-publish": "DD_APPS_UPLOAD_ASSETS=1 DD_APPS_PUBLISH=false vite build" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a `datadog-apps` binary to `@datadog/vite-plugin` with two commands:
deploy [--no-publish] - build, upload, and publish (default).
--no-publish uploads a draft only.
publish [--version <id>] - publish an already-uploaded version without
rebuilding. Defaults to the most recent version
recorded in .datadog-app-version.json.
After each successful deploy, the version_id and app identifier are written
to .datadog-app-version.json so `publish` works without arguments.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The upload tests were writing .datadog-app-version.json to disk as a side effect. Mock writeVersionCache in the test module and add the cache file to .gitignore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5e2ac30 to
fd4d4a1
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove shebang from cli.ts source (rollup adds it as a banner to the compiled output). Fix header ordering flagged by 'yarn cli integrity'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the datadog-apps CLI binary from @datadog/vite-plugin into a new standalone package @datadog/apps-cli. This keeps @datadog/vite-plugin focused on bundler integration. @datadog/vite-plugin no longer ships a bin entry or CLI bundle. @datadog/apps-cli packages the same CLI with its own package.json, versioning, and rollup config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CLI work (datadog-apps binary, @datadog/apps-cli, version-cache) will ship in a stacked PR once the CLI home is decided. This PR now only covers the publish option and DD_APPS_PUBLISH env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om types
No need to thread publish through AppsOptions → validate → UploadContext.
Just read getDDEnvValue('APPS_PUBLISH') directly in uploadArchive where
the decision is made. Simpler and keeps the types clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both were left over from local testing — no functional changes intended. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sdkennedy2
reviewed
Jun 30, 2026
| } | ||
|
|
||
| if (response.version_id) { | ||
| const shouldPublish = getDDEnvValue('APPS_PUBLISH') !== 'false'; |
Collaborator
There was a problem hiding this comment.
I notice our existing APPS_UPLOAD_ASSETS docs mention we set APPS_UPLOAD_ASSETS=1 versus here we are using a boolean value. Perhaps we create a helper function for normalizing this so that a customer could set 0/1 or false/true. Then we use the helper when evaluating both env variables.
…ling Both APPS_UPLOAD_ASSETS and APPS_PUBLISH now accept 0, 1, false, true, yes, no, on, off (case-insensitive) instead of relying on JS truthiness or an exact 'false' string check. Fixes: DD_APPS_UPLOAD_ASSETS=false would incorrectly enable upload (any non-empty string was truthy). DD_APPS_PUBLISH=0 would not disable publish (only the literal 'false' was checked). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sdkennedy2
approved these changes
Jun 30, 2026
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Motivation
High-code apps had no way to upload a new version without immediately publishing it live. Every upload triggered a
release/livecall, making it impossible to stage a version for review before promotion.Changes
Adds a
publishoption to the apps plugin that controls whetherrelease/liveis called after a successful upload:apps.publish: falseinvite.config.tsskips the publish stepDD_APPS_PUBLISH=false/DATADOG_APPS_PUBLISH=falseenv var does the same without touching configtrue— existing behavior is unchangedThe companion web-ui PR (DataDog/web-ui#319459) adds an
upload-no-publishscript to the scaffolder so users don't need to know the env var:Files changed:
packages/core/src/helpers/env.ts— registersAPPS_PUBLISHenv varpackages/plugins/apps/src/types.ts— addspublishtoAppsOptionsandAppsOptionsWithDefaultspackages/plugins/apps/src/validate.ts— resolvespublishfrom config or env varpackages/plugins/apps/src/upload.ts— gates therelease/livePUT call oncontext.publishpackages/plugins/apps/src/vite/handle-upload.ts— passesoptions.publishthroughpackages/plugins/apps/README.md— documentsapps.publishand the recommended script patternQA Instructions
A test app is in
DataDog/experimentalusing the published@datadog/vite-plugin. Each build bakes in a timestamp and unique badge color so you can tell at a glance whether the live version changed.git clone git@github.com:DataDog/experimental.git cd experimental/user/setnilson/deploy-test-app npm installTest 1 — upload and publish in one shot (existing behavior, should still work):
Open the app in App Builder. Badge color and timestamp should change on reload.
Test 2 — upload a draft without publishing:
The live badge should not change after reload — the draft is saved but not live.
Test 3 — publish the draft:
Go to App Builder, open the app, and publish the draft version from the version history. Badge should now update.
Blast Radius
Only affects apps using
@datadog/vite-pluginwithapps.enable: true. Defaults totrueso no existing upload flow changes. The new env var is opt-in.