hardis:project:deploy:start
Description
sfdx-hardis wrapper for sf project deploy start that displays tips to solve deployment errors.
Note: Use --json argument to have better results
See documentation of Salesforce command
Deployment pre or post commands
You can define command lines to run before or after a deployment, with parameters:
- id: Unique Id for the command
- label: Human readable label for the command
- skipIfError: If defined to "true", the post-command won't be run if there is a deployment failure
- context: Defines the context where the command will be run. Can be all (default), check-deployment-only or process-deployment-only
- runOnlyOnceByOrg: If set to true (default), the action runs only once per target org — subsequent deployments skip it. State is tracked in the "Deployment Actions" PR comment.
After every action runs, its result (✅ success, ❌ failed, 👋 manual) is recorded in a dedicated "Deployment Actions" PR comment — ordered by org (integration → uat → preprod → prod) — regardless of runOnlyOnceByOrg.
If the commands are not the same depending on the target org, you can define them into config/branches/.sfdx-hardis-BRANCHNAME.yml instead of root config/.sfdx-hardis.yml
Example:
commandsPreDeploy:
- id: knowledgeUnassign
label: Remove KnowledgeUser right to the user who has it
command: sf data update record --sobject User --where "UserPermissionsKnowledgeUser='true'" --values "UserPermissionsKnowledgeUser='false'" --json
- id: knowledgeAssign
label: Assign Knowledge user to the deployment user
command: sf data update record --sobject User --where "Username='deploy.github@myclient.com'" --values "UserPermissionsKnowledgeUser='true'" --json
commandsPostDeploy:
- id: knowledgeUnassign
label: Remove KnowledgeUser right to the user who has it
command: sf data update record --sobject User --where "UserPermissionsKnowledgeUser='true'" --values "UserPermissionsKnowledgeUser='false'" --json
- id: knowledgeAssign
label: Assign Knowledge user to desired username
command: sf data update record --sobject User --where "Username='admin-yser@myclient.com'" --values "UserPermissionsKnowledgeUser='true'" --json
- id: someActionToRunJustOneTime
label: And to run only if deployment is success
command: sf sfdmu:run ...
skipIfError: true
context: process-deployment-only
runOnlyOnceByOrg: true
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:project:deploy:start --agent
In agent mode, all interactive prompts are skipped and default values are used.
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| agent | boolean | Run in non-interactive mode for agents and automation | |||
| api-version -a |
option | api-version | |||
| async | boolean | async | |||
| coverage-formatters | option | coverage-formatters | |||
| debug | boolean | debug | |||
| dry-run | boolean | dry-run | |||
| flags-dir | option | undefined | |||
| ignore-conflicts -c |
boolean | ignore-conflicts | |||
| ignore-errors -r |
boolean | ignore-errors | |||
| ignore-warnings -g |
boolean | ignore-warnings | |||
| json | boolean | Format output as json. | |||
| junit | boolean | junit | |||
| manifest -x |
option | manifest | |||
| metadata -m |
option | metadata | |||
| metadata-dir | option | metadata-dir | |||
| post-destructive-changes | option | post-destructive-changes | |||
| pre-destructive-changes | option | pre-destructive-changes | |||
| purge-on-delete | boolean | purge-on-delete | |||
| results-dir | option | results-dir | |||
| single-package | boolean | single-package | |||
| source-dir -d |
option | source-dir | |||
| target-org -o |
option | undefined | |||
| test-level | option | test-level | |||
| tests | option | tests | |||
| wait -w |
option | wait | 33 |
