LinuxCommandLibrary

sfdk-deploy

Deploy Salesforce metadata to an organization

TLDR

Deploy using a specified method (pkcon, rsync, sdk, zypper, zypper-dup or manual)

$ sfdk deploy --[method]
copy

Preview deploy without applying the changes
$ sfdk deploy --[method] [[-n|--dry-run]]
copy

Deploy files in glob pattern package*
$ sfdk deploy --[method] "+package*"
copy

Deploy all files excluding ignore*
$ sfdk deploy --[method] "-ignore*"
copy

Undeploy using a specified method (pkcon, rpm, rsync, sdk or zypper)
$ sfdk undeploy --[method]
copy

SYNOPSIS

sfdx deploy -u target_username -f manifest_file
sfdx deploy -u target_username -d source_directory
sfdx deploy -u target_username -s source_path

PARAMETERS

-u, --targetusername target_username
    Specifies the target Salesforce username or alias. The target org where the metadata will be deployed to.

-f, --manifest manifest_file
    Path to the package.xml manifest file. This file defines the metadata components to be deployed.

-d, --sourcepath source_directory
    Path to the source directory containing the Salesforce metadata to deploy.

-s, --singlepackage source_path
    Path to the directory containing a single Salesforce package to deploy. This can be used to deploy unlocked packages.

-w, --wait minutes
    Number of minutes to wait for the deployment process to complete. Defaults to 33 minutes.

-g, --ignorewarnings
    Indicates whether to proceed with the deployment even if there are warnings. By default warnings halt the deployment.

-k, --checkonly
    Indicates whether to run the deployment as a validation-only operation.

-l, --loglevel level
    Logging level for this command invocation. Defaults to `warn`.

DESCRIPTION

The `sfdx-deploy` command is a command-line interface (CLI) tool designed to simplify and automate the deployment of Salesforce metadata, code, and configurations between different Salesforce environments, such as development orgs, testing sandboxes, and production orgs. It leverages the Salesforce DX (Developer Experience) project structure and metadata API to facilitate version control, collaboration, and continuous integration/continuous deployment (CI/CD) workflows for Salesforce development. The tool aims to streamline the deployment process, reduce errors, and accelerate the delivery of Salesforce solutions. It supports deployment of various metadata types, including Apex classes, Visualforce pages, Lightning components, custom objects, and more. It often works with `sfdx force:source:push` and `sfdx force:source:pull`, offering automated deployments.

CAVEATS

Requires Salesforce DX CLI to be installed and properly configured.
Authenticating with the target Salesforce org is necessary before running the command.
Manifest files must adhere to the Salesforce metadata API format.

ERROR HANDLING

The command will exit with a non-zero status code if any errors occur during the deployment process. Inspect the CLI output for details on the errors encountered.

SEE ALSO

sfdx force:source:push(1), sfdx force:source:pull(1), sfdx force:mdapi:deploy(1)

Copied to clipboard