dcloud deploy previews configure

Set up, change or turn off an app's preview environments

IAM deploy:UpdatePreviewSettingsChanges stateAsks before it deletes (-y skips)

A preview is an app of its own on one small machine, at https://<branch>.<app>.<org>.apps.<root>. With trigger pull_request, a pull request into the app’s branch gets one when it opens and loses it when it merges or closes; with branch, every pushed branch other than the app’s gets one and loses it when the branch is deleted. A push to the branch redeploys it. It is deleted idleDays after the last push unless kept. Its env: the app’s plain variables, the secrets named in sharedSecretKeys, then envOverrides. With databaseBranch, a Postgres branch of the app’s bound database (pr-<n> for a pull request); without it, no database. Each step is the commit status `ews/preview`; the pull request gets one comment with the URL and the cost when it first serves. Previews are made as the person who pushed or opened the pull request, who needs deploy:CreatePreview on the app; at most maxPreviews at once.

Synopsis

dcloud deploy previews configure id --enabled enabled [flags]

Arguments

  • <id>Required

    string

    Also accepted as --id. Constraints: uuid

Flags

  • --enabledRequired

    boolean (--enabled / --no-enabled)

    Whether pull requests (or branches) get preview environments

  • --triggerOptional

    enum

    pull_request: a preview per open pull request into the app’s branch; branch: one per pushed branch

    One of: pull_request, branch

    Default: "pull_request"

  • --env-overridesOptional

    map of string

    Plain variables set in every preview on top of the app’s (a key here wins)

    Constraints: key=value

    Default: {}

  • --shared-secret-keysOptional

    array of string

    Secret-bound variables of the app that previews get too; every other secret is withheld (plain values are copied)

    Constraints: max 128 chars, /^[A-Za-z_][A-Za-z0-9_]*$/

    Default: []

  • --database-branchOptional

    boolean (--database-branch / --no-database-branch)

    Give each preview a Postgres branch of the app’s bound database; off: previews get no database binding

    Default: false

  • --idle-daysOptional

    number

    Delete a preview this many days after the last push to its branch, unless kept

    Constraints: integer, 1-90

    Default: 7

  • --max-previewsOptional

    number

    At most this many previews at once; the next one is refused with a commit status

    Constraints: integer, 1-20

    Default: 10

  • --instance-typeOptional

    string

    Machine type of a preview; null: the smallest the region offers

    Constraints: 1-32 chars

    Default: null

    May be null.

Example

dcloud deploy previews configure id --enabled

Generated from the API description, the same one the API checks requests against and the CLI is built from.