YAML for PostgreSQL CLI

View as Markdown

Execute PostgreSQL CLI commands on a PostgreSQL database.

YAML parameters for PostgreSQL CLI

PARAMETERS
targetsrequired(string | TargetYaml)[]
The list of PostgreSQL targets for this action. Each item is a target definition or a filter matching existing targets by identifier: a plain string such as sd* (* as a wildcard) or an object with type: MATCH.
commandsrequiredstring
List of shell commands to execute. Several commands go in one multi-line string (a | block), one per line - not a YAML list.
typerequiredstring

Value: POSTGRESQL_CLI

actionrequiredstring
Unique identifier for the action within the pipeline.
shellstring enum
The shell used to execute commands. Default: BASH.
Allowed enum:
SH,
BASH,
POWERSHELL
setup_commandsstring
Commands to run before the main commands (e.g., for installing dependencies). Several commands go in one multi-line string (a | block), one per line - not a YAML list.
execute_every_commandboolean
When true, execute all commands even if earlier ones fail.
build_tool_versionstring
Version of the CLI tool to use.
site_idstring
Site identifier for the CLI tool.
websitestring
Website URL for the CLI tool configuration.
valid_for_daysinteger
Number of days the results are valid for.
versionstring
Version of the CLI tool.
trigger_timestring enum
Specifies when the action should be executed. ON_SUCCESS actions run after every successful run, also one ended by an EARLY_EXIT action.
Allowed enum:
ON_EVERY_EXECUTION,
ON_SUCCESS,
ON_FAILURE,
ON_BACK_TO_SUCCESS,
ON_WARNING,
ON_WAIT_FOR_APPROVE,
ON_TERMINATE
loopstring[]
Names of the variables to loop over (IMAGES, not $IMAGES and not a value). The action runs once for each item of the value, and once for each combination of items when several variables are listed. The variable value is split into items by new lines, or by commas when it has no new lines (a single-line JSON object or key=value pairs stays one item). An item that is a JSON object or key=value pairs also sets one variable per key, named <VARIABLE>_<key>; an item that starts with EXTRACT: sets them as plain <key>.
run_only_on_first_failureboolean
When true, the action runs only on the first failure instead of on each failure. Used only when trigger_time is ON_FAILURE.
disabledboolean
When set to true the action is disabled. By default it is set to false.
timeoutinteger
The timeout in seconds. It cannot exceed the action time limit of the workspace plan; a higher value is rejected.
ignore_errorsboolean
If set to true the execution will proceed, mark action as a warning and jump to the next action. Doesn't apply to deployment actions.
retry_intervalinteger
Delay time between auto retries in seconds.
retry_countinteger
Number of retries if the action fails.

Constraints: ≤ 10

run_nextstring enum
Defines whether the action should run in parallel with the next one.
Allowed enum:
WAIT_ON_SUCCESS,
IN_SOFT_PARALLEL,
IN_HARD_PARALLEL
trigger_conditionsTriggerConditionYaml[]
The list of trigger conditions to meet so that the action can be triggered.
variablesVariableYaml[]
The list of variables you can use in the action.

Last modified on Nov 19, 2026

YAML examples for PostgreSQL CLI

Execute PostgreSQL commands

yaml
- action: "Run PostgreSQL queries"
  type: "POSTGRESQL_CLI"
  trigger_time: "ON_EVERY_EXECUTION"
  version: "16"
  shell: "BASH"
  commands: |-
    psql -c '\l'
    psql -f migrate.sql
  setup_commands: "apt-get install -y curl"
  targets:
    - target: my_database
      type: POSTGRESQL
      name: My PostgreSQL Database
      host: pg.example.com
      port: "5432"
      database: myapp
      auth:
        username: deploy_user
        password: secured